linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: sh-pfc: Use dev_notice_once() instead of open-coding
@ 2019-07-31 13:24 Geert Uytterhoeven
  2019-07-31 13:26 ` Ulrich Hecht
  2019-07-31 18:31 ` Niklas Söderlund
  0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2019-07-31 13:24 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-renesas-soc, linux-gpio, Geert Uytterhoeven

At the time of commit 9a643c9a11259955 ("sh-pfc: Convert message
printing from pr_* to dev_*"), the dev_*_once() variants didn't exist
yet, so the once behavior was open-coded.

Since commit e135303bd5bebcd2 ("device: Add dev_<level>_once variants")
they do, so "revert" to the good practice of using a helper.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
To be queued in sh-pfc-for-v5.4.

 drivers/pinctrl/sh-pfc/gpio.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c
index 97c1332c1045739a..64c09aa374ae011f 100644
--- a/drivers/pinctrl/sh-pfc/gpio.c
+++ b/drivers/pinctrl/sh-pfc/gpio.c
@@ -255,18 +255,13 @@ static int gpio_pin_setup(struct sh_pfc_chip *chip)
 #ifdef CONFIG_PINCTRL_SH_FUNC_GPIO
 static int gpio_function_request(struct gpio_chip *gc, unsigned offset)
 {
-	static bool __print_once;
 	struct sh_pfc *pfc = gpio_to_pfc(gc);
 	unsigned int mark = pfc->info->func_gpios[offset].enum_id;
 	unsigned long flags;
 	int ret;
 
-	if (!__print_once) {
-		dev_notice(pfc->dev,
-			   "Use of GPIO API for function requests is deprecated."
-			   " Convert to pinctrl\n");
-		__print_once = true;
-	}
+	dev_notice_once(pfc->dev,
+			"Use of GPIO API for function requests is deprecated, convert to pinctrl\n");
 
 	if (mark == 0)
 		return -EINVAL;
-- 
2.17.1


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

* Re: [PATCH] pinctrl: sh-pfc: Use dev_notice_once() instead of open-coding
  2019-07-31 13:24 [PATCH] pinctrl: sh-pfc: Use dev_notice_once() instead of open-coding Geert Uytterhoeven
@ 2019-07-31 13:26 ` Ulrich Hecht
  2019-07-31 18:31 ` Niklas Söderlund
  1 sibling, 0 replies; 3+ messages in thread
From: Ulrich Hecht @ 2019-07-31 13:26 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Walleij; +Cc: linux-renesas-soc, linux-gpio


> On July 31, 2019 at 3:24 PM Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> 
> 
> At the time of commit 9a643c9a11259955 ("sh-pfc: Convert message
> printing from pr_* to dev_*"), the dev_*_once() variants didn't exist
> yet, so the once behavior was open-coded.
> 
> Since commit e135303bd5bebcd2 ("device: Add dev_<level>_once variants")
> they do, so "revert" to the good practice of using a helper.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> To be queued in sh-pfc-for-v5.4.
> 
>  drivers/pinctrl/sh-pfc/gpio.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c
> index 97c1332c1045739a..64c09aa374ae011f 100644
> --- a/drivers/pinctrl/sh-pfc/gpio.c
> +++ b/drivers/pinctrl/sh-pfc/gpio.c
> @@ -255,18 +255,13 @@ static int gpio_pin_setup(struct sh_pfc_chip *chip)
>  #ifdef CONFIG_PINCTRL_SH_FUNC_GPIO
>  static int gpio_function_request(struct gpio_chip *gc, unsigned offset)
>  {
> -	static bool __print_once;
>  	struct sh_pfc *pfc = gpio_to_pfc(gc);
>  	unsigned int mark = pfc->info->func_gpios[offset].enum_id;
>  	unsigned long flags;
>  	int ret;
>  
> -	if (!__print_once) {
> -		dev_notice(pfc->dev,
> -			   "Use of GPIO API for function requests is deprecated."
> -			   " Convert to pinctrl\n");
> -		__print_once = true;
> -	}
> +	dev_notice_once(pfc->dev,
> +			"Use of GPIO API for function requests is deprecated, convert to pinctrl\n");
>  
>  	if (mark == 0)
>  		return -EINVAL;
> -- 
> 2.17.1

Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>

CU
Uli

>

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

* Re: [PATCH] pinctrl: sh-pfc: Use dev_notice_once() instead of open-coding
  2019-07-31 13:24 [PATCH] pinctrl: sh-pfc: Use dev_notice_once() instead of open-coding Geert Uytterhoeven
  2019-07-31 13:26 ` Ulrich Hecht
@ 2019-07-31 18:31 ` Niklas Söderlund
  1 sibling, 0 replies; 3+ messages in thread
From: Niklas Söderlund @ 2019-07-31 18:31 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linus Walleij, linux-renesas-soc, linux-gpio

Hi Geert,

Thanks for your work.

On 2019-07-31 15:24:06 +0200, Geert Uytterhoeven wrote:
> At the time of commit 9a643c9a11259955 ("sh-pfc: Convert message
> printing from pr_* to dev_*"), the dev_*_once() variants didn't exist
> yet, so the once behavior was open-coded.
> 
> Since commit e135303bd5bebcd2 ("device: Add dev_<level>_once variants")
> they do, so "revert" to the good practice of using a helper.
> 
> 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.4.
> 
>  drivers/pinctrl/sh-pfc/gpio.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c
> index 97c1332c1045739a..64c09aa374ae011f 100644
> --- a/drivers/pinctrl/sh-pfc/gpio.c
> +++ b/drivers/pinctrl/sh-pfc/gpio.c
> @@ -255,18 +255,13 @@ static int gpio_pin_setup(struct sh_pfc_chip *chip)
>  #ifdef CONFIG_PINCTRL_SH_FUNC_GPIO
>  static int gpio_function_request(struct gpio_chip *gc, unsigned offset)
>  {
> -	static bool __print_once;
>  	struct sh_pfc *pfc = gpio_to_pfc(gc);
>  	unsigned int mark = pfc->info->func_gpios[offset].enum_id;
>  	unsigned long flags;
>  	int ret;
>  
> -	if (!__print_once) {
> -		dev_notice(pfc->dev,
> -			   "Use of GPIO API for function requests is deprecated."
> -			   " Convert to pinctrl\n");
> -		__print_once = true;
> -	}
> +	dev_notice_once(pfc->dev,
> +			"Use of GPIO API for function requests is deprecated, convert to pinctrl\n");
>  
>  	if (mark == 0)
>  		return -EINVAL;
> -- 
> 2.17.1
> 

-- 
Regards,
Niklas Söderlund

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

end of thread, other threads:[~2019-07-31 18:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-31 13:24 [PATCH] pinctrl: sh-pfc: Use dev_notice_once() instead of open-coding Geert Uytterhoeven
2019-07-31 13:26 ` Ulrich Hecht
2019-07-31 18:31 ` Niklas Söderlund

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