Linux-Renesas-SoC Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] pinctrl: sh-pfc: gpio: Return early in gpio_pin_to_irq()
@ 2020-02-12  9:02 Geert Uytterhoeven
  2020-02-12 14:59 ` Niklas Söderlund
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2020-02-12  9:02 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-renesas-soc, linux-gpio, Geert Uytterhoeven

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(-)

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


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

* Re: [PATCH] pinctrl: sh-pfc: gpio: Return early in gpio_pin_to_irq()
  2020-02-12  9:02 [PATCH] pinctrl: sh-pfc: gpio: Return early in gpio_pin_to_irq() Geert Uytterhoeven
@ 2020-02-12 14:59 ` Niklas Söderlund
  0 siblings, 0 replies; 2+ messages in thread
From: Niklas Söderlund @ 2020-02-12 14:59 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linus Walleij, linux-renesas-soc, linux-gpio

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
> 

-- 
Regards,
Niklas Söderlund

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-12  9:02 [PATCH] pinctrl: sh-pfc: gpio: Return early in gpio_pin_to_irq() Geert Uytterhoeven
2020-02-12 14:59 ` Niklas Söderlund

Linux-Renesas-SoC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-renesas-soc/0 linux-renesas-soc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-renesas-soc linux-renesas-soc/ https://lore.kernel.org/linux-renesas-soc \
		linux-renesas-soc@vger.kernel.org
	public-inbox-index linux-renesas-soc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-renesas-soc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git