pinctrl: sh-pfc: gpio: Return early in gpio_pin_to_irq()
diff mbox series

Message ID 20200212090200.11106-1-geert+renesas@glider.be
State New
Headers show
Series
  • pinctrl: sh-pfc: gpio: Return early in gpio_pin_to_irq()
Related show

Commit Message

Geert Uytterhoeven Feb. 12, 2020, 9:02 a.m. UTC
As of commit 4adeabd042422cee ("pinctrl: sh-pfc: Remove hardcoded IRQ
numbers"), only a single operation needs to be performed after finding
the wanted pin.  Hence decrease the needed attention span of the casual
reader by replacing the goto by a direct return.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
To be queued in sh-pfc-for-v5.7.
---
 drivers/pinctrl/sh-pfc/gpio.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Niklas Söderlund Feb. 12, 2020, 2:59 p.m. UTC | #1
Hi Geert,

Thanks for your patch.

On 2020-02-12 10:02:00 +0100, Geert Uytterhoeven wrote:
> As of commit 4adeabd042422cee ("pinctrl: sh-pfc: Remove hardcoded IRQ
> numbers"), only a single operation needs to be performed after finding
> the wanted pin.  Hence decrease the needed attention span of the casual
> reader by replacing the goto by a direct return.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
> To be queued in sh-pfc-for-v5.7.
> ---
>  drivers/pinctrl/sh-pfc/gpio.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c
> index 8213e118aa408573..9c6e931ae766edf7 100644
> --- a/drivers/pinctrl/sh-pfc/gpio.c
> +++ b/drivers/pinctrl/sh-pfc/gpio.c
> @@ -205,14 +205,11 @@ static int gpio_pin_to_irq(struct gpio_chip *gc, unsigned offset)
>  
>  		for (k = 0; gpios[k] >= 0; k++) {
>  			if (gpios[k] == offset)
> -				goto found;
> +				return pfc->irqs[i];
>  		}
>  	}
>  
>  	return 0;
> -
> -found:
> -	return pfc->irqs[i];
>  }
>  
>  static int gpio_pin_setup(struct sh_pfc_chip *chip)
> -- 
> 2.17.1
>

Patch
diff mbox series

diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c
index 8213e118aa408573..9c6e931ae766edf7 100644
--- a/drivers/pinctrl/sh-pfc/gpio.c
+++ b/drivers/pinctrl/sh-pfc/gpio.c
@@ -205,14 +205,11 @@  static int gpio_pin_to_irq(struct gpio_chip *gc, unsigned offset)
 
 		for (k = 0; gpios[k] >= 0; k++) {
 			if (gpios[k] == offset)
-				goto found;
+				return pfc->irqs[i];
 		}
 	}
 
 	return 0;
-
-found:
-	return pfc->irqs[i];
 }
 
 static int gpio_pin_setup(struct sh_pfc_chip *chip)