[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdY_J8e127etFFYkoxLDDkc334Xgg8ZbapdU36oGsaZ08g@mail.gmail.com>
Date: Thu, 16 Apr 2020 13:33:03 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Dmitry Osipenko <digetx@...il.com>
Cc: Jonathan Cameron <jic23@...nel.org>,
Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
linux-iio <linux-iio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1] iio: magnetometer: ak8974: Silence deferred-probe error
Hi Dmitry,
thanks for your patch!
On Wed, Apr 15, 2020 at 12:27 AM Dmitry Osipenko <digetx@...il.com> wrote:
> It's not uncommon that voltage regulator becomes available later during
> kernel's boot process, in this case there is no need to print a noisy
> error message. This patch moves the message about unavailable regulator
> to the debug level in a case of the deferred-probe error and also amends
> the message with error code.
>
> Signed-off-by: Dmitry Osipenko <digetx@...il.com>
> ---
> 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..cc3861f97d42 100644
> --- a/drivers/iio/magnetometer/ak8974.c
> +++ b/drivers/iio/magnetometer/ak8974.c
> @@ -718,6 +718,7 @@ static const struct regmap_config ak8974_regmap_config = {
> static int ak8974_probe(struct i2c_client *i2c,
> const struct i2c_device_id *id)
> {
> + const char *level = KERN_ERR;
> struct iio_dev *indio_dev;
> struct ak8974 *ak8974;
> unsigned long irq_trig;
> @@ -746,7 +747,11 @@ 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)
> + level = KERN_DEBUG;
> +
> + dev_printk(level, &i2c->dev, "cannot get regulators: %d\n",
This misses some important aspects of dev_dbg(), notably this:
#if defined(CONFIG_DYNAMIC_DEBUG)
#define dev_dbg(dev, fmt, ...) \
dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
#elif defined(DEBUG)
#define dev_dbg(dev, fmt, ...) \
dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)
#else
#define dev_dbg(dev, fmt, ...) \
({ \
if (0) \
dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
})
#endif
If DEBUG is not defined the entire dev_dbg() message is enclodes in if (0)
and compiled out of the kernel, saving space. The above does not
fulfil that.
Yours,
Linus Walleij
Powered by blists - more mailing lists