linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] pinctrl: rza1: remove unnecerssary static inline function
@ 2019-11-12 14:17 Matti Vaittinen
  2019-11-12 18:17 ` Geert Uytterhoeven
  2019-11-13  8:55 ` Jacopo Mondi
  0 siblings, 2 replies; 3+ messages in thread
From: Matti Vaittinen @ 2019-11-12 14:17 UTC (permalink / raw)
  To: matti.vaittinen, mazziesaccount
  Cc: Geert Uytterhoeven, Linus Walleij, Matthias Brugger,
	linux-renesas-soc, linux-gpio, linux-kernel, linux-arm-kernel,
	linux-mediatek

Having static inline oneliner does not benefit too much when it is
only called from another oneliner function. Remove some of the
'onion'. This simplifies also the coming usage of the gpiolib
defines. We can do conversion from chip bits to gpiolib direction
defines as last step in the get_direction callback. Drivers can
use chip specific values in driver internal functions and do
conversion only once.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
---
 drivers/pinctrl/pinctrl-rza1.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rza1.c b/drivers/pinctrl/pinctrl-rza1.c
index 017fc6b3e27e..215db220d795 100644
--- a/drivers/pinctrl/pinctrl-rza1.c
+++ b/drivers/pinctrl/pinctrl-rza1.c
@@ -617,12 +617,6 @@ static void rza1_pin_reset(struct rza1_port *port, unsigned int pin)
 	spin_unlock_irqrestore(&port->lock, irqflags);
 }
 
-static inline int rza1_pin_get_direction(struct rza1_port *port,
-					 unsigned int pin)
-{
-	return !!rza1_get_bit(port, RZA1_PM_REG, pin);
-}
-
 /**
  * rza1_pin_set_direction() - set I/O direction on a pin in port mode
  *
@@ -783,7 +777,7 @@ static int rza1_gpio_get_direction(struct gpio_chip *chip, unsigned int gpio)
 {
 	struct rza1_port *port = gpiochip_get_data(chip);
 
-	return rza1_pin_get_direction(port, gpio);
+	return !!rza1_get_bit(port, RZA1_PM_REG, gpio);
 }
 
 static int rza1_gpio_direction_input(struct gpio_chip *chip,

base-commit: 70d97e099bb426ecb3ad4bf31e88dbf2ef4b2e4c
-- 
2.21.0


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =] 

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

* Re: [PATCH 1/2] pinctrl: rza1: remove unnecerssary static inline function
  2019-11-12 14:17 [PATCH 1/2] pinctrl: rza1: remove unnecerssary static inline function Matti Vaittinen
@ 2019-11-12 18:17 ` Geert Uytterhoeven
  2019-11-13  8:55 ` Jacopo Mondi
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2019-11-12 18:17 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Matti Vaittinen, Geert Uytterhoeven, Linus Walleij,
	Matthias Brugger, Linux-Renesas, open list:GPIO SUBSYSTEM,
	Linux Kernel Mailing List, Linux ARM, linux-mediatek

On Tue, Nov 12, 2019 at 3:18 PM Matti Vaittinen
<matti.vaittinen@fi.rohmeurope.com> wrote:

s/unnecerssary/unnecessary/

> Having static inline oneliner does not benefit too much when it is
> only called from another oneliner function. Remove some of the
> 'onion'. This simplifies also the coming usage of the gpiolib
> defines. We can do conversion from chip bits to gpiolib direction
> defines as last step in the get_direction callback. Drivers can
> use chip specific values in driver internal functions and do
> conversion only once.
>
> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

As this is a dependency for 2/2, which will go in through the GPIO tree:

Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 1/2] pinctrl: rza1: remove unnecerssary static inline function
  2019-11-12 14:17 [PATCH 1/2] pinctrl: rza1: remove unnecerssary static inline function Matti Vaittinen
  2019-11-12 18:17 ` Geert Uytterhoeven
@ 2019-11-13  8:55 ` Jacopo Mondi
  1 sibling, 0 replies; 3+ messages in thread
From: Jacopo Mondi @ 2019-11-13  8:55 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: mazziesaccount, Geert Uytterhoeven, Linus Walleij,
	Matthias Brugger, linux-renesas-soc, linux-gpio, linux-kernel,
	linux-arm-kernel, linux-mediatek

[-- Attachment #1: Type: text/plain, Size: 2133 bytes --]

Hi Matti,

On Tue, Nov 12, 2019 at 04:17:48PM +0200, Matti Vaittinen wrote:
> Having static inline oneliner does not benefit too much when it is
> only called from another oneliner function. Remove some of the
> 'onion'. This simplifies also the coming usage of the gpiolib
> defines. We can do conversion from chip bits to gpiolib direction
> defines as last step in the get_direction callback. Drivers can
> use chip specific values in driver internal functions and do
> conversion only once.

I assume your: "[PATCH 2/2] pinctrl: Use new GPIO_LINE_DIRECTION"
supersedes this one, am I right ?

Thanks
  j

>
> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> ---
>  drivers/pinctrl/pinctrl-rza1.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-rza1.c b/drivers/pinctrl/pinctrl-rza1.c
> index 017fc6b3e27e..215db220d795 100644
> --- a/drivers/pinctrl/pinctrl-rza1.c
> +++ b/drivers/pinctrl/pinctrl-rza1.c
> @@ -617,12 +617,6 @@ static void rza1_pin_reset(struct rza1_port *port, unsigned int pin)
>  	spin_unlock_irqrestore(&port->lock, irqflags);
>  }
>
> -static inline int rza1_pin_get_direction(struct rza1_port *port,
> -					 unsigned int pin)
> -{
> -	return !!rza1_get_bit(port, RZA1_PM_REG, pin);
> -}
> -
>  /**
>   * rza1_pin_set_direction() - set I/O direction on a pin in port mode
>   *
> @@ -783,7 +777,7 @@ static int rza1_gpio_get_direction(struct gpio_chip *chip, unsigned int gpio)
>  {
>  	struct rza1_port *port = gpiochip_get_data(chip);
>
> -	return rza1_pin_get_direction(port, gpio);
> +	return !!rza1_get_bit(port, RZA1_PM_REG, gpio);
>  }
>
>  static int rza1_gpio_direction_input(struct gpio_chip *chip,
>
> base-commit: 70d97e099bb426ecb3ad4bf31e88dbf2ef4b2e4c
> --
> 2.21.0
>
>
> --
> Matti Vaittinen, Linux device drivers
> ROHM Semiconductors, Finland SWDC
> Kiviharjunlenkki 1E
> 90220 OULU
> FINLAND
>
> ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
> Simon says - in Latin please.
> ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
> Thanks to Simon Glass for the translation =]

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-11-13  8:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 14:17 [PATCH 1/2] pinctrl: rza1: remove unnecerssary static inline function Matti Vaittinen
2019-11-12 18:17 ` Geert Uytterhoeven
2019-11-13  8:55 ` Jacopo Mondi

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