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>,
	Alexandru Ardelean <ardeleanalex@gmail.com>,
	Gwendal Grignou <gwendal@chromium.org>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	linux-iio@vger.kernel.org, kernel@pengutronix.de
Subject: [PATCH 8/8] iio:light:vcnl4035: Improve error reporting for problems during .remove()
Date: Sun, 15 May 2022 17:59:29 +0200	[thread overview]
Message-ID: <20220515155929.338656-9-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/light/vcnl4035.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/light/vcnl4035.c b/drivers/iio/light/vcnl4035.c
index da2bf622a67b..2aaec6bef64c 100644
--- a/drivers/iio/light/vcnl4035.c
+++ b/drivers/iio/light/vcnl4035.c
@@ -604,14 +604,20 @@ static int vcnl4035_probe(struct i2c_client *client,
 static int vcnl4035_remove(struct i2c_client *client)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(client);
+	int ret;
 
 	pm_runtime_dont_use_autosuspend(&client->dev);
 	pm_runtime_disable(&client->dev);
 	iio_device_unregister(indio_dev);
 	pm_runtime_set_suspended(&client->dev);
 
-	return vcnl4035_set_als_power_state(iio_priv(indio_dev),
-					VCNL4035_MODE_ALS_DISABLE);
+	ret = vcnl4035_set_als_power_state(iio_priv(indio_dev),
+					   VCNL4035_MODE_ALS_DISABLE);
+	if (ret)
+		dev_warn(&client->dev, "Failed to put device into standby (%pe)\n",
+			 ERR_PTR(ret));
+
+	return 0;
 }
 
 static int __maybe_unused vcnl4035_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 ` [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 ` Uwe Kleine-König [this message]
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-9-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=ardeleanalex@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.