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>,
	Matt Ranostay <matt.ranostay@konsulko.com>,
	Paul Cercueil <paul@crapouillou.net>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	linux-iio@vger.kernel.org, kernel@pengutronix.de
Subject: [PATCH 3/8] iio:chemical:atlas: Improve error reporting for problems during .remove()
Date: Sun, 15 May 2022 17:59:24 +0200	[thread overview]
Message-ID: <20220515155929.338656-4-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/chemical/atlas-sensor.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c
index 56dea9734c8d..8378c00fa2ff 100644
--- a/drivers/iio/chemical/atlas-sensor.c
+++ b/drivers/iio/chemical/atlas-sensor.c
@@ -726,6 +726,7 @@ static int atlas_remove(struct i2c_client *client)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(client);
 	struct atlas_data *data = iio_priv(indio_dev);
+	int ret;
 
 	iio_device_unregister(indio_dev);
 	iio_triggered_buffer_cleanup(indio_dev);
@@ -734,7 +735,12 @@ static int atlas_remove(struct i2c_client *client)
 	pm_runtime_disable(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
 
-	return atlas_set_powermode(data, 0);
+	ret = atlas_set_powermode(data, 0);
+	if (ret)
+		dev_err(&client->dev, "Failed to power down device (%pe)\n",
+			ERR_PTR(ret));
+
+	return 0;
 }
 
 static int atlas_runtime_suspend(struct device *dev)
-- 
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 ` [PATCH 2/8] iio:adc:ti-ads1015: " Uwe Kleine-König
2022-05-15 15:59 ` Uwe Kleine-König [this message]
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-4-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=jic23@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=matt.ranostay@konsulko.com \
    --cc=mchehab+huawei@kernel.org \
    --cc=paul@crapouillou.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 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.