diff mbox series

[v1,01/10] gpio: crystalcove: Use for_each_set_bit() in IRQ handler

Message ID 20190205133829.68968-1-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1,01/10] gpio: crystalcove: Use for_each_set_bit() in IRQ handler | expand

Commit Message

Andy Shevchenko Feb. 5, 2019, 1:38 p.m. UTC
This simplifies and standardizes the AB IRQ handler by using
the for_each_set_bit() library function.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-crystalcove.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Kuppuswamy Sathyanarayanan Feb. 5, 2019, 6:58 p.m. UTC | #1
On 2/5/19 5:38 AM, Andy Shevchenko wrote:
> This simplifies and standardizes the AB IRQ handler by using
> the for_each_set_bit() library function.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Looks good to me.

Reviewed-by: Kuppuswamy Sathyanarayanan 
<sathyanarayanan.kuppuswamy@linux.intel.com>

> ---
>   drivers/gpio/gpio-crystalcove.c | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpio/gpio-crystalcove.c b/drivers/gpio/gpio-crystalcove.c
> index 58531d8b8c6e..3c39d1b6c3ad 100644
> --- a/drivers/gpio/gpio-crystalcove.c
> +++ b/drivers/gpio/gpio-crystalcove.c
> @@ -279,8 +279,8 @@ static struct irq_chip crystalcove_irqchip = {
>   static irqreturn_t crystalcove_gpio_irq_handler(int irq, void *data)
>   {
>   	struct crystalcove_gpio *cg = data;
> +	unsigned long pending;
>   	unsigned int p0, p1;
> -	int pending;
>   	int gpio;
>   	unsigned int virq;
>   
> @@ -293,11 +293,9 @@ static irqreturn_t crystalcove_gpio_irq_handler(int irq, void *data)
>   
>   	pending = p0 | p1 << 8;
>   
> -	for (gpio = 0; gpio < CRYSTALCOVE_GPIO_NUM; gpio++) {
> -		if (pending & BIT(gpio)) {
> -			virq = irq_find_mapping(cg->chip.irq.domain, gpio);
> -			handle_nested_irq(virq);
> -		}
> +	for_each_set_bit(gpio, &pending, CRYSTALCOVE_GPIO_NUM) {
> +		virq = irq_find_mapping(cg->chip.irq.domain, gpio);
> +		handle_nested_irq(virq);
>   	}
>   
>   	return IRQ_HANDLED;
Linus Walleij Feb. 8, 2019, 1:38 p.m. UTC | #2
On Tue, Feb 5, 2019 at 2:38 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> This simplifies and standardizes the AB IRQ handler by using
> the for_each_set_bit() library function.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

All of these 10 patches look good to me, will you send me
a pull request for them or shall I just queue them?

Yours,
Linus Walleij
Andy Shevchenko Feb. 8, 2019, 1:53 p.m. UTC | #3
On Fri, Feb 08, 2019 at 02:38:01PM +0100, Linus Walleij wrote:
> On Tue, Feb 5, 2019 at 2:38 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> 
> > This simplifies and standardizes the AB IRQ handler by using
> > the for_each_set_bit() library function.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> All of these 10 patches look good to me, will you send me
> a pull request for them or shall I just queue them?

I'll send a PR.
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-crystalcove.c b/drivers/gpio/gpio-crystalcove.c
index 58531d8b8c6e..3c39d1b6c3ad 100644
--- a/drivers/gpio/gpio-crystalcove.c
+++ b/drivers/gpio/gpio-crystalcove.c
@@ -279,8 +279,8 @@  static struct irq_chip crystalcove_irqchip = {
 static irqreturn_t crystalcove_gpio_irq_handler(int irq, void *data)
 {
 	struct crystalcove_gpio *cg = data;
+	unsigned long pending;
 	unsigned int p0, p1;
-	int pending;
 	int gpio;
 	unsigned int virq;
 
@@ -293,11 +293,9 @@  static irqreturn_t crystalcove_gpio_irq_handler(int irq, void *data)
 
 	pending = p0 | p1 << 8;
 
-	for (gpio = 0; gpio < CRYSTALCOVE_GPIO_NUM; gpio++) {
-		if (pending & BIT(gpio)) {
-			virq = irq_find_mapping(cg->chip.irq.domain, gpio);
-			handle_nested_irq(virq);
-		}
+	for_each_set_bit(gpio, &pending, CRYSTALCOVE_GPIO_NUM) {
+		virq = irq_find_mapping(cg->chip.irq.domain, gpio);
+		handle_nested_irq(virq);
 	}
 
 	return IRQ_HANDLED;