linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: dwapb: Don't print error on -EPROBE_DEFER
@ 2022-06-10  7:51 Serge Semin
  2022-06-10  9:53 ` Serge Semin
  2022-06-10 10:45 ` [PATCH v2] " Serge Semin
  0 siblings, 2 replies; 6+ messages in thread
From: Serge Semin @ 2022-06-10  7:51 UTC (permalink / raw)
  To: Hoan Tran, Serge Semin, Linus Walleij, Bartosz Golaszewski
  Cc: Serge Semin, Alexey Malahov, Pavel Parkhomenko, Andy Shevchenko,
	Andy Shevchenko, linux-gpio, linux-kernel

Currently if the APB or Debounce clocks aren't yet ready to be requested
the DW GPIO driver will correctly handle that by deferring the probe
procedure, but the error is still printed to the system log. It needlessly
pollutes the log since there was no real error but a request to postpone
the clock request procedure since the clocks subsystem hasn't been fully
initialized yet. Let's fix that by using the dev_err_probe method to print
the APB/clock request error status. It will correctly handle the deferred
probe situation and print the error if it actually happens.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
---
 drivers/gpio/gpio-dwapb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index b0f3aca61974..a51458be34a9 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -653,7 +653,7 @@ static int dwapb_get_clks(struct dwapb_gpio *gpio)
 	err = devm_clk_bulk_get_optional(gpio->dev, DWAPB_NR_CLOCKS,
 					 gpio->clks);
 	if (err) {
-		dev_err(gpio->dev, "Cannot get APB/Debounce clocks\n");
+		dev_err_probe(gpio->dev, err, "Cannot get APB/Debounce clocks\n");
 		return err;
 	}
 
-- 
2.35.1


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

* Re: [PATCH] gpio: dwapb: Don't print error on -EPROBE_DEFER
  2022-06-10  7:51 [PATCH] gpio: dwapb: Don't print error on -EPROBE_DEFER Serge Semin
@ 2022-06-10  9:53 ` Serge Semin
  2022-06-10 10:45 ` [PATCH v2] " Serge Semin
  1 sibling, 0 replies; 6+ messages in thread
From: Serge Semin @ 2022-06-10  9:53 UTC (permalink / raw)
  To: Serge Semin
  Cc: Philipp Zabel, Hoan Tran, Linus Walleij, Bartosz Golaszewski,
	Alexey Malahov, Pavel Parkhomenko, Andy Shevchenko,
	Andy Shevchenko, linux-gpio, linux-kernel

On Fri, Jun 10, 2022 at 10:51:52AM +0300, Serge Semin wrote:
> Currently if the APB or Debounce clocks aren't yet ready to be requested
> the DW GPIO driver will correctly handle that by deferring the probe
> procedure, but the error is still printed to the system log. It needlessly
> pollutes the log since there was no real error but a request to postpone
> the clock request procedure since the clocks subsystem hasn't been fully
> initialized yet. Let's fix that by using the dev_err_probe method to print
> the APB/clock request error status. It will correctly handle the deferred
> probe situation and print the error if it actually happens.
> 
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> ---
>  drivers/gpio/gpio-dwapb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index b0f3aca61974..a51458be34a9 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -653,7 +653,7 @@ static int dwapb_get_clks(struct dwapb_gpio *gpio)
>  	err = devm_clk_bulk_get_optional(gpio->dev, DWAPB_NR_CLOCKS,
>  					 gpio->clks);
>  	if (err) {

> -		dev_err(gpio->dev, "Cannot get APB/Debounce clocks\n");
> +		dev_err_probe(gpio->dev, err, "Cannot get APB/Debounce clocks\n");

As Philipp correctly pointed out here:
https://lore.kernel.org/lkml/20220610080103.10689-1-Sergey.Semin@baikalelectronics.ru/
This can be shortened out by directly returning a value returned by
the dev_err_probe() method. I'll fix that in v2.

-Sergey

>  		return err;
>  	}
>  
> -- 
> 2.35.1
> 

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

* [PATCH v2] gpio: dwapb: Don't print error on -EPROBE_DEFER
  2022-06-10  7:51 [PATCH] gpio: dwapb: Don't print error on -EPROBE_DEFER Serge Semin
  2022-06-10  9:53 ` Serge Semin
@ 2022-06-10 10:45 ` Serge Semin
  2022-06-10 11:13   ` Andy Shevchenko
  2022-06-10 12:26   ` Bartosz Golaszewski
  1 sibling, 2 replies; 6+ messages in thread
From: Serge Semin @ 2022-06-10 10:45 UTC (permalink / raw)
  To: Hoan Tran, Serge Semin, Linus Walleij, Bartosz Golaszewski
  Cc: Serge Semin, Alexey Malahov, Pavel Parkhomenko, Andy Shevchenko,
	Andy Shevchenko, Philipp Zabel, linux-gpio, linux-kernel

Currently if the APB or Debounce clocks aren't yet ready to be requested
the DW GPIO driver will correctly handle that by deferring the probe
procedure, but the error is still printed to the system log. It needlessly
pollutes the log since there was no real error but a request to postpone
the clock request procedure since the clocks subsystem hasn't been fully
initialized yet. Let's fix that by using the dev_err_probe method to print
the APB/clock request error status. It will correctly handle the deferred
probe situation and print the error if it actually happens.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>

---

Link: https://lore.kernel.org/linux-gpio/20220610075152.10214-1-Sergey.Semin@baikalelectronics.ru/
Changelog v2:
- Use the dev_err_probe() return value as the return status of the
  corresponding method. (@Philipp Zabel)
---
 drivers/gpio/gpio-dwapb.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index b0f3aca61974..9467d695a33e 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -652,10 +652,9 @@ static int dwapb_get_clks(struct dwapb_gpio *gpio)
 	gpio->clks[1].id = "db";
 	err = devm_clk_bulk_get_optional(gpio->dev, DWAPB_NR_CLOCKS,
 					 gpio->clks);
-	if (err) {
-		dev_err(gpio->dev, "Cannot get APB/Debounce clocks\n");
-		return err;
-	}
+	if (err)
+		return dev_err_probe(gpio->dev, err,
+				     "Cannot get APB/Debounce clocks\n");
 
 	err = clk_bulk_prepare_enable(DWAPB_NR_CLOCKS, gpio->clks);
 	if (err) {
-- 
2.35.1


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

* Re: [PATCH v2] gpio: dwapb: Don't print error on -EPROBE_DEFER
  2022-06-10 10:45 ` [PATCH v2] " Serge Semin
@ 2022-06-10 11:13   ` Andy Shevchenko
  2022-06-10 20:54     ` Serge Semin
  2022-06-10 12:26   ` Bartosz Golaszewski
  1 sibling, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2022-06-10 11:13 UTC (permalink / raw)
  To: Serge Semin
  Cc: Hoan Tran, Serge Semin, Linus Walleij, Bartosz Golaszewski,
	Alexey Malahov, Pavel Parkhomenko, Philipp Zabel, linux-gpio,
	linux-kernel

On Fri, Jun 10, 2022 at 01:45:00PM +0300, Serge Semin wrote:
> Currently if the APB or Debounce clocks aren't yet ready to be requested
> the DW GPIO driver will correctly handle that by deferring the probe
> procedure, but the error is still printed to the system log. It needlessly
> pollutes the log since there was no real error but a request to postpone
> the clock request procedure since the clocks subsystem hasn't been fully
> initialized yet. Let's fix that by using the dev_err_probe method to print
> the APB/clock request error status. It will correctly handle the deferred
> probe situation and print the error if it actually happens.
> 
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>

With or without below nit-pick
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> ---
> 
> Link: https://lore.kernel.org/linux-gpio/20220610075152.10214-1-Sergey.Semin@baikalelectronics.ru/
> Changelog v2:
> - Use the dev_err_probe() return value as the return status of the
>   corresponding method. (@Philipp Zabel)
> ---
>  drivers/gpio/gpio-dwapb.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index b0f3aca61974..9467d695a33e 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -652,10 +652,9 @@ static int dwapb_get_clks(struct dwapb_gpio *gpio)
>  	gpio->clks[1].id = "db";
>  	err = devm_clk_bulk_get_optional(gpio->dev, DWAPB_NR_CLOCKS,
>  					 gpio->clks);
> -	if (err) {
> -		dev_err(gpio->dev, "Cannot get APB/Debounce clocks\n");
> -		return err;
> -	}
> +	if (err)
> +		return dev_err_probe(gpio->dev, err,
> +				     "Cannot get APB/Debounce clocks\n");

I would leave it on one line, checkpatch wouldn't complain even before 100
characters era.

>  
>  	err = clk_bulk_prepare_enable(DWAPB_NR_CLOCKS, gpio->clks);
>  	if (err) {
> -- 
> 2.35.1
> 

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2] gpio: dwapb: Don't print error on -EPROBE_DEFER
  2022-06-10 10:45 ` [PATCH v2] " Serge Semin
  2022-06-10 11:13   ` Andy Shevchenko
@ 2022-06-10 12:26   ` Bartosz Golaszewski
  1 sibling, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2022-06-10 12:26 UTC (permalink / raw)
  To: Serge Semin
  Cc: Hoan Tran, Serge Semin, Linus Walleij, Alexey Malahov,
	Pavel Parkhomenko, Andy Shevchenko, Andy Shevchenko,
	Philipp Zabel, open list:GPIO SUBSYSTEM,
	Linux Kernel Mailing List

On Fri, Jun 10, 2022 at 12:45 PM Serge Semin
<Sergey.Semin@baikalelectronics.ru> wrote:
>
> Currently if the APB or Debounce clocks aren't yet ready to be requested
> the DW GPIO driver will correctly handle that by deferring the probe
> procedure, but the error is still printed to the system log. It needlessly
> pollutes the log since there was no real error but a request to postpone
> the clock request procedure since the clocks subsystem hasn't been fully
> initialized yet. Let's fix that by using the dev_err_probe method to print
> the APB/clock request error status. It will correctly handle the deferred
> probe situation and print the error if it actually happens.
>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
>
> ---
>
> Link: https://lore.kernel.org/linux-gpio/20220610075152.10214-1-Sergey.Semin@baikalelectronics.ru/
> Changelog v2:
> - Use the dev_err_probe() return value as the return status of the
>   corresponding method. (@Philipp Zabel)
> ---
>  drivers/gpio/gpio-dwapb.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index b0f3aca61974..9467d695a33e 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -652,10 +652,9 @@ static int dwapb_get_clks(struct dwapb_gpio *gpio)
>         gpio->clks[1].id = "db";
>         err = devm_clk_bulk_get_optional(gpio->dev, DWAPB_NR_CLOCKS,
>                                          gpio->clks);
> -       if (err) {
> -               dev_err(gpio->dev, "Cannot get APB/Debounce clocks\n");
> -               return err;
> -       }
> +       if (err)
> +               return dev_err_probe(gpio->dev, err,
> +                                    "Cannot get APB/Debounce clocks\n");
>
>         err = clk_bulk_prepare_enable(DWAPB_NR_CLOCKS, gpio->clks);
>         if (err) {
> --
> 2.35.1
>

Applied, thanks!

Bart

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

* Re: [PATCH v2] gpio: dwapb: Don't print error on -EPROBE_DEFER
  2022-06-10 11:13   ` Andy Shevchenko
@ 2022-06-10 20:54     ` Serge Semin
  0 siblings, 0 replies; 6+ messages in thread
From: Serge Semin @ 2022-06-10 20:54 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Serge Semin, Hoan Tran, Linus Walleij, Bartosz Golaszewski,
	Alexey Malahov, Pavel Parkhomenko, Philipp Zabel, linux-gpio,
	linux-kernel

On Fri, Jun 10, 2022 at 02:13:51PM +0300, Andy Shevchenko wrote:
> On Fri, Jun 10, 2022 at 01:45:00PM +0300, Serge Semin wrote:
> > Currently if the APB or Debounce clocks aren't yet ready to be requested
> > the DW GPIO driver will correctly handle that by deferring the probe
> > procedure, but the error is still printed to the system log. It needlessly
> > pollutes the log since there was no real error but a request to postpone
> > the clock request procedure since the clocks subsystem hasn't been fully
> > initialized yet. Let's fix that by using the dev_err_probe method to print
> > the APB/clock request error status. It will correctly handle the deferred
> > probe situation and print the error if it actually happens.
> > 
> > Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> 

> With or without below nit-pick
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Thanks.

> 
> > ---
> > 
> > Link: https://lore.kernel.org/linux-gpio/20220610075152.10214-1-Sergey.Semin@baikalelectronics.ru/
> > Changelog v2:
> > - Use the dev_err_probe() return value as the return status of the
> >   corresponding method. (@Philipp Zabel)
> > ---
> >  drivers/gpio/gpio-dwapb.c | 7 +++----
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> > index b0f3aca61974..9467d695a33e 100644
> > --- a/drivers/gpio/gpio-dwapb.c
> > +++ b/drivers/gpio/gpio-dwapb.c
> > @@ -652,10 +652,9 @@ static int dwapb_get_clks(struct dwapb_gpio *gpio)
> >  	gpio->clks[1].id = "db";
> >  	err = devm_clk_bulk_get_optional(gpio->dev, DWAPB_NR_CLOCKS,
> >  					 gpio->clks);
> > -	if (err) {
> > -		dev_err(gpio->dev, "Cannot get APB/Debounce clocks\n");
> > -		return err;
> > -	}
> > +	if (err)
> > +		return dev_err_probe(gpio->dev, err,
> > +				     "Cannot get APB/Debounce clocks\n");
>
 
> I would leave it on one line, checkpatch wouldn't complain even before 100
> characters era.

You are right, checkpatch won't complain but the 80-chars limit is
still preferred. In this case we can fulfill that requirement without
harm to the code readability.

-Sergey

> 
> >  
> >  	err = clk_bulk_prepare_enable(DWAPB_NR_CLOCKS, gpio->clks);
> >  	if (err) {
> > -- 
> > 2.35.1
> > 
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

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

end of thread, other threads:[~2022-06-10 20:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10  7:51 [PATCH] gpio: dwapb: Don't print error on -EPROBE_DEFER Serge Semin
2022-06-10  9:53 ` Serge Semin
2022-06-10 10:45 ` [PATCH v2] " Serge Semin
2022-06-10 11:13   ` Andy Shevchenko
2022-06-10 20:54     ` Serge Semin
2022-06-10 12:26   ` Bartosz Golaszewski

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