All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Dan Robertson <dan@dlrobertson.com>, Jonathan Cameron <jic23@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Mark Brown <broonie@kernel.org>, Wolfram Sang <wsa@kernel.org>,
	kernel@pengutronix.de, linux-i2c@vger.kernel.org,
	linux-iio@vger.kernel.org, linux-spi@vger.kernel.org
Subject: [PATCH 01/15] iio: accel: bma400: Make bma400_remove() return void
Date: Wed, 13 Oct 2021 22:32:09 +0200	[thread overview]
Message-ID: <20211013203223.2694577-2-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20211013203223.2694577-1-u.kleine-koenig@pengutronix.de>

When an i2c or spi driver's remove function returns a non-zero error
code nothing happens apart from emitting a generic error message. Make
this error message more device specific and return zero instead in the
remove callbacks. As the return value of bma400_remove() is unused then,
change the function to not yield a return value.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/iio/accel/bma400.h      | 2 +-
 drivers/iio/accel/bma400_core.c | 7 ++++---
 drivers/iio/accel/bma400_i2c.c  | 4 +++-
 drivers/iio/accel/bma400_spi.c  | 4 +++-
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/accel/bma400.h b/drivers/iio/accel/bma400.h
index 5ad10db9819f..c4c8d74155c2 100644
--- a/drivers/iio/accel/bma400.h
+++ b/drivers/iio/accel/bma400.h
@@ -94,6 +94,6 @@ extern const struct regmap_config bma400_regmap_config;
 
 int bma400_probe(struct device *dev, struct regmap *regmap, const char *name);
 
-int bma400_remove(struct device *dev);
+void bma400_remove(struct device *dev);
 
 #endif
diff --git a/drivers/iio/accel/bma400_core.c b/drivers/iio/accel/bma400_core.c
index 21520e022a21..fd2647b728d3 100644
--- a/drivers/iio/accel/bma400_core.c
+++ b/drivers/iio/accel/bma400_core.c
@@ -828,7 +828,7 @@ int bma400_probe(struct device *dev, struct regmap *regmap, const char *name)
 }
 EXPORT_SYMBOL(bma400_probe);
 
-int bma400_remove(struct device *dev)
+void bma400_remove(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct bma400_data *data = iio_priv(indio_dev);
@@ -838,12 +838,13 @@ int bma400_remove(struct device *dev)
 	ret = bma400_set_power_mode(data, POWER_MODE_SLEEP);
 	mutex_unlock(&data->mutex);
 
+	if (ret)
+		dev_warn(dev, "Failed to put device into sleep mode (%pe)\n", ERR_PTR(ret));
+
 	regulator_bulk_disable(ARRAY_SIZE(data->regulators),
 			       data->regulators);
 
 	iio_device_unregister(indio_dev);
-
-	return ret;
 }
 EXPORT_SYMBOL(bma400_remove);
 
diff --git a/drivers/iio/accel/bma400_i2c.c b/drivers/iio/accel/bma400_i2c.c
index 9dcb7cc9996e..f50df5310beb 100644
--- a/drivers/iio/accel/bma400_i2c.c
+++ b/drivers/iio/accel/bma400_i2c.c
@@ -29,7 +29,9 @@ static int bma400_i2c_probe(struct i2c_client *client,
 
 static int bma400_i2c_remove(struct i2c_client *client)
 {
-	return bma400_remove(&client->dev);
+	bma400_remove(&client->dev);
+
+	return 0;
 }
 
 static const struct i2c_device_id bma400_i2c_ids[] = {
diff --git a/drivers/iio/accel/bma400_spi.c b/drivers/iio/accel/bma400_spi.c
index 7c2825904e08..9f622e37477b 100644
--- a/drivers/iio/accel/bma400_spi.c
+++ b/drivers/iio/accel/bma400_spi.c
@@ -89,7 +89,9 @@ static int bma400_spi_probe(struct spi_device *spi)
 
 static int bma400_spi_remove(struct spi_device *spi)
 {
-	return bma400_remove(&spi->dev);
+	bma400_remove(&spi->dev);
+
+	return 0;
 }
 
 static const struct spi_device_id bma400_spi_ids[] = {
-- 
2.30.2


  reply	other threads:[~2021-10-13 20:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 20:32 [PATCH 00/15] iio: let spi drivers return 0 in .remove() Uwe Kleine-König
2021-10-13 20:32 ` Uwe Kleine-König [this message]
2021-10-13 20:32 ` [PATCH 02/15] iio: accel: bmc150: Make bmc150_accel_core_remove() return void Uwe Kleine-König
2021-10-13 20:32 ` [PATCH 03/15] iio: accel: bmi088: Make bmi088_accel_core_remove() " Uwe Kleine-König
2021-10-13 20:32 ` [PATCH 04/15] iio: accel: kxsd9: Make kxsd9_common_remove() " Uwe Kleine-König
2021-10-13 20:32 ` [PATCH 05/15] iio: accel: mma7455: Make mma7455_core_remove() " Uwe Kleine-König
2021-10-13 20:32 ` [PATCH 06/15] iio: accel: ad5064: Make ad5064_core_remove() " Uwe Kleine-König
2021-10-14 17:29   ` Jonathan Cameron
2021-10-13 20:32 ` [PATCH 07/15] iio: dac: ad5380: Make ad5380_remove() " Uwe Kleine-König
2021-10-13 20:32 ` [PATCH 08/15] iio: dac: ad5446: Make ad5446_remove() " Uwe Kleine-König
2021-10-13 20:32 ` [PATCH 09/15] iio: dac: ad5592r: Make ad5592r_remove() " Uwe Kleine-König
2021-10-13 20:32 ` [PATCH 10/15] iio: dac: ad5686: Make ad5686_remove() " Uwe Kleine-König
2021-10-13 20:32 ` [PATCH 11/15] iio: health: afe4403: Don't return an error in .remove() Uwe Kleine-König
2021-10-13 20:32 ` [PATCH 12/15] iio: imu: st_lsm9ds0: Make st_lsm9ds0_remove() return void Uwe Kleine-König
2021-10-14 17:32   ` Jonathan Cameron
2021-10-13 20:32 ` [PATCH 13/15] iio: magn: hmc5843: Make hmc5843_common_remove() " Uwe Kleine-König
2021-10-13 20:32 ` [PATCH 14/15] iio: potentiometer: max5487: Don't return an error in .remove() Uwe Kleine-König
2021-10-13 20:32 ` [PATCH 15/15] iio: pressure: ms5611: Make ms5611_remove() return void Uwe Kleine-König
2021-10-14  7:45 ` [PATCH 00/15] iio: let spi drivers return 0 in .remove() Alexandru Ardelean
2021-10-14 17:35   ` 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=20211013203223.2694577-2-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=broonie@kernel.org \
    --cc=dan@dlrobertson.com \
    --cc=jic23@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=lars@metafoo.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=wsa@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.