All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: accel: mma7660: Warn about failure to put device in stand-by in .remove()
@ 2021-10-25 19:50 Uwe Kleine-König
  2021-10-28 13:53 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2021-10-25 19:50 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen; +Cc: linux-iio, kernel

Whan an i2c 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.

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

diff --git a/drivers/iio/accel/mma7660.c b/drivers/iio/accel/mma7660.c
index 47f5cd66e996..78c20618fdc3 100644
--- a/drivers/iio/accel/mma7660.c
+++ b/drivers/iio/accel/mma7660.c
@@ -210,10 +210,16 @@ static int mma7660_probe(struct i2c_client *client,
 static int mma7660_remove(struct i2c_client *client)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(client);
+	int ret;
 
 	iio_device_unregister(indio_dev);
 
-	return mma7660_set_mode(iio_priv(indio_dev), MMA7660_MODE_STANDBY);
+	ret = mma7660_set_mode(iio_priv(indio_dev), MMA7660_MODE_STANDBY);
+	if (ret)
+		dev_warn(&client->dev, "Failed to put device in stand-by mode (%pe), ignoring\n",
+			 ERR_PTR(ret));
+
+	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: accel: mma7660: Warn about failure to put device in stand-by in .remove()
  2021-10-25 19:50 [PATCH] iio: accel: mma7660: Warn about failure to put device in stand-by in .remove() Uwe Kleine-König
@ 2021-10-28 13:53 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2021-10-28 13:53 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Lars-Peter Clausen, linux-iio, kernel

On Mon, 25 Oct 2021 21:50:07 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> Whan an i2c 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.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Applied to the togreg branch of iio.git.

Note this will be a next cycle thing now as we are too close to the
merge window.

Thanks,

Jonathan

> ---
>  drivers/iio/accel/mma7660.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/mma7660.c b/drivers/iio/accel/mma7660.c
> index 47f5cd66e996..78c20618fdc3 100644
> --- a/drivers/iio/accel/mma7660.c
> +++ b/drivers/iio/accel/mma7660.c
> @@ -210,10 +210,16 @@ static int mma7660_probe(struct i2c_client *client,
>  static int mma7660_remove(struct i2c_client *client)
>  {
>  	struct iio_dev *indio_dev = i2c_get_clientdata(client);
> +	int ret;
>  
>  	iio_device_unregister(indio_dev);
>  
> -	return mma7660_set_mode(iio_priv(indio_dev), MMA7660_MODE_STANDBY);
> +	ret = mma7660_set_mode(iio_priv(indio_dev), MMA7660_MODE_STANDBY);
> +	if (ret)
> +		dev_warn(&client->dev, "Failed to put device in stand-by mode (%pe), ignoring\n",
> +			 ERR_PTR(ret));
> +
> +	return 0;
>  }
>  
>  #ifdef CONFIG_PM_SLEEP


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-28 13:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25 19:50 [PATCH] iio: accel: mma7660: Warn about failure to put device in stand-by in .remove() Uwe Kleine-König
2021-10-28 13:53 ` Jonathan Cameron

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.