iio: magnetometer: ak8974: Silence deferred-probe error
Subsystems (2)
PATCH v2 1/1 iio: magnetometer: ak8974: Silence deferred-probe error
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.
---
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(-)
drivers/iio/magnetometer/ak8974.c +6 -1
@@ -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; }
Signature · 1 line
2.26.0
drivers/iio/magnetometer/ak8974.c static int ak8974_probe(struct i2c_client *i2c, · line 751
Quoted 11 lines · Dmitry Osipenko
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.
drivers/iio/magnetometer/ak8974.c +3
-0+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).
Quoted 9 lines
drivers/iio/magnetometer/ak8974.c +3
-1+else +dev_err (&i2c->dev,"cannot get regulators: %d\n" , ret); +return ret; } --2.26.0
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 8 lines · Andy Shevchenko
Quoted 5 lines · Dmitry Osipenko
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.
Quoted 8 lines
drivers/iio/magnetometer/ak8974.c static int ak8974_probe(struct i2c_client *i2c, · line 751
Quoted 4 lines
drivers/iio/magnetometer/ak8974.c +3
-0+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.
Quoted 3 lines
Quoted 3 lines
drivers/iio/magnetometer/ak8974.c +2
-0+else +dev_err (&i2c->dev,"cannot get regulators: %d\n" , ret);
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerQuoted 15 lines · On Fri, 17 Apr 2020 23:50:37 +0300 Andy Shevchenko <[email protected]>…
Quoted 13 lines · Andy Shevchenko
Quoted 11 lines · Dmitry Osipenko
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.
drivers/iio/magnetometer/ak8974.c +3
-0+if (ret == -EPROBE_DEFER ) +dev_info (&i2c->dev, +"regulators unavailable, deferring probe\n" );
Quoted 6 lines
Quoted 3 lines
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
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
drivers/iio/magnetometer/ak8974.c +2
-0+else +dev_err (&i2c->dev,"cannot get regulators: %d\n" , ret);