public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/7] gpio/em: convert to linear IRQ domain
@ 2012-10-16 19:22 Linus Walleij
  2012-11-21 14:58 ` Grant Likely
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2012-10-16 19:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Rob Herring, Grant Likely, Linus Walleij, Magnus Damm

The code in the em driver seems to want to try to do the job of
the linear IRQ domain (allocate descriptors and grab a virtual
range). So why not just use the linear IRQ domain?

Also fixed the FIXME to remove the domain after use.

Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Magnus Damm <damm@opensource.se>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/gpio-em.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
index efb4c2d..aac5c75 100644
--- a/drivers/gpio/gpio-em.c
+++ b/drivers/gpio/gpio-em.c
@@ -35,7 +35,6 @@
 struct em_gio_priv {
 	void __iomem *base0;
 	void __iomem *base1;
-	unsigned int irq_base;
 	spinlock_t sense_lock;
 	struct platform_device *pdev;
 	struct gpio_chip gpio_chip;
@@ -239,33 +238,18 @@ static int __devinit em_gio_irq_domain_init(struct em_gio_priv *p)
 	struct platform_device *pdev = p->pdev;
 	struct gpio_em_config *pdata = pdev->dev.platform_data;
 
-	p->irq_base = irq_alloc_descs(pdata->irq_base, 0,
-				      pdata->number_of_pins, numa_node_id());
-	if (p->irq_base < 0) {
-		dev_err(&pdev->dev, "cannot get irq_desc\n");
-		return p->irq_base;
-	}
-	pr_debug("gio: hw base = %d, nr = %d, sw base = %d\n",
-		 pdata->gpio_base, pdata->number_of_pins, p->irq_base);
-
-	p->irq_domain = irq_domain_add_legacy(pdev->dev.of_node,
+	p->irq_domain = irq_domain_add_linear(pdev->dev.of_node,
 					      pdata->number_of_pins,
-					      p->irq_base, 0,
 					      &em_gio_irq_domain_ops, p);
-	if (!p->irq_domain) {
-		irq_free_descs(p->irq_base, pdata->number_of_pins);
+	if (!p->irq_domain)
 		return -ENXIO;
-	}
 
 	return 0;
 }
 
 static void em_gio_irq_domain_cleanup(struct em_gio_priv *p)
 {
-	struct gpio_em_config *pdata = p->pdev->dev.platform_data;
-
-	irq_free_descs(p->irq_base, pdata->number_of_pins);
-	/* FIXME: irq domain wants to be freed! */
+	irq_domain_remove(p->irq_domain);
 }
 
 static int __devinit em_gio_probe(struct platform_device *pdev)
-- 
1.7.11.7


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

* Re: [PATCH 2/7] gpio/em: convert to linear IRQ domain
  2012-10-16 19:22 [PATCH 2/7] gpio/em: convert to linear IRQ domain Linus Walleij
@ 2012-11-21 14:58 ` Grant Likely
  2012-11-22  9:03   ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Grant Likely @ 2012-11-21 14:58 UTC (permalink / raw)
  To: Linus Walleij, linux-kernel; +Cc: Rob Herring, Linus Walleij, Magnus Damm

On Tue, 16 Oct 2012 21:22:20 +0200, Linus Walleij <linus.walleij@linaro.org> wrote:
> The code in the em driver seems to want to try to do the job of
> the linear IRQ domain (allocate descriptors and grab a virtual
> range). So why not just use the linear IRQ domain?
> 
> Also fixed the FIXME to remove the domain after use.

Applied, thanks.

g.

> 
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Magnus Damm <damm@opensource.se>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/gpio/gpio-em.c | 22 +++-------------------
>  1 file changed, 3 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
> index efb4c2d..aac5c75 100644
> --- a/drivers/gpio/gpio-em.c
> +++ b/drivers/gpio/gpio-em.c
> @@ -35,7 +35,6 @@
>  struct em_gio_priv {
>  	void __iomem *base0;
>  	void __iomem *base1;
> -	unsigned int irq_base;
>  	spinlock_t sense_lock;
>  	struct platform_device *pdev;
>  	struct gpio_chip gpio_chip;
> @@ -239,33 +238,18 @@ static int __devinit em_gio_irq_domain_init(struct em_gio_priv *p)
>  	struct platform_device *pdev = p->pdev;
>  	struct gpio_em_config *pdata = pdev->dev.platform_data;
>  
> -	p->irq_base = irq_alloc_descs(pdata->irq_base, 0,
> -				      pdata->number_of_pins, numa_node_id());
> -	if (p->irq_base < 0) {
> -		dev_err(&pdev->dev, "cannot get irq_desc\n");
> -		return p->irq_base;
> -	}
> -	pr_debug("gio: hw base = %d, nr = %d, sw base = %d\n",
> -		 pdata->gpio_base, pdata->number_of_pins, p->irq_base);
> -
> -	p->irq_domain = irq_domain_add_legacy(pdev->dev.of_node,
> +	p->irq_domain = irq_domain_add_linear(pdev->dev.of_node,
>  					      pdata->number_of_pins,
> -					      p->irq_base, 0,
>  					      &em_gio_irq_domain_ops, p);
> -	if (!p->irq_domain) {
> -		irq_free_descs(p->irq_base, pdata->number_of_pins);
> +	if (!p->irq_domain)
>  		return -ENXIO;
> -	}
>  
>  	return 0;
>  }
>  
>  static void em_gio_irq_domain_cleanup(struct em_gio_priv *p)
>  {
> -	struct gpio_em_config *pdata = p->pdev->dev.platform_data;
> -
> -	irq_free_descs(p->irq_base, pdata->number_of_pins);
> -	/* FIXME: irq domain wants to be freed! */
> +	irq_domain_remove(p->irq_domain);
>  }
>  
>  static int __devinit em_gio_probe(struct platform_device *pdev)
> -- 
> 1.7.11.7
> 

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.

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

* Re: [PATCH 2/7] gpio/em: convert to linear IRQ domain
  2012-11-21 14:58 ` Grant Likely
@ 2012-11-22  9:03   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2012-11-22  9:03 UTC (permalink / raw)
  To: Grant Likely; +Cc: linux-kernel, Rob Herring, Magnus Damm

On Wed, Nov 21, 2012 at 3:58 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Tue, 16 Oct 2012 21:22:20 +0200, Linus Walleij <linus.walleij@linaro.org> wrote:
>> The code in the em driver seems to want to try to do the job of
>> the linear IRQ domain (allocate descriptors and grab a virtual
>> range). So why not just use the linear IRQ domain?
>>
>> Also fixed the FIXME to remove the domain after use.
>
> Applied, thanks.

Uh I've taken most of these into my own GPIO tree ... maybe I should
just send you a pull request for what I have so we can avoid any clashes
in the V3.8 merge window?

Thanks,
Linus Walleij

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

end of thread, other threads:[~2012-11-22 20:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-16 19:22 [PATCH 2/7] gpio/em: convert to linear IRQ domain Linus Walleij
2012-11-21 14:58 ` Grant Likely
2012-11-22  9:03   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox