public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] iio: magnetometer: ak8974: Silence deferred-probe error
@ 2020-04-17 16:22 Dmitry Osipenko
  2020-04-17 20:49 ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Osipenko @ 2020-04-17 16:22 UTC (permalink / raw)
  To: Linus Walleij, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler
  Cc: linux-iio, linux-kernel

It's not uncommon that voltage regulator becomes available later during
kernel's boot process. This patch adds info message about unavailable
regulators in a case of the deferred-probe error and also amends the
error message with a error code.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---

Changelog:

v2: - Replaced dev_printk() with dev_info() for the deferred-probe error,
      as was requested by Linus Walleij in a review comment to v1.

 drivers/iio/magnetometer/ak8974.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
index d32996702110..ae1dc478fc02 100644
--- a/drivers/iio/magnetometer/ak8974.c
+++ b/drivers/iio/magnetometer/ak8974.c
@@ -746,7 +746,12 @@ static int ak8974_probe(struct i2c_client *i2c,
 				      ARRAY_SIZE(ak8974->regs),
 				      ak8974->regs);
 	if (ret < 0) {
-		dev_err(&i2c->dev, "cannot get regulators\n");
+		if (ret == -EPROBE_DEFER)
+			dev_info(&i2c->dev,
+				 "regulators unavailable, deferring probe\n");
+		else
+			dev_err(&i2c->dev, "cannot get regulators: %d\n", ret);
+
 		return ret;
 	}
 
-- 
2.26.0


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

* Re: [PATCH v2] iio: magnetometer: ak8974: Silence deferred-probe error
  2020-04-17 16:22 [PATCH v2] iio: magnetometer: ak8974: Silence deferred-probe error Dmitry Osipenko
@ 2020-04-17 20:49 ` Andy Shevchenko
  2020-04-17 20:50   ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2020-04-17 20:49 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Linus Walleij, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio,
	Linux Kernel Mailing List

On Fri, Apr 17, 2020 at 7:24 PM Dmitry Osipenko <digetx@gmail.com> wrote:
>
> It's not uncommon that voltage regulator becomes available later during
> kernel's boot process. This patch adds info message about unavailable
> regulators in a case of the deferred-probe error and also amends the
> error message with a error code.


> +               if (ret == -EPROBE_DEFER)

> +                       dev_info(&i2c->dev,
> +                                "regulators unavailable, deferring probe\n");

I dunno why you think it is worth to spam log with this?
This message will be printed as many times as driver got deferred
probe cycle (maybe dozens in worst case).

> +               else
> +                       dev_err(&i2c->dev, "cannot get regulators: %d\n", ret);
> +
>                 return ret;
>         }
>
> --
> 2.26.0
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2] iio: magnetometer: ak8974: Silence deferred-probe error
  2020-04-17 20:49 ` Andy Shevchenko
@ 2020-04-17 20:50   ` Andy Shevchenko
  2020-04-18 14:26     ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2020-04-17 20:50 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Linus Walleij, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio,
	Linux Kernel Mailing List

On Fri, Apr 17, 2020 at 11:49 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Fri, Apr 17, 2020 at 7:24 PM Dmitry Osipenko <digetx@gmail.com> wrote:
> >
> > It's not uncommon that voltage regulator becomes available later during
> > kernel's boot process. This patch adds info message about unavailable
> > regulators in a case of the deferred-probe error and also amends the
> > error message with a error code.
>
>
> > +               if (ret == -EPROBE_DEFER)
>
> > +                       dev_info(&i2c->dev,
> > +                                "regulators unavailable, deferring probe\n");
>
> I dunno why you think it is worth to spam log with this?
> This message will be printed as many times as driver got deferred
> probe cycle (maybe dozens in worst case).

As you may see in other drivers we usually have the opposite check and
print error message in case of != EPROBE_DEFER.


>
> > +               else
> > +                       dev_err(&i2c->dev, "cannot get regulators: %d\n", ret);

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2] iio: magnetometer: ak8974: Silence deferred-probe error
  2020-04-17 20:50   ` Andy Shevchenko
@ 2020-04-18 14:26     ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2020-04-18 14:26 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Dmitry Osipenko, Linus Walleij, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio,
	Linux Kernel Mailing List

On Fri, 17 Apr 2020 23:50:37 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Fri, Apr 17, 2020 at 11:49 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Fri, Apr 17, 2020 at 7:24 PM Dmitry Osipenko <digetx@gmail.com> wrote:  
> > >
> > > It's not uncommon that voltage regulator becomes available later during
> > > kernel's boot process. This patch adds info message about unavailable
> > > regulators in a case of the deferred-probe error and also amends the
> > > error message with a error code.  
> >
> >  
> > > +               if (ret == -EPROBE_DEFER)  
> >  
> > > +                       dev_info(&i2c->dev,
> > > +                                "regulators unavailable, deferring probe\n");  
> >
> > I dunno why you think it is worth to spam log with this?
> > This message will be printed as many times as driver got deferred
> > probe cycle (maybe dozens in worst case).  
> 
> As you may see in other drivers we usually have the opposite check and
> print error message in case of != EPROBE_DEFER.

Definitely is not a good idea to print an info message for deferred.
A debug message maybe but probably not even that.

Jonathan

> 
> 
> >  
> > > +               else
> > > +                       dev_err(&i2c->dev, "cannot get regulators: %d\n", ret);  
> 


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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-17 16:22 [PATCH v2] iio: magnetometer: ak8974: Silence deferred-probe error Dmitry Osipenko
2020-04-17 20:49 ` Andy Shevchenko
2020-04-17 20:50   ` Andy Shevchenko
2020-04-18 14:26     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox