All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Gwendal Grignou <gwendal@chromium.org>,
	linux-iio@vger.kernel.org, kernel@pengutronix.de
Subject: [PATCH 2/8] iio:adc:ti-ads1015: Improve error reporting for problems during .remove()
Date: Sun, 15 May 2022 17:59:23 +0200	[thread overview]
Message-ID: <20220515155929.338656-3-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de>

Returning an error value in an i2c remove callback results in a generic
error message being emitted by the i2c core, but otherwise it doesn't
make a difference. The device goes away anyhow and the devm cleanups are
called.

So instead of triggering the generic i2c error message, emit a more
helpful message if a problem occurs and return 0 to suppress the generic
message.

This patch is a preparation for making i2c remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/iio/adc/ti-ads1015.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index 068efbce1710..f8021d99db64 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -1061,6 +1061,7 @@ static int ads1015_remove(struct i2c_client *client)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(client);
 	struct ads1015_data *data = iio_priv(indio_dev);
+	int ret;
 
 	iio_device_unregister(indio_dev);
 
@@ -1068,7 +1069,12 @@ static int ads1015_remove(struct i2c_client *client)
 	pm_runtime_set_suspended(&client->dev);
 
 	/* power down single shot mode */
-	return ads1015_set_conv_mode(data, ADS1015_SINGLESHOT);
+	ret = ads1015_set_conv_mode(data, ADS1015_SINGLESHOT);
+	if (ret)
+		dev_warn(&client->dev, "Failed to power down (%pe)\n",
+			 ERR_PTR(ret));
+
+	return 0;
 }
 
 #ifdef CONFIG_PM
-- 
2.35.1


  parent reply	other threads:[~2022-05-15 16:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-15 15:59 [PATCH 0/8] iio: Improve error reporting for problems during .remove for various i2c drivers Uwe Kleine-König
2022-05-15 15:59 ` [PATCH 1/8] iio:adc:ina2xx: Improve error reporting for problems during .remove() Uwe Kleine-König
2022-05-15 15:59 ` Uwe Kleine-König [this message]
2022-05-15 15:59 ` [PATCH 3/8] iio:chemical:atlas: " Uwe Kleine-König
2022-05-15 15:59 ` [PATCH 4/8] iio:chemical:ccs811: " Uwe Kleine-König
2022-05-15 15:59 ` [PATCH 5/8] iio:light:pa12203001: " Uwe Kleine-König
2022-05-15 15:59 ` [PATCH 6/8] iio:light:us5182d: " Uwe Kleine-König
2022-05-15 15:59 ` [PATCH 7/8] iio:light:vcnl4000: " Uwe Kleine-König
2022-05-15 15:59 ` [PATCH 8/8] iio:light:vcnl4035: " Uwe Kleine-König
2022-05-15 17:05 ` [PATCH 0/8] iio: Improve error reporting for problems during .remove for various i2c drivers Jonathan Cameron
2022-05-22 10:52   ` Jonathan Cameron

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=20220515155929.338656-3-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=andy.shevchenko@gmail.com \
    --cc=gwendal@chromium.org \
    --cc=jic23@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=mchehab+huawei@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.