linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] gpio/nomadik: use genirq core to track enablement
@ 2011-09-20  8:50 Linus Walleij
  2011-09-20 17:37 ` Grant Likely
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2011-09-20  8:50 UTC (permalink / raw)
  To: linux-arm-kernel

From: Linus Walleij <linus.walleij@linaro.org>

Currently the Nomadik GPIO driver tracks enabled/disabled interrupt
status with a local variable, switch to using the interrupt core.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/gpio-nomadik.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c
index 97e9be9..0b7ec12 100644
--- a/drivers/gpio/gpio-nomadik.c
+++ b/drivers/gpio/gpio-nomadik.c
@@ -58,7 +58,6 @@ struct nmk_gpio_chip {
 	u32 rwimsc;
 	u32 fwimsc;
 	u32 slpm;
-	u32 enabled;
 	u32 pull_up;
 };
 
@@ -605,11 +604,6 @@ static int nmk_gpio_irq_maskunmask(struct irq_data *d, bool enable)
 	if (!nmk_chip)
 		return -EINVAL;
 
-	if (enable)
-		nmk_chip->enabled |= bitmask;
-	else
-		nmk_chip->enabled &= ~bitmask;
-
 	clk_enable(nmk_chip->clk);
 	spin_lock_irqsave(&nmk_gpio_slpm_lock, flags);
 	spin_lock(&nmk_chip->lock);
@@ -653,7 +647,7 @@ static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
 	spin_lock_irqsave(&nmk_gpio_slpm_lock, flags);
 	spin_lock(&nmk_chip->lock);
 
-	if (!(nmk_chip->enabled & bitmask))
+	if (irqd_irq_disabled(d))
 		__nmk_gpio_set_wake(nmk_chip, gpio, on);
 
 	if (on)
@@ -670,7 +664,7 @@ static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
 
 static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type)
 {
-	bool enabled;
+	bool enabled = !irqd_irq_disabled(d);
 	bool wake = irqd_is_wakeup_set(d);
 	int gpio;
 	struct nmk_gpio_chip *nmk_chip;
@@ -691,7 +685,6 @@ static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type)
 	clk_enable(nmk_chip->clk);
 	spin_lock_irqsave(&nmk_chip->lock, flags);
 
-	enabled = !!(nmk_chip->enabled & bitmask);
 	if (enabled)
 		__nmk_gpio_irq_modify(nmk_chip, gpio, NORMAL, false);
 
-- 
1.7.3.2

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

* [PATCH 2/2] gpio/nomadik: use genirq core to track enablement
  2011-09-20  8:50 [PATCH 2/2] gpio/nomadik: use genirq core to track enablement Linus Walleij
@ 2011-09-20 17:37 ` Grant Likely
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2011-09-20 17:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Sep 20, 2011 at 10:50:15AM +0200, Linus Walleij wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
> 
> Currently the Nomadik GPIO driver tracks enabled/disabled interrupt
> status with a local variable, switch to using the interrupt core.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Applied both, thanks.

g.

> ---
>  drivers/gpio/gpio-nomadik.c |   11 ++---------
>  1 files changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c
> index 97e9be9..0b7ec12 100644
> --- a/drivers/gpio/gpio-nomadik.c
> +++ b/drivers/gpio/gpio-nomadik.c
> @@ -58,7 +58,6 @@ struct nmk_gpio_chip {
>  	u32 rwimsc;
>  	u32 fwimsc;
>  	u32 slpm;
> -	u32 enabled;
>  	u32 pull_up;
>  };
>  
> @@ -605,11 +604,6 @@ static int nmk_gpio_irq_maskunmask(struct irq_data *d, bool enable)
>  	if (!nmk_chip)
>  		return -EINVAL;
>  
> -	if (enable)
> -		nmk_chip->enabled |= bitmask;
> -	else
> -		nmk_chip->enabled &= ~bitmask;
> -
>  	clk_enable(nmk_chip->clk);
>  	spin_lock_irqsave(&nmk_gpio_slpm_lock, flags);
>  	spin_lock(&nmk_chip->lock);
> @@ -653,7 +647,7 @@ static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
>  	spin_lock_irqsave(&nmk_gpio_slpm_lock, flags);
>  	spin_lock(&nmk_chip->lock);
>  
> -	if (!(nmk_chip->enabled & bitmask))
> +	if (irqd_irq_disabled(d))
>  		__nmk_gpio_set_wake(nmk_chip, gpio, on);
>  
>  	if (on)
> @@ -670,7 +664,7 @@ static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
>  
>  static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type)
>  {
> -	bool enabled;
> +	bool enabled = !irqd_irq_disabled(d);
>  	bool wake = irqd_is_wakeup_set(d);
>  	int gpio;
>  	struct nmk_gpio_chip *nmk_chip;
> @@ -691,7 +685,6 @@ static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type)
>  	clk_enable(nmk_chip->clk);
>  	spin_lock_irqsave(&nmk_chip->lock, flags);
>  
> -	enabled = !!(nmk_chip->enabled & bitmask);
>  	if (enabled)
>  		__nmk_gpio_irq_modify(nmk_chip, gpio, NORMAL, false);
>  
> -- 
> 1.7.3.2
> 

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

end of thread, other threads:[~2011-09-20 17:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-20  8:50 [PATCH 2/2] gpio/nomadik: use genirq core to track enablement Linus Walleij
2011-09-20 17:37 ` 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).