linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpiolib: do not print err message for EPROBE_DEFER
@ 2020-11-18 14:29 Grygorii Strashko
  2020-12-01 17:16 ` Grygorii Strashko
  0 siblings, 1 reply; 3+ messages in thread
From: Grygorii Strashko @ 2020-11-18 14:29 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: linux-gpio, linux-kernel, Grygorii Strashko

The gpiochip may have dependencies from pinmux and so got deferred. Now it
will print error message every time -EPROBE_DEFER is returned which is
unnecessary:

"gpiochip_add_data_with_key: GPIOs 0..31 (gpio-0-31) failed to register, -517"

Hence, do suppress error message for -EPROBE_DEFER case.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 drivers/gpio/gpiolib.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 089ddcaa9bc6..fd2c503a6aab 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -771,9 +771,11 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
 	ida_free(&gpio_ida, gdev->id);
 err_free_gdev:
 	/* failures here can mean systems won't boot... */
-	pr_err("%s: GPIOs %d..%d (%s) failed to register, %d\n", __func__,
-	       gdev->base, gdev->base + gdev->ngpio - 1,
-	       gc->label ? : "generic", ret);
+	if (ret != -EPROBE_DEFER) {
+		pr_err("%s: GPIOs %d..%d (%s) failed to register, %d\n", __func__,
+		       gdev->base, gdev->base + gdev->ngpio - 1,
+		       gc->label ? : "generic", ret);
+	}
 	kfree(gdev);
 	return ret;
 }
-- 
2.17.1


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

* Re: [PATCH] gpiolib: do not print err message for EPROBE_DEFER
  2020-11-18 14:29 [PATCH] gpiolib: do not print err message for EPROBE_DEFER Grygorii Strashko
@ 2020-12-01 17:16 ` Grygorii Strashko
  2020-12-01 18:03   ` Bartosz Golaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Grygorii Strashko @ 2020-12-01 17:16 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski; +Cc: linux-gpio, linux-kernel

hi Bartosz, All,

On 18/11/2020 16:29, Grygorii Strashko wrote:
> The gpiochip may have dependencies from pinmux and so got deferred. Now it
> will print error message every time -EPROBE_DEFER is returned which is
> unnecessary:
> 
> "gpiochip_add_data_with_key: GPIOs 0..31 (gpio-0-31) failed to register, -517"
> 
> Hence, do suppress error message for -EPROBE_DEFER case.
> 
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> ---
>   drivers/gpio/gpiolib.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 089ddcaa9bc6..fd2c503a6aab 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -771,9 +771,11 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
>   	ida_free(&gpio_ida, gdev->id);
>   err_free_gdev:
>   	/* failures here can mean systems won't boot... */
> -	pr_err("%s: GPIOs %d..%d (%s) failed to register, %d\n", __func__,
> -	       gdev->base, gdev->base + gdev->ngpio - 1,
> -	       gc->label ? : "generic", ret);
> +	if (ret != -EPROBE_DEFER) {
> +		pr_err("%s: GPIOs %d..%d (%s) failed to register, %d\n", __func__,
> +		       gdev->base, gdev->base + gdev->ngpio - 1,
> +		       gc->label ? : "generic", ret);
> +	}
>   	kfree(gdev);
>   	return ret;
>   }
> 

Any comments for this patch?

Note. Modern dev_err_probe() seems can't be used as gpio_chip->parent is not guaranteed to be set and
it's not clear if chip_err() still can be used at this stage.

-- 
Best regards,
grygorii

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

* Re: [PATCH] gpiolib: do not print err message for EPROBE_DEFER
  2020-12-01 17:16 ` Grygorii Strashko
@ 2020-12-01 18:03   ` Bartosz Golaszewski
  0 siblings, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2020-12-01 18:03 UTC (permalink / raw)
  To: Grygorii Strashko; +Cc: Linus Walleij, linux-gpio, LKML

On Tue, Dec 1, 2020 at 6:16 PM Grygorii Strashko
<grygorii.strashko@ti.com> wrote:
>
> hi Bartosz, All,
>
> On 18/11/2020 16:29, Grygorii Strashko wrote:
> > The gpiochip may have dependencies from pinmux and so got deferred. Now it
> > will print error message every time -EPROBE_DEFER is returned which is
> > unnecessary:
> >
> > "gpiochip_add_data_with_key: GPIOs 0..31 (gpio-0-31) failed to register, -517"
> >
> > Hence, do suppress error message for -EPROBE_DEFER case.
> >
> > Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> > ---
> >   drivers/gpio/gpiolib.c | 8 +++++---
> >   1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> > index 089ddcaa9bc6..fd2c503a6aab 100644
> > --- a/drivers/gpio/gpiolib.c
> > +++ b/drivers/gpio/gpiolib.c
> > @@ -771,9 +771,11 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
> >       ida_free(&gpio_ida, gdev->id);
> >   err_free_gdev:
> >       /* failures here can mean systems won't boot... */
> > -     pr_err("%s: GPIOs %d..%d (%s) failed to register, %d\n", __func__,
> > -            gdev->base, gdev->base + gdev->ngpio - 1,
> > -            gc->label ? : "generic", ret);
> > +     if (ret != -EPROBE_DEFER) {
> > +             pr_err("%s: GPIOs %d..%d (%s) failed to register, %d\n", __func__,
> > +                    gdev->base, gdev->base + gdev->ngpio - 1,
> > +                    gc->label ? : "generic", ret);
> > +     }
> >       kfree(gdev);
> >       return ret;
> >   }
> >
>
> Any comments for this patch?
>
> Note. Modern dev_err_probe() seems can't be used as gpio_chip->parent is not guaranteed to be set and
> it's not clear if chip_err() still can be used at this stage.
>
> --
> Best regards,
> grygorii

I applied this patch now. We seem to have a patch congestion on the
list - I'm trying to get through unread email but more is coming
everyday. :(

Bartosz

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

end of thread, other threads:[~2020-12-01 18:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 14:29 [PATCH] gpiolib: do not print err message for EPROBE_DEFER Grygorii Strashko
2020-12-01 17:16 ` Grygorii Strashko
2020-12-01 18:03   ` 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).