public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1] iio: magnetometer: ak8974: Silence deferred-probe error
Date: Wed, 15 Apr 2020 01:27:13 +0300	[thread overview]
Message-ID: <20200414222713.32660-1-digetx@gmail.com> (raw)

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@gmail.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",
+			   ret);
 		return ret;
 	}
 
-- 
2.26.0


             reply	other threads:[~2020-04-14 22:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14 22:27 Dmitry Osipenko [this message]
2020-04-16 11:33 ` [PATCH v1] iio: magnetometer: ak8974: Silence deferred-probe error Linus Walleij
2020-04-16 14:45   ` Dmitry Osipenko
2020-04-16 16:51     ` Linus Walleij
2020-04-16 17:35       ` Dmitry Osipenko
2020-04-18 14:37         ` Jonathan Cameron
2020-04-18 14:49           ` Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200414222713.32660-1-digetx@gmail.com \
    --to=digetx@gmail.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox