The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/9] iio: fix write_raw() return values and remove pm helpers
@ 2026-07-27 18:47 Sang-Heon Jeon
  2026-07-27 18:47 ` [PATCH 1/9] iio: light: isl29028: return zero in write_raw() on success Sang-Heon Jeon
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Sang-Heon Jeon @ 2026-07-27 18:47 UTC (permalink / raw)
  To: Geert Uytterhoeven, Jonathan Cameron, Linus Walleij, Magnus Damm,
	Marek Vasut
  Cc: Andy Shevchenko, Brian Masney, David Lechner, linux-iio,
	linux-kernel, linux-renesas-soc, Nuno Sá

Hello,

This series fixes write_raw() return values and removes pm runtime
helpers in iio drivers, as Jonathan suggested when reviewing the
original iio patch [1].

Patches 1-2 fix write_raw() in isl29028 and tsl2583 to always return
zero on success. write_raw() returns the value of
pm_runtime_put_autosuspend(), which is 1 if the device is already
runtime suspended. In that case write() on the sysfs attribute returns
1 instead of the number of bytes written.

Patches 3-7 remove the pm runtime helpers in isl29028, tsl2583,
vcnl4035, vcnl4000 and rcar-gyroadc. Each helper just calls
pm_runtime_resume_and_get() or pm_runtime_put_autosuspend() depending
on its bool argument and adds no value.

Patches 8-9 are the remaining conditional return cleanups from the
original patch, generated by the Coccinelle script.

[1] https://lore.kernel.org/all/20260723184538.3888637-16-ekffu200098@gmail.com/

---

Sang-Heon Jeon (9):
  iio: light: isl29028: return zero in write_raw() on success
  iio: light: tsl2583: return zero in write_raw() on success
  iio: light: isl29028: remove isl29028_set_pm_runtime_busy() helper
  iio: light: tsl2583: remove tsl2583_set_pm_runtime_busy() helper
  iio: light: vcnl4035: remove vcnl4035_set_pm_runtime_state() helper
  iio: light: vcnl4000: remove vcnl4000_set_pm_runtime_state() helper
  iio: adc: rcar-gyroadc: remove rcar_gyroadc_set_power() helper
  iio: light: tsl2583: remove conditional return with no effect
  iio: magnetometer: ak8974: remove conditional return with no effect

 drivers/iio/adc/rcar-gyroadc.c    | 14 ++------------
 drivers/iio/light/isl29028.c      | 22 ++++++---------------
 drivers/iio/light/tsl2583.c       | 32 ++++++++++---------------------
 drivers/iio/light/vcnl4000.c      | 14 ++------------
 drivers/iio/light/vcnl4035.c      | 18 ++++-------------
 drivers/iio/magnetometer/ak8974.c |  6 +-----
 6 files changed, 25 insertions(+), 81 deletions(-)

-- 
2.43.0


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

* [PATCH 1/9] iio: light: isl29028: return zero in write_raw() on success
  2026-07-27 18:47 [PATCH 0/9] iio: fix write_raw() return values and remove pm helpers Sang-Heon Jeon
@ 2026-07-27 18:47 ` Sang-Heon Jeon
  2026-07-28 19:54   ` Brian Masney
  2026-07-27 18:47 ` [PATCH 2/9] iio: light: tsl2583: " Sang-Heon Jeon
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Sang-Heon Jeon @ 2026-07-27 18:47 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Andy Shevchenko, Brian Masney, David Lechner, Geert Uytterhoeven,
	Linus Walleij, linux-iio, linux-kernel, Magnus Damm, Marek Vasut,
	Nuno Sá

isl29028_write_raw() returns the value of pm_runtime_put_autosuspend(),
which is 1 if the device is already runtime suspended.

In that case write() on the sysfs attribute returns 1 instead of the
number of bytes written. Make isl29028_write_raw() always return zero
on success.

Fixes: 2db5054ac28d ("staging: iio: isl29028: add runtime power management support")
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 drivers/iio/light/isl29028.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/isl29028.c b/drivers/iio/light/isl29028.c
index b88e7c4eae3e..6d5dd17e7a7d 100644
--- a/drivers/iio/light/isl29028.c
+++ b/drivers/iio/light/isl29028.c
@@ -409,7 +409,7 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
 	if (ret < 0)
 		return ret;
 
-	return ret;
+	return 0;
 }
 
 static int isl29028_read_raw(struct iio_dev *indio_dev,
-- 
2.43.0


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

* [PATCH 2/9] iio: light: tsl2583: return zero in write_raw() on success
  2026-07-27 18:47 [PATCH 0/9] iio: fix write_raw() return values and remove pm helpers Sang-Heon Jeon
  2026-07-27 18:47 ` [PATCH 1/9] iio: light: isl29028: return zero in write_raw() on success Sang-Heon Jeon
@ 2026-07-27 18:47 ` Sang-Heon Jeon
  2026-07-28 19:55   ` Brian Masney
  2026-07-27 18:47 ` [PATCH 3/9] iio: light: isl29028: remove isl29028_set_pm_runtime_busy() helper Sang-Heon Jeon
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Sang-Heon Jeon @ 2026-07-27 18:47 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Andy Shevchenko, Brian Masney, David Lechner, Geert Uytterhoeven,
	Linus Walleij, linux-iio, linux-kernel, Magnus Damm, Marek Vasut,
	Nuno Sá

tsl2583_write_raw() returns the value of pm_runtime_put_autosuspend(),
which is 1 if the device is already runtime suspended.

In that case write() on the sysfs attribute returns 1 instead of the
number of bytes written. Make tsl2583_write_raw() always return zero
on success.

Fixes: 371894f5d1a0 ("iio: tsl2583: add runtime power management support")
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 drivers/iio/light/tsl2583.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
index a210d87a1519..54fa426c5755 100644
--- a/drivers/iio/light/tsl2583.c
+++ b/drivers/iio/light/tsl2583.c
@@ -794,7 +794,7 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev,
 	if (ret < 0)
 		return ret;
 
-	return ret;
+	return 0;
 }
 
 static const struct iio_info tsl2583_info = {
-- 
2.43.0


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

* [PATCH 3/9] iio: light: isl29028: remove isl29028_set_pm_runtime_busy() helper
  2026-07-27 18:47 [PATCH 0/9] iio: fix write_raw() return values and remove pm helpers Sang-Heon Jeon
  2026-07-27 18:47 ` [PATCH 1/9] iio: light: isl29028: return zero in write_raw() on success Sang-Heon Jeon
  2026-07-27 18:47 ` [PATCH 2/9] iio: light: tsl2583: " Sang-Heon Jeon
@ 2026-07-27 18:47 ` Sang-Heon Jeon
  2026-07-28 19:57   ` Brian Masney
  2026-07-27 18:47 ` [PATCH 4/9] iio: light: tsl2583: remove tsl2583_set_pm_runtime_busy() helper Sang-Heon Jeon
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Sang-Heon Jeon @ 2026-07-27 18:47 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Andy Shevchenko, David Lechner, Geert Uytterhoeven, Linus Walleij,
	linux-iio, linux-kernel, Magnus Damm, Marek Vasut, Nuno Sá

isl29028_set_pm_runtime_busy() just calls pm_runtime_resume_and_get()
or pm_runtime_put_autosuspend() depending on its bool argument. Call
them directly and remove the helper.

No functional change.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 drivers/iio/light/isl29028.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/iio/light/isl29028.c b/drivers/iio/light/isl29028.c
index 6d5dd17e7a7d..33deb1726689 100644
--- a/drivers/iio/light/isl29028.c
+++ b/drivers/iio/light/isl29028.c
@@ -333,16 +333,6 @@ static int isl29028_ir_get(struct isl29028_chip *chip, int *ir_data)
 	return isl29028_read_als_ir(chip, ir_data);
 }
 
-static int isl29028_set_pm_runtime_busy(struct isl29028_chip *chip, bool on)
-{
-	struct device *dev = regmap_get_device(chip->regmap);
-
-	if (on)
-		return pm_runtime_resume_and_get(dev);
-
-	return pm_runtime_put_autosuspend(dev);
-}
-
 /* Channel IO */
 static int isl29028_write_raw(struct iio_dev *indio_dev,
 			      struct iio_chan_spec const *chan,
@@ -352,7 +342,7 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
 	struct device *dev = regmap_get_device(chip->regmap);
 	int ret;
 
-	ret = isl29028_set_pm_runtime_busy(chip, true);
+	ret = pm_runtime_resume_and_get(dev);
 	if (ret < 0)
 		return ret;
 
@@ -405,7 +395,7 @@ static int isl29028_write_raw(struct iio_dev *indio_dev,
 	if (ret < 0)
 		return ret;
 
-	ret = isl29028_set_pm_runtime_busy(chip, false);
+	ret = pm_runtime_put_autosuspend(dev);
 	if (ret < 0)
 		return ret;
 
@@ -420,7 +410,7 @@ static int isl29028_read_raw(struct iio_dev *indio_dev,
 	struct device *dev = regmap_get_device(chip->regmap);
 	int ret, pm_ret;
 
-	ret = isl29028_set_pm_runtime_busy(chip, true);
+	ret = pm_runtime_resume_and_get(dev);
 	if (ret < 0)
 		return ret;
 
@@ -476,10 +466,10 @@ static int isl29028_read_raw(struct iio_dev *indio_dev,
 
 	/**
 	 * Preserve the ret variable if the call to
-	 * isl29028_set_pm_runtime_busy() is successful so the reading
+	 * pm_runtime_put_autosuspend() is successful so the reading
 	 * (if applicable) is returned to user space.
 	 */
-	pm_ret = isl29028_set_pm_runtime_busy(chip, false);
+	pm_ret = pm_runtime_put_autosuspend(dev);
 	if (pm_ret < 0)
 		return pm_ret;
 
-- 
2.43.0


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

* [PATCH 4/9] iio: light: tsl2583: remove tsl2583_set_pm_runtime_busy() helper
  2026-07-27 18:47 [PATCH 0/9] iio: fix write_raw() return values and remove pm helpers Sang-Heon Jeon
                   ` (2 preceding siblings ...)
  2026-07-27 18:47 ` [PATCH 3/9] iio: light: isl29028: remove isl29028_set_pm_runtime_busy() helper Sang-Heon Jeon
@ 2026-07-27 18:47 ` Sang-Heon Jeon
  2026-07-28 19:58   ` Brian Masney
  2026-07-27 18:47 ` [PATCH 5/9] iio: light: vcnl4035: remove vcnl4035_set_pm_runtime_state() helper Sang-Heon Jeon
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Sang-Heon Jeon @ 2026-07-27 18:47 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Andy Shevchenko, David Lechner, Geert Uytterhoeven, Linus Walleij,
	linux-iio, linux-kernel, Magnus Damm, Marek Vasut, Nuno Sá

tsl2583_set_pm_runtime_busy() just calls pm_runtime_resume_and_get()
or pm_runtime_put_autosuspend() depending on its bool argument. Call
them directly and remove the helper.

No functional change.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 drivers/iio/light/tsl2583.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
index 54fa426c5755..06da145569f7 100644
--- a/drivers/iio/light/tsl2583.c
+++ b/drivers/iio/light/tsl2583.c
@@ -639,14 +639,6 @@ static const struct iio_chan_spec tsl2583_channels[] = {
 	},
 };
 
-static int tsl2583_set_pm_runtime_busy(struct tsl2583_chip *chip, bool on)
-{
-	if (on)
-		return pm_runtime_resume_and_get(&chip->client->dev);
-
-	return pm_runtime_put_autosuspend(&chip->client->dev);
-}
-
 static int tsl2583_read_raw(struct iio_dev *indio_dev,
 			    struct iio_chan_spec const *chan,
 			    int *val, int *val2, long mask)
@@ -654,7 +646,7 @@ static int tsl2583_read_raw(struct iio_dev *indio_dev,
 	struct tsl2583_chip *chip = iio_priv(indio_dev);
 	int ret, pm_ret;
 
-	ret = tsl2583_set_pm_runtime_busy(chip, true);
+	ret = pm_runtime_resume_and_get(&chip->client->dev);
 	if (ret < 0)
 		return ret;
 
@@ -722,16 +714,16 @@ static int tsl2583_read_raw(struct iio_dev *indio_dev,
 	mutex_unlock(&chip->als_mutex);
 
 	if (ret < 0) {
-		tsl2583_set_pm_runtime_busy(chip, false);
+		pm_runtime_put_autosuspend(&chip->client->dev);
 		return ret;
 	}
 
 	/*
 	 * Preserve the ret variable if the call to
-	 * tsl2583_set_pm_runtime_busy() is successful so the reading
+	 * pm_runtime_put_autosuspend() is successful so the reading
 	 * (if applicable) is returned to user space.
 	 */
-	pm_ret = tsl2583_set_pm_runtime_busy(chip, false);
+	pm_ret = pm_runtime_put_autosuspend(&chip->client->dev);
 	if (pm_ret < 0)
 		return pm_ret;
 
@@ -745,7 +737,7 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev,
 	struct tsl2583_chip *chip = iio_priv(indio_dev);
 	int ret;
 
-	ret = tsl2583_set_pm_runtime_busy(chip, true);
+	ret = pm_runtime_resume_and_get(&chip->client->dev);
 	if (ret < 0)
 		return ret;
 
@@ -786,11 +778,11 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev,
 	mutex_unlock(&chip->als_mutex);
 
 	if (ret < 0) {
-		tsl2583_set_pm_runtime_busy(chip, false);
+		pm_runtime_put_autosuspend(&chip->client->dev);
 		return ret;
 	}
 
-	ret = tsl2583_set_pm_runtime_busy(chip, false);
+	ret = pm_runtime_put_autosuspend(&chip->client->dev);
 	if (ret < 0)
 		return ret;
 
-- 
2.43.0


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

* [PATCH 5/9] iio: light: vcnl4035: remove vcnl4035_set_pm_runtime_state() helper
  2026-07-27 18:47 [PATCH 0/9] iio: fix write_raw() return values and remove pm helpers Sang-Heon Jeon
                   ` (3 preceding siblings ...)
  2026-07-27 18:47 ` [PATCH 4/9] iio: light: tsl2583: remove tsl2583_set_pm_runtime_busy() helper Sang-Heon Jeon
@ 2026-07-27 18:47 ` Sang-Heon Jeon
  2026-07-27 18:47 ` [PATCH 6/9] iio: light: vcnl4000: remove vcnl4000_set_pm_runtime_state() helper Sang-Heon Jeon
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Sang-Heon Jeon @ 2026-07-27 18:47 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Andy Shevchenko, David Lechner, Geert Uytterhoeven, Linus Walleij,
	linux-iio, linux-kernel, Magnus Damm, Marek Vasut, Nuno Sá

vcnl4035_set_pm_runtime_state() just calls pm_runtime_resume_and_get()
or pm_runtime_put_autosuspend() depending on its bool argument. Call
them directly and remove the helper.

No functional change.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 drivers/iio/light/vcnl4035.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/iio/light/vcnl4035.c b/drivers/iio/light/vcnl4035.c
index d13c5ff33e07..ce1bd42b0c7c 100644
--- a/drivers/iio/light/vcnl4035.c
+++ b/drivers/iio/light/vcnl4035.c
@@ -145,16 +145,6 @@ static const struct iio_trigger_ops vcnl4035_trigger_ops = {
 	.set_trigger_state = vcnl4035_als_drdy_set_state,
 };
 
-static int vcnl4035_set_pm_runtime_state(struct vcnl4035_data *data, bool on)
-{
-	struct device *dev = &data->client->dev;
-
-	if (on)
-		return pm_runtime_resume_and_get(dev);
-
-	return pm_runtime_put_autosuspend(dev);
-}
-
 static int vcnl4035_read_info_raw(struct iio_dev *indio_dev,
 				  struct iio_chan_spec const *chan, int *val)
 {
@@ -202,11 +192,11 @@ static int vcnl4035_read_raw(struct iio_dev *indio_dev,
 
 	switch (mask) {
 	case IIO_CHAN_INFO_RAW:
-		ret = vcnl4035_set_pm_runtime_state(data, true);
+		ret = pm_runtime_resume_and_get(&data->client->dev);
 		if  (ret < 0)
 			return ret;
 		ret = vcnl4035_read_info_raw(indio_dev, chan, val);
-		vcnl4035_set_pm_runtime_state(data, false);
+		pm_runtime_put_autosuspend(&data->client->dev);
 		return ret;
 	case IIO_CHAN_INFO_INT_TIME:
 		*val = 50;
@@ -237,7 +227,7 @@ static int vcnl4035_write_raw(struct iio_dev *indio_dev,
 		if (val <= 0 || val > 800)
 			return -EINVAL;
 
-		ret = vcnl4035_set_pm_runtime_state(data, true);
+		ret = pm_runtime_resume_and_get(&data->client->dev);
 		if  (ret < 0)
 			return ret;
 
@@ -247,7 +237,7 @@ static int vcnl4035_write_raw(struct iio_dev *indio_dev,
 		if (!ret)
 			data->als_it_val = val / 100;
 
-		vcnl4035_set_pm_runtime_state(data, false);
+		pm_runtime_put_autosuspend(&data->client->dev);
 		return ret;
 	default:
 		return -EINVAL;
-- 
2.43.0


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

* [PATCH 6/9] iio: light: vcnl4000: remove vcnl4000_set_pm_runtime_state() helper
  2026-07-27 18:47 [PATCH 0/9] iio: fix write_raw() return values and remove pm helpers Sang-Heon Jeon
                   ` (4 preceding siblings ...)
  2026-07-27 18:47 ` [PATCH 5/9] iio: light: vcnl4035: remove vcnl4035_set_pm_runtime_state() helper Sang-Heon Jeon
@ 2026-07-27 18:47 ` Sang-Heon Jeon
  2026-07-27 18:47 ` [PATCH 7/9] iio: adc: rcar-gyroadc: remove rcar_gyroadc_set_power() helper Sang-Heon Jeon
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Sang-Heon Jeon @ 2026-07-27 18:47 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Andy Shevchenko, David Lechner, Geert Uytterhoeven, Linus Walleij,
	linux-iio, linux-kernel, Magnus Damm, Marek Vasut, Nuno Sá

vcnl4000_set_pm_runtime_state() just calls pm_runtime_resume_and_get()
or pm_runtime_put_autosuspend() depending on its bool argument. Call
them directly and remove the helper.

No functional change.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 drivers/iio/light/vcnl4000.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index b8ac156ad5c9..336468d59ea7 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -537,16 +537,6 @@ static bool vcnl4010_is_in_periodic_mode(struct vcnl4000_data *data)
 	return !!(ret & VCNL4000_SELF_TIMED_EN);
 }
 
-static int vcnl4000_set_pm_runtime_state(struct vcnl4000_data *data, bool on)
-{
-	struct device *dev = &data->client->dev;
-
-	if (on)
-		return pm_runtime_resume_and_get(dev);
-
-	return pm_runtime_put_autosuspend(dev);
-}
-
 static int vcnl4040_read_als_it(struct vcnl4000_data *data, int *val, int *val2)
 {
 	int ret;
@@ -850,7 +840,7 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev,
 
 	switch (mask) {
 	case IIO_CHAN_INFO_RAW:
-		ret = vcnl4000_set_pm_runtime_state(data, true);
+		ret = pm_runtime_resume_and_get(&data->client->dev);
 		if  (ret < 0)
 			return ret;
 
@@ -869,7 +859,7 @@ static int vcnl4000_read_raw(struct iio_dev *indio_dev,
 		default:
 			ret = -EINVAL;
 		}
-		vcnl4000_set_pm_runtime_state(data, false);
+		pm_runtime_put_autosuspend(&data->client->dev);
 		return ret;
 	case IIO_CHAN_INFO_SCALE:
 		if (chan->type != IIO_LIGHT)
-- 
2.43.0


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

* [PATCH 7/9] iio: adc: rcar-gyroadc: remove rcar_gyroadc_set_power() helper
  2026-07-27 18:47 [PATCH 0/9] iio: fix write_raw() return values and remove pm helpers Sang-Heon Jeon
                   ` (5 preceding siblings ...)
  2026-07-27 18:47 ` [PATCH 6/9] iio: light: vcnl4000: remove vcnl4000_set_pm_runtime_state() helper Sang-Heon Jeon
@ 2026-07-27 18:47 ` Sang-Heon Jeon
  2026-07-27 18:47 ` [PATCH 8/9] iio: light: tsl2583: remove conditional return with no effect Sang-Heon Jeon
  2026-07-27 18:47 ` [PATCH 9/9] iio: magnetometer: ak8974: " Sang-Heon Jeon
  8 siblings, 0 replies; 15+ messages in thread
From: Sang-Heon Jeon @ 2026-07-27 18:47 UTC (permalink / raw)
  To: Marek Vasut, Jonathan Cameron, Geert Uytterhoeven, Magnus Damm
  Cc: Andy Shevchenko, David Lechner, Linus Walleij, linux-iio,
	linux-kernel, linux-renesas-soc, Nuno Sá

rcar_gyroadc_set_power() just calls pm_runtime_resume_and_get() or
pm_runtime_put_autosuspend() depending on its bool argument. Call them
directly and remove the helper.

No functional change.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 drivers/iio/adc/rcar-gyroadc.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c
index 3a17b3898bf6..d38cf3caeae0 100644
--- a/drivers/iio/adc/rcar-gyroadc.c
+++ b/drivers/iio/adc/rcar-gyroadc.c
@@ -159,16 +159,6 @@ static const struct iio_chan_spec rcar_gyroadc_iio_channels_3[] = {
 	RCAR_GYROADC_CHAN(7),
 };
 
-static int rcar_gyroadc_set_power(struct rcar_gyroadc *priv, bool on)
-{
-	struct device *dev = priv->dev;
-
-	if (on)
-		return pm_runtime_resume_and_get(dev);
-
-	return pm_runtime_put_autosuspend(dev);
-}
-
 static int rcar_gyroadc_read_raw(struct iio_dev *indio_dev,
 				 struct iio_chan_spec const *chan,
 				 int *val, int *val2, long mask)
@@ -200,7 +190,7 @@ static int rcar_gyroadc_read_raw(struct iio_dev *indio_dev,
 		if (!iio_device_claim_direct(indio_dev))
 			return -EBUSY;
 
-		ret = rcar_gyroadc_set_power(priv, true);
+		ret = pm_runtime_resume_and_get(priv->dev);
 		if (ret < 0) {
 			iio_device_release_direct(indio_dev);
 			return ret;
@@ -209,7 +199,7 @@ static int rcar_gyroadc_read_raw(struct iio_dev *indio_dev,
 		*val = readl(priv->regs + datareg);
 		*val &= BIT(priv->sample_width) - 1;
 
-		ret = rcar_gyroadc_set_power(priv, false);
+		ret = pm_runtime_put_autosuspend(priv->dev);
 		iio_device_release_direct(indio_dev);
 		if (ret < 0)
 			return ret;
-- 
2.43.0


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

* [PATCH 8/9] iio: light: tsl2583: remove conditional return with no effect
  2026-07-27 18:47 [PATCH 0/9] iio: fix write_raw() return values and remove pm helpers Sang-Heon Jeon
                   ` (6 preceding siblings ...)
  2026-07-27 18:47 ` [PATCH 7/9] iio: adc: rcar-gyroadc: remove rcar_gyroadc_set_power() helper Sang-Heon Jeon
@ 2026-07-27 18:47 ` Sang-Heon Jeon
  2026-07-28 19:59   ` Brian Masney
  2026-07-27 18:47 ` [PATCH 9/9] iio: magnetometer: ak8974: " Sang-Heon Jeon
  8 siblings, 1 reply; 15+ messages in thread
From: Sang-Heon Jeon @ 2026-07-27 18:47 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Andy Shevchenko, David Lechner, Geert Uytterhoeven, Linus Walleij,
	linux-iio, linux-kernel, Magnus Damm, Marek Vasut, Nuno Sá,
	Joshua Crofts

Both branches of the check return the same value, so the check has no
effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
---
 drivers/iio/light/tsl2583.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
index 06da145569f7..53fd423aa7ae 100644
--- a/drivers/iio/light/tsl2583.c
+++ b/drivers/iio/light/tsl2583.c
@@ -456,12 +456,8 @@ static int tsl2583_chip_init_and_power_on(struct iio_dev *indio_dev)
 
 	usleep_range(3000, 3500);
 
-	ret = tsl2583_set_power_state(chip, TSL2583_CNTL_PWR_ON |
-					    TSL2583_CNTL_ADC_ENBL);
-	if (ret < 0)
-		return ret;
-
-	return ret;
+	return tsl2583_set_power_state(chip,
+				       TSL2583_CNTL_PWR_ON | TSL2583_CNTL_ADC_ENBL);
 }
 
 /* Sysfs Interface Functions */
-- 
2.43.0


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

* [PATCH 9/9] iio: magnetometer: ak8974: remove conditional return with no effect
  2026-07-27 18:47 [PATCH 0/9] iio: fix write_raw() return values and remove pm helpers Sang-Heon Jeon
                   ` (7 preceding siblings ...)
  2026-07-27 18:47 ` [PATCH 8/9] iio: light: tsl2583: remove conditional return with no effect Sang-Heon Jeon
@ 2026-07-27 18:47 ` Sang-Heon Jeon
  8 siblings, 0 replies; 15+ messages in thread
From: Sang-Heon Jeon @ 2026-07-27 18:47 UTC (permalink / raw)
  To: Linus Walleij, Jonathan Cameron
  Cc: Andy Shevchenko, David Lechner, Geert Uytterhoeven, linux-iio,
	linux-kernel, Magnus Damm, Marek Vasut, Nuno Sá,
	Joshua Crofts

Both branches of the check return the same value, so the check has no
effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
---
 drivers/iio/magnetometer/ak8974.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
index c7fdb7c2f543..c988d0e40cea 100644
--- a/drivers/iio/magnetometer/ak8974.c
+++ b/drivers/iio/magnetometer/ak8974.c
@@ -379,11 +379,7 @@ static int ak8974_getresult(struct ak8974 *ak8974, __le16 *result)
 		return -ERANGE;
 	}
 
-	ret = regmap_bulk_read(ak8974->map, AK8974_DATA_X, result, 6);
-	if (ret)
-		return ret;
-
-	return ret;
+	return regmap_bulk_read(ak8974->map, AK8974_DATA_X, result, 6);
 }
 
 static irqreturn_t ak8974_drdy_irq(int irq, void *d)
-- 
2.43.0


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

* Re: [PATCH 1/9] iio: light: isl29028: return zero in write_raw() on success
  2026-07-27 18:47 ` [PATCH 1/9] iio: light: isl29028: return zero in write_raw() on success Sang-Heon Jeon
@ 2026-07-28 19:54   ` Brian Masney
  0 siblings, 0 replies; 15+ messages in thread
From: Brian Masney @ 2026-07-28 19:54 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Jonathan Cameron, Andy Shevchenko, Brian Masney, David Lechner,
	Geert Uytterhoeven, Linus Walleij, linux-iio, linux-kernel,
	Magnus Damm, Marek Vasut, Nuno Sá

On Tue, Jul 28, 2026 at 03:47:38AM +0900, Sang-Heon Jeon wrote:
> isl29028_write_raw() returns the value of pm_runtime_put_autosuspend(),
> which is 1 if the device is already runtime suspended.
> 
> In that case write() on the sysfs attribute returns 1 instead of the
> number of bytes written. Make isl29028_write_raw() always return zero
> on success.
> 
> Fixes: 2db5054ac28d ("staging: iio: isl29028: add runtime power management support")
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>

Reviewed-by: Brian Masney <bmasney@redhat.com>


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

* Re: [PATCH 2/9] iio: light: tsl2583: return zero in write_raw() on success
  2026-07-27 18:47 ` [PATCH 2/9] iio: light: tsl2583: " Sang-Heon Jeon
@ 2026-07-28 19:55   ` Brian Masney
  0 siblings, 0 replies; 15+ messages in thread
From: Brian Masney @ 2026-07-28 19:55 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Jonathan Cameron, Andy Shevchenko, Brian Masney, David Lechner,
	Geert Uytterhoeven, Linus Walleij, linux-iio, linux-kernel,
	Magnus Damm, Marek Vasut, Nuno Sá

On Tue, Jul 28, 2026 at 03:47:39AM +0900, Sang-Heon Jeon wrote:
> tsl2583_write_raw() returns the value of pm_runtime_put_autosuspend(),
> which is 1 if the device is already runtime suspended.
> 
> In that case write() on the sysfs attribute returns 1 instead of the
> number of bytes written. Make tsl2583_write_raw() always return zero
> on success.
> 
> Fixes: 371894f5d1a0 ("iio: tsl2583: add runtime power management support")
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>

Reviewed-by: Brian Masney <bmasney@redhat.com>


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

* Re: [PATCH 3/9] iio: light: isl29028: remove isl29028_set_pm_runtime_busy() helper
  2026-07-27 18:47 ` [PATCH 3/9] iio: light: isl29028: remove isl29028_set_pm_runtime_busy() helper Sang-Heon Jeon
@ 2026-07-28 19:57   ` Brian Masney
  0 siblings, 0 replies; 15+ messages in thread
From: Brian Masney @ 2026-07-28 19:57 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Jonathan Cameron, Andy Shevchenko, David Lechner,
	Geert Uytterhoeven, Linus Walleij, linux-iio, linux-kernel,
	Magnus Damm, Marek Vasut, Nuno Sá

On Tue, Jul 28, 2026 at 03:47:40AM +0900, Sang-Heon Jeon wrote:
> isl29028_set_pm_runtime_busy() just calls pm_runtime_resume_and_get()
> or pm_runtime_put_autosuspend() depending on its bool argument. Call
> them directly and remove the helper.
> 
> No functional change.
> 
> Suggested-by: Jonathan Cameron <jic23@kernel.org>
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>

Reviewed-by: Brian Masney <bmasney@redhat.com>


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

* Re: [PATCH 4/9] iio: light: tsl2583: remove tsl2583_set_pm_runtime_busy() helper
  2026-07-27 18:47 ` [PATCH 4/9] iio: light: tsl2583: remove tsl2583_set_pm_runtime_busy() helper Sang-Heon Jeon
@ 2026-07-28 19:58   ` Brian Masney
  0 siblings, 0 replies; 15+ messages in thread
From: Brian Masney @ 2026-07-28 19:58 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Jonathan Cameron, Andy Shevchenko, David Lechner,
	Geert Uytterhoeven, Linus Walleij, linux-iio, linux-kernel,
	Magnus Damm, Marek Vasut, Nuno Sá

On Tue, Jul 28, 2026 at 03:47:41AM +0900, Sang-Heon Jeon wrote:
> tsl2583_set_pm_runtime_busy() just calls pm_runtime_resume_and_get()
> or pm_runtime_put_autosuspend() depending on its bool argument. Call
> them directly and remove the helper.
> 
> No functional change.
> 
> Suggested-by: Jonathan Cameron <jic23@kernel.org>
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>

Reviewed-by: Brian Masney <bmasney@redhat.com>


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

* Re: [PATCH 8/9] iio: light: tsl2583: remove conditional return with no effect
  2026-07-27 18:47 ` [PATCH 8/9] iio: light: tsl2583: remove conditional return with no effect Sang-Heon Jeon
@ 2026-07-28 19:59   ` Brian Masney
  0 siblings, 0 replies; 15+ messages in thread
From: Brian Masney @ 2026-07-28 19:59 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: Jonathan Cameron, Andy Shevchenko, David Lechner,
	Geert Uytterhoeven, Linus Walleij, linux-iio, linux-kernel,
	Magnus Damm, Marek Vasut, Nuno Sá, Joshua Crofts

On Tue, Jul 28, 2026 at 03:47:45AM +0900, Sang-Heon Jeon wrote:
> Both branches of the check return the same value, so the check has no
> effect. Remove it and return the value directly.
> 
> This is the result of running the Coccinelle script from
> scripts/coccinelle/misc/cond_return_no_effect.cocci.
> 
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>

Reviewed-by: Brian Masney <bmasney@redhat.com>


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

end of thread, other threads:[~2026-07-28 19:59 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-27 18:47 [PATCH 0/9] iio: fix write_raw() return values and remove pm helpers Sang-Heon Jeon
2026-07-27 18:47 ` [PATCH 1/9] iio: light: isl29028: return zero in write_raw() on success Sang-Heon Jeon
2026-07-28 19:54   ` Brian Masney
2026-07-27 18:47 ` [PATCH 2/9] iio: light: tsl2583: " Sang-Heon Jeon
2026-07-28 19:55   ` Brian Masney
2026-07-27 18:47 ` [PATCH 3/9] iio: light: isl29028: remove isl29028_set_pm_runtime_busy() helper Sang-Heon Jeon
2026-07-28 19:57   ` Brian Masney
2026-07-27 18:47 ` [PATCH 4/9] iio: light: tsl2583: remove tsl2583_set_pm_runtime_busy() helper Sang-Heon Jeon
2026-07-28 19:58   ` Brian Masney
2026-07-27 18:47 ` [PATCH 5/9] iio: light: vcnl4035: remove vcnl4035_set_pm_runtime_state() helper Sang-Heon Jeon
2026-07-27 18:47 ` [PATCH 6/9] iio: light: vcnl4000: remove vcnl4000_set_pm_runtime_state() helper Sang-Heon Jeon
2026-07-27 18:47 ` [PATCH 7/9] iio: adc: rcar-gyroadc: remove rcar_gyroadc_set_power() helper Sang-Heon Jeon
2026-07-27 18:47 ` [PATCH 8/9] iio: light: tsl2583: remove conditional return with no effect Sang-Heon Jeon
2026-07-28 19:59   ` Brian Masney
2026-07-27 18:47 ` [PATCH 9/9] iio: magnetometer: ak8974: " Sang-Heon Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox