linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/4 v2] gpio/tegra: convert to use linear irqdomain
@ 2012-10-19 10:54 Linus Walleij
  2012-10-19 16:12 ` Stephen Warren
  2012-11-21 15:06 ` Grant Likely
  0 siblings, 2 replies; 3+ messages in thread
From: Linus Walleij @ 2012-10-19 10:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Walleij, Rob Herring, Grant Likely, Stephen Warren

The Tegra driver tries to do the work of irq_domain_add_linear()
by reserving a bunch of descriptors somewhere and keeping track
of the base offset, then calling irq_domain_add_legacy(). Let's
stop doing that and simply use the linear IRQ domain.

For this to work: use irq_create_mapping() in the IRQ iterator
so that the descriptors get allocated here.

Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Make sure that irq_create_mapping() is called for every IRQ
  on probe() and update the commit message.
---
 drivers/gpio/gpio-tegra.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index d982593..c7c175a 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -380,7 +380,6 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *match;
 	struct tegra_gpio_soc_config *config;
-	int irq_base;
 	struct resource *res;
 	struct tegra_gpio_bank *bank;
 	int gpio;
@@ -417,14 +416,11 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	irq_base = irq_alloc_descs(-1, 0, tegra_gpio_chip.ngpio, 0);
-	if (irq_base < 0) {
-		dev_err(&pdev->dev, "Couldn't allocate IRQ numbers\n");
-		return -ENODEV;
-	}
-	irq_domain = irq_domain_add_legacy(pdev->dev.of_node,
-					   tegra_gpio_chip.ngpio, irq_base, 0,
+	irq_domain = irq_domain_add_linear(pdev->dev.of_node,
+					   tegra_gpio_chip.ngpio,
 					   &irq_domain_simple_ops, NULL);
+	if (!irq_domain)
+		return -ENODEV;
 
 	for (i = 0; i < tegra_gpio_bank_count; i++) {
 		res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
@@ -464,7 +460,7 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev)
 	gpiochip_add(&tegra_gpio_chip);
 
 	for (gpio = 0; gpio < tegra_gpio_chip.ngpio; gpio++) {
-		int irq = irq_find_mapping(irq_domain, gpio);
+		int irq = irq_create_mapping(irq_domain, gpio);
 		/* No validity check; all Tegra GPIOs are valid IRQs */
 
 		bank = &tegra_gpio_banks[GPIO_BANK(gpio)];
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/4 v2] gpio/tegra: convert to use linear irqdomain
  2012-10-19 10:54 [PATCH 4/4 v2] gpio/tegra: convert to use linear irqdomain Linus Walleij
@ 2012-10-19 16:12 ` Stephen Warren
  2012-11-21 15:06 ` Grant Likely
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2012-10-19 16:12 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-kernel, Rob Herring, Grant Likely, Stephen Warren

On 10/19/2012 04:54 AM, Linus Walleij wrote:
> The Tegra driver tries to do the work of irq_domain_add_linear()
> by reserving a bunch of descriptors somewhere and keeping track
> of the base offset, then calling irq_domain_add_legacy(). Let's
> stop doing that and simply use the linear IRQ domain.
> 
> For this to work: use irq_create_mapping() in the IRQ iterator
> so that the descriptors get allocated here.

Tested-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/4 v2] gpio/tegra: convert to use linear irqdomain
  2012-10-19 10:54 [PATCH 4/4 v2] gpio/tegra: convert to use linear irqdomain Linus Walleij
  2012-10-19 16:12 ` Stephen Warren
@ 2012-11-21 15:06 ` Grant Likely
  1 sibling, 0 replies; 3+ messages in thread
From: Grant Likely @ 2012-11-21 15:06 UTC (permalink / raw)
  To: Linus Walleij, linux-kernel; +Cc: Linus Walleij, Rob Herring, Stephen Warren

On Fri, 19 Oct 2012 12:54:12 +0200, Linus Walleij <linus.walleij@linaro.org> wrote:
> The Tegra driver tries to do the work of irq_domain_add_linear()
> by reserving a bunch of descriptors somewhere and keeping track
> of the base offset, then calling irq_domain_add_legacy(). Let's
> stop doing that and simply use the linear IRQ domain.
> 
> For this to work: use irq_create_mapping() in the IRQ iterator
> so that the descriptors get allocated here.
> 
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Stephen Warren <swarren@nvidia.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Applied, thanks.

g.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-21 15:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-19 10:54 [PATCH 4/4 v2] gpio/tegra: convert to use linear irqdomain Linus Walleij
2012-10-19 16:12 ` Stephen Warren
2012-11-21 15:06 ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).