Skip to contentSkip to conversation

IIO: Runtime PM related cleanups.

PATCH In review Jonathan Cameron 3 participants 22 messages May 16, 2021 – Jun 16, 2021

Subsystems (2)
lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

v2 cover IIO: Runtime PM related cleanups.

From: Jonathan Cameron <[email protected]>

Changes since v1:
* Drop all patches since applied.
* Clean up some more unbalanced cases that Mauro pointed out.
* One additional fix for lack of put in an error path.
* Dropped zpa2326 patch for now. The use of runtime pm in that driver is sufficiently odd that it needs a closer look before any changes.

Note the unbalanced put is not a bug as such, because the runtime pm core protects against the reference count going negative. However, it is a bad pattern to have copied into new drivers (as it confuses me) so I'd like to clear it out.

Inspired by Mauro's work on similar issues in media and Julia's coccicheck script.

There will be at least one more set of these once this first set have flushed out any mistakes I may have made.

I checked my assumptions around the excess pm_runtime_put_noidle calls in QEMU but may well be missing something even so.

Cc Jean-Baptiste Maneyrol <[email protected]>
Cc Matt Ranostay <[email protected]>

Jonathan Cameron (6):
iio: imu: mpu6050: Balance runtime pm + use
pm_runtime_resume_and_get()
iio: adc: ads1015: Balance runtime pm + pm_runtime_resume_and_get()
iio: chemical: atlas-sensor: Balance runtime pm +
pm_runtime_resume_and_get()
iio: prox: pulsed-light-v2: Fix misbalance runtime pm in error path
iio: prox: pulsed-light-v2: Use pm_runtime_resume_and_get()
iio: pressure: icp10100: Balance runtime pm + use
pm_runtime_resume_and_get()

 drivers/iio/adc/ti-ads1015.c                  |  5 +----
 drivers/iio/chemical/atlas-sensor.c           | 13 ++++---------
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c    | 19 ++++++-------------
 drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c |  6 ++----
 drivers/iio/pressure/icp10100.c               |  5 +++--
 .../iio/proximity/pulsedlight-lidar-lite-v2.c |  7 +++++--
 6 files changed, 21 insertions(+), 34 deletions(-)
Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH v2 1/6 iio: imu: mpu6050: Balance runtime pm + use pm_runtime_resume_and_get()

From: Jonathan Cameron <[email protected]>

Remove an unblanced pm_runtime_put_sync_suspend() call
in inv_pu_pm_disable(). Not this call is not a bug, because the runtime pm core will not allow the reference counter to go negative. It is however confusing and serves no purpose.

pm_runtime_resume_and_get() case found using coccicheck script under review at:
https://lore.kernel.org/lkml/[email protected]/

pm_runtime_resume_and_get() returns <= 0 only so simplify related checks to bring this more inline with nearby calls.

This is a prequel to taking a closer look at the runtime pm in IIO drivers in general.

Cc Jean-Baptiste Maneyrol <[email protected]>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c    | 19 ++++++-------------
 drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c |  6 ++----
 2 files changed, 8 insertions(+), 17 deletions(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +6 -13
index 6244a07048df..4cae3765e327 100644
@@ -570,11 +570,9 @@ static int inv_mpu6050_read_channel_data(struct iio_dev *indio_dev,
 	freq_hz = INV_MPU6050_DIVIDER_TO_FIFO_RATE(st->chip_config.divider);
 	period_us = 1000000 / freq_hz;
 
-	result = pm_runtime_get_sync(pdev);
-	if (result < 0) {
-		pm_runtime_put_noidle(pdev);
+	result = pm_runtime_resume_and_get(pdev);
+	if (result)
 		return result;
-	}
 
 	switch (chan->type) {
 	case IIO_ANGL_VEL:
@@ -812,11 +810,9 @@ static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
 		return result;
 
 	mutex_lock(&st->lock);
-	result = pm_runtime_get_sync(pdev);
-	if (result < 0) {
-		pm_runtime_put_noidle(pdev);
+	result = pm_runtime_resume_and_get(pdev);
+	if (result)
 		goto error_write_raw_unlock;
-	}
 
 	switch (mask) {
 	case IIO_CHAN_INFO_SCALE:
@@ -930,11 +926,9 @@ inv_mpu6050_fifo_rate_store(struct device *dev, struct device_attribute *attr,
 		result = 0;
 		goto fifo_rate_fail_unlock;
 	}
-	result = pm_runtime_get_sync(pdev);
-	if (result < 0) {
-		pm_runtime_put_noidle(pdev);
+	result = pm_runtime_resume_and_get(pdev);
+	if (result)
 		goto fifo_rate_fail_unlock;
-	}
 
 	result = regmap_write(st->map, st->reg->sample_rate_div, d);
 	if (result)
@@ -1422,7 +1416,6 @@ static void inv_mpu_pm_disable(void *data)
 {
 	struct device *dev = data;
 
-	pm_runtime_put_sync_suspend(dev);
 	pm_runtime_disable(dev);
 }
 
drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c +2 -4
index e21ba778595a..2d0e8cdd4848 100644
@@ -173,11 +173,9 @@ static int inv_mpu6050_set_enable(struct iio_dev *indio_dev, bool enable)
 
 	if (enable) {
 		scan = inv_scan_query(indio_dev);
-		result = pm_runtime_get_sync(pdev);
-		if (result < 0) {
-			pm_runtime_put_noidle(pdev);
+		result = pm_runtime_resume_and_get(pdev);
+		if (result)
 			return result;
-		}
 		/*
 		 * In case autosuspend didn't trigger, turn off first not
 		 * required sensors.
Signature · 1 line
2.31.1
author maintainer
#4 lore raw

PATCH v2 2/6 iio: adc: ads1015: Balance runtime pm + pm_runtime_resume_and_get()

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

The call to pm_runtime_put_noidle() in remove() is not balancing a counter increment. Note this doesn't matter as the runtime pm core will not allow the counter to go negative. However, it is confusing to the reader so let's remove it.

The pm_runtime_resume_and_get() replacement was found using coccicheck script under review at:
https://lore.kernel.org/lkml/[email protected]/

This is a prequel to taking a closer look at the runtime pm in IIO drivers in general.

---
 drivers/iio/adc/ti-ads1015.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/iio/adc/ti-ads1015.c +1 -4
index 5b828428be77..b0352e91ac16 100644
@@ -323,9 +323,7 @@ static int ads1015_set_power_state(struct ads1015_data *data, bool on)
 	struct device *dev = regmap_get_device(data->regmap);
 
 	if (on) {
-		ret = pm_runtime_get_sync(dev);
-		if (ret < 0)
-			pm_runtime_put_noidle(dev);
+		ret = pm_runtime_resume_and_get(dev);
 	} else {
 		pm_runtime_mark_last_busy(dev);
 		ret = pm_runtime_put_autosuspend(dev);
@@ -1070,7 +1068,6 @@ static int ads1015_remove(struct i2c_client *client)
 
 	pm_runtime_disable(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
-	pm_runtime_put_noidle(&client->dev);
 
 	/* power down single shot mode */
 	return ads1015_set_conv_mode(data, ADS1015_SINGLESHOT);
Signature · 1 line
2.31.1
author maintainer
#7 lore raw

PATCH v2 3/6 iio: chemical: atlas-sensor: Balance runtime pm + pm_runtime_resume_and_get()

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

The pm_runtime_put_noidle() call in remove isn't balanced with any get, so drop it. Note this isn't a bug as the runtime pm core will not allow the reference count to go negative, making this a noop. However, it is confusing to the reader so let's drop it.

pm_runtime_resume_and_get() replacement found using the coccicheck script under review at:
https://lore.kernel.org/lkml/[email protected]/

As pm_runtime_resume_and_get() returns <= 0 take advantage of that to change the error checking to if (ret) which is more in keeping with the rest of this driver.

This is a prequel to taking a closer look at the runtime pm in IIO drivers in general.

---
 drivers/iio/chemical/atlas-sensor.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/iio/chemical/atlas-sensor.c +4 -9
index 0fdb3b29c5eb..9cb99585b6ff 100644
@@ -410,11 +410,9 @@ static int atlas_buffer_postenable(struct iio_dev *indio_dev)
 	struct atlas_data *data = iio_priv(indio_dev);
 	int ret;
 
-	ret = pm_runtime_get_sync(&data->client->dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(&data->client->dev);
+	ret = pm_runtime_resume_and_get(&data->client->dev);
+	if (ret)
 		return ret;
-	}
 
 	return atlas_set_interrupt(data, true);
 }
@@ -487,11 +485,9 @@ static int atlas_read_measurement(struct atlas_data *data, int reg, __be32 *val)
 	int suspended = pm_runtime_suspended(dev);
 	int ret;
 
-	ret = pm_runtime_get_sync(dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(dev);
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret)
 		return ret;
-	}
 
 	if (suspended)
 		msleep(data->chip->delay);
@@ -741,7 +737,6 @@ static int atlas_remove(struct i2c_client *client)
 
 	pm_runtime_disable(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
-	pm_runtime_put_noidle(&client->dev);
 
 	return atlas_set_powermode(data, 0);
 }
Signature · 1 line
2.31.1
author maintainer
#11 lore raw

PATCH v2 4/6 iio: prox: pulsed-light-v2: Fix misbalance runtime pm in error path

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

There is one path in which we don't do a runtime pm put and so leave the device enabled for ever more.

Fixes 4ac4e086fd8c ("iio: pulsedlight-lidar-lite: add runtime PM")
Cc Matt Ranostay <[email protected]>
---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +2 -1
index 822a68ae5e03..ecaeb1e11007 100644
@@ -164,7 +164,7 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
 	ret = lidar_write_control(data, LIDAR_REG_CONTROL_ACQUIRE);
 	if (ret < 0) {
 		dev_err(&client->dev, "cannot send start measurement command");
-		return ret;
+		goto err;
 	}
 
 	while (tries--) {
@@ -188,6 +188,7 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
 		}
 		ret = -EIO;
 	}
+err:
 	pm_runtime_mark_last_busy(&client->dev);
 	pm_runtime_put_autosuspend(&client->dev);
 
Signature · 1 line
2.31.1
author maintainer
#15 lore raw

PATCH v2 5/6 iio: prox: pulsed-light-v2: Use pm_runtime_resume_and_get()

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Using this new call makes it easy to handle any errors as a result of runtime resume as it exits without leaving the reference count elevated.

---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +3 -1
index ecaeb1e11007..e94f63932edb 100644
@@ -158,7 +158,9 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
 	int tries = 10;
 	int ret;
 
-	pm_runtime_get_sync(&client->dev);
+	ret = pm_runtime_resume_and_get(&client->dev);
+	if (ret < 0)
+		return ret;
 
 	/* start sample */
 	ret = lidar_write_control(data, LIDAR_REG_CONTROL_ACQUIRE);
Signature · 1 line
2.31.1
author maintainer
#19 lore raw

PATCH v2 6/6 iio: pressure: icp10100: Balance runtime pm + use pm_runtime_resume_and_get()

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

The devm_ handled runtime pm disable calls pm_runtime_put_sync_suspend() which isn't balancing a matching get call. It isn't a bug as such, because the runtime pm core doesn't decrement the reference count below zero, but it is missleading so let's drop it.

Using pm_runtime_resume_and_get() new call makes it easy to handle failures in resume as it doesn't hold a reference count if it exits with an error.

Cc Jean-Baptiste Maneyrol <[email protected]>
---
 drivers/iio/pressure/icp10100.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/pressure/icp10100.c +3 -2
index 48759fc4bf18..af4621eaa6b5 100644
@@ -250,7 +250,9 @@ static int icp10100_get_measures(struct icp10100_state *st,
 	__be16 measures[3];
 	int ret;
 
-	pm_runtime_get_sync(&st->client->dev);
+	ret = pm_runtime_resume_and_get(&st->client->dev);
+	if (ret < 0)
+		return ret;
 
 	mutex_lock(&st->lock);
 	cmd = &icp10100_cmd_measure[st->mode];
@@ -525,7 +527,6 @@ static void icp10100_pm_disable(void *data)
 {
 	struct device *dev = data;
 
-	pm_runtime_put_sync_suspend(dev);
 	pm_runtime_disable(dev);
 }
 
Signature · 1 line
2.31.1
Acked-by on v2 4/6
#12 lore raw

Re: [PATCH v2 4/6] iio: prox: pulsed-light-v2: Fix misbalance runtime pm in error path

In reply to Jonathan Cameron
Quoted 5 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

There is one path in which we don't do a runtime pm put and so leave the device enabled for ever more.

Quoted 33 lines
Fixes 4ac4e086fd8c ("iio: pulsedlight-lidar-lite: add runtime PM")
Cc Matt Ranostay <[email protected]>
---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +2 -2
index 822a68ae5e03..ecaeb1e11007 100644
@@ -164,7 +164,7 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
        ret = lidar_write_control(data, LIDAR_REG_CONTROL_ACQUIRE);
        if (ret < 0) {
                dev_err(&client->dev, "cannot send start measurement command");
-               return ret;
+               goto err;
        }
 
        while (tries--) {
@@ -188,6 +188,7 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
                }
                ret = -EIO;
        }
+err:
        pm_runtime_mark_last_busy(&client->dev);
        pm_runtime_put_autosuspend(&client->dev);
 
--

2.31.1

Acked-by on v2 3/6
#8 lore raw

Re: [PATCH v2 3/6] iio: chemical: atlas-sensor: Balance runtime pm + pm_runtime_resume_and_get()

In reply to Jonathan Cameron
Quoted 12 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

The pm_runtime_put_noidle() call in remove isn't balanced with any get, so drop it. Note this isn't a bug as the runtime pm core will not allow the reference count to go negative, making this a noop. However, it is confusing to the reader so let's drop it.

pm_runtime_resume_and_get() replacement found using the coccicheck script under review at:
https://lore.kernel.org/lkml/[email protected]/

Quoted 7 lines

As pm_runtime_resume_and_get() returns <= 0 take advantage of that to change the error checking to if (ret) which is more in keeping with the rest of this driver.

This is a prequel to taking a closer look at the runtime pm in IIO drivers in general.

Quoted 49 lines
---
 drivers/iio/chemical/atlas-sensor.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/iio/chemical/atlas-sensor.c +4 -10
index 0fdb3b29c5eb..9cb99585b6ff 100644
@@ -410,11 +410,9 @@ static int atlas_buffer_postenable(struct iio_dev *indio_dev)
        struct atlas_data *data = iio_priv(indio_dev);
        int ret;
 
-       ret = pm_runtime_get_sync(&data->client->dev);
-       if (ret < 0) {
-               pm_runtime_put_noidle(&data->client->dev);
+       ret = pm_runtime_resume_and_get(&data->client->dev);
+       if (ret)
                return ret;
-       }
 
        return atlas_set_interrupt(data, true);
 }
@@ -487,11 +485,9 @@ static int atlas_read_measurement(struct atlas_data *data, int reg, __be32 *val)
        int suspended = pm_runtime_suspended(dev);
        int ret;
 
-       ret = pm_runtime_get_sync(dev);
-       if (ret < 0) {
-               pm_runtime_put_noidle(dev);
+       ret = pm_runtime_resume_and_get(dev);
+       if (ret)
                return ret;
-       }
 
        if (suspended)
                msleep(data->chip->delay);
@@ -741,7 +737,6 @@ static int atlas_remove(struct i2c_client *client)
 
        pm_runtime_disable(&client->dev);
        pm_runtime_set_suspended(&client->dev);
-       pm_runtime_put_noidle(&client->dev);
 
        return atlas_set_powermode(data, 0);
 }
--

2.31.1

Acked-by on v2 5/6
#16 lore raw

Re: [PATCH v2 5/6] iio: prox: pulsed-light-v2: Use pm_runtime_resume_and_get()

In reply to Jonathan Cameron
Quoted 7 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Using this new call makes it easy to handle any errors as a result of runtime resume as it exits without leaving the reference count elevated.

Quoted 24 lines
---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +3 -2
index ecaeb1e11007..e94f63932edb 100644
@@ -158,7 +158,9 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
        int tries = 10;
        int ret;
 
-       pm_runtime_get_sync(&client->dev);
+       ret = pm_runtime_resume_and_get(&client->dev);
+       if (ret < 0)
+               return ret;
 
        /* start sample */
        ret = lidar_write_control(data, LIDAR_REG_CONTROL_ACQUIRE);
--

2.31.1

Reviewed-by on v2 1/6
#2 lore raw

Re: [PATCH v2 1/6] iio: imu: mpu6050: Balance runtime pm + use pm_runtime_resume_and_get()

In reply to Jonathan Cameron

Em Sun, 16 May 2021 17:20:58 +0100
Jonathan Cameron <[email protected]> escreveu:

Quoted 11 lines

From: Jonathan Cameron <[email protected]>

Remove an unblanced pm_runtime_put_sync_suspend() call
in inv_pu_pm_disable(). Not this call is not a bug, because the runtime pm core will not allow the reference counter to go negative. It is however confusing and serves no purpose.

pm_runtime_resume_and_get() case found using coccicheck script under review at:
https://lore.kernel.org/lkml/[email protected]/

Quoted 8 lines

pm_runtime_resume_and_get() returns <= 0 only so simplify related checks to bring this more inline with nearby calls.

This is a prequel to taking a closer look at the runtime pm in IIO drivers in general.

Cc Jean-Baptiste Maneyrol <[email protected]>

LGTM.

Quoted 67 lines
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c    | 19 ++++++-------------
 drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c |  6 ++----
 2 files changed, 8 insertions(+), 17 deletions(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +6 -13
index 6244a07048df..4cae3765e327 100644
@@ -570,11 +570,9 @@ static int inv_mpu6050_read_channel_data(struct iio_dev *indio_dev,
 	freq_hz = INV_MPU6050_DIVIDER_TO_FIFO_RATE(st->chip_config.divider);
 	period_us = 1000000 / freq_hz;
 
-	result = pm_runtime_get_sync(pdev);
-	if (result < 0) {
-		pm_runtime_put_noidle(pdev);
+	result = pm_runtime_resume_and_get(pdev);
+	if (result)
 		return result;
-	}
 
 	switch (chan->type) {
 	case IIO_ANGL_VEL:
@@ -812,11 +810,9 @@ static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
 		return result;
 
 	mutex_lock(&st->lock);
-	result = pm_runtime_get_sync(pdev);
-	if (result < 0) {
-		pm_runtime_put_noidle(pdev);
+	result = pm_runtime_resume_and_get(pdev);
+	if (result)
 		goto error_write_raw_unlock;
-	}
 
 	switch (mask) {
 	case IIO_CHAN_INFO_SCALE:
@@ -930,11 +926,9 @@ inv_mpu6050_fifo_rate_store(struct device *dev, struct device_attribute *attr,
 		result = 0;
 		goto fifo_rate_fail_unlock;
 	}
-	result = pm_runtime_get_sync(pdev);
-	if (result < 0) {
-		pm_runtime_put_noidle(pdev);
+	result = pm_runtime_resume_and_get(pdev);
+	if (result)
 		goto fifo_rate_fail_unlock;
-	}
 
 	result = regmap_write(st->map, st->reg->sample_rate_div, d);
 	if (result)
@@ -1422,7 +1416,6 @@ static void inv_mpu_pm_disable(void *data)
 {
 	struct device *dev = data;
 
-	pm_runtime_put_sync_suspend(dev);
 	pm_runtime_disable(dev);
 }
 
drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c +0 -0
index e21ba778595a..2d0e8cdd4848 100644
@@ -173,11 +173,9 @@ static int inv_mpu6050_set_enable(struct iio_dev *indio_dev, bool enable)
 
 	if (enable) {
 		scan = inv_scan_query(indio_dev);

drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c static int inv_mpu6050_set_enable(struct iio_dev *indio_dev, bool enable) · line 181

Quoted 10 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c +2 -4
-		result = pm_runtime_get_sync(pdev);
-		if (result < 0) {
-			pm_runtime_put_noidle(pdev);
+		result = pm_runtime_resume_and_get(pdev);
+		if (result)
 			return result;
-		}
 		/*
 		 * In case autosuspend didn't trigger, turn off first not
 		 * required sensors.

Thanks,
Mauro

Reviewed-by on v2 2/6
#5 lore raw

Re: [PATCH v2 2/6] iio: adc: ads1015: Balance runtime pm + pm_runtime_resume_and_get()

In reply to Jonathan Cameron

Em Sun, 16 May 2021 17:20:59 +0100
Jonathan Cameron <[email protected]> escreveu:

Quoted 7 lines

From: Jonathan Cameron <[email protected]>

The call to pm_runtime_put_noidle() in remove() is not balancing a counter increment. Note this doesn't matter as the runtime pm core will not allow the counter to go negative. However, it is confusing to the reader so let's remove it.

Quoted 8 lines

The pm_runtime_resume_and_get() replacement was found using coccicheck script under review at:
https://lore.kernel.org/lkml/[email protected]/

This is a prequel to taking a closer look at the runtime pm in IIO drivers in general.

LGTM.

Quoted 20 lines
---
 drivers/iio/adc/ti-ads1015.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/iio/adc/ti-ads1015.c +1 -3
index 5b828428be77..b0352e91ac16 100644
@@ -323,9 +323,7 @@ static int ads1015_set_power_state(struct ads1015_data *data, bool on)
 	struct device *dev = regmap_get_device(data->regmap);
 
 	if (on) {
-		ret = pm_runtime_get_sync(dev);
-		if (ret < 0)
-			pm_runtime_put_noidle(dev);
+		ret = pm_runtime_resume_and_get(dev);
 	} else {
 		pm_runtime_mark_last_busy(dev);
 		ret = pm_runtime_put_autosuspend(dev);

drivers/iio/adc/ti-ads1015.c static int ads1015_remove(struct i2c_client *client) · line 1073

Quoted 7 lines
drivers/iio/adc/ti-ads1015.c +0 -1
@@ -1070,7 +1068,6 @@ static int ads1015_remove(struct i2c_client *client)
 
 	pm_runtime_disable(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
-	pm_runtime_put_noidle(&client->dev);
 
 	/* power down single shot mode */
 	return ads1015_set_conv_mode(data, ADS1015_SINGLESHOT);

Thanks,
Mauro

Reviewed-by on v2 3/6
#9 lore raw

Re: [PATCH v2 3/6] iio: chemical: atlas-sensor: Balance runtime pm + pm_runtime_resume_and_get()

In reply to Jonathan Cameron

Em Sun, 16 May 2021 17:21:00 +0100
Jonathan Cameron <[email protected]> escreveu:

Quoted 15 lines

From: Jonathan Cameron <[email protected]>

The pm_runtime_put_noidle() call in remove isn't balanced with any get, so drop it. Note this isn't a bug as the runtime pm core will not allow the reference count to go negative, making this a noop. However, it is confusing to the reader so let's drop it.

pm_runtime_resume_and_get() replacement found using the coccicheck script under review at:
https://lore.kernel.org/lkml/[email protected]/

As pm_runtime_resume_and_get() returns <= 0 take advantage of that to change the error checking to if (ret) which is more in keeping with the rest of this driver.

Quoted 5 lines

This is a prequel to taking a closer look at the runtime pm in IIO drivers in general.

LGTM.

Quoted 37 lines
---
 drivers/iio/chemical/atlas-sensor.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/iio/chemical/atlas-sensor.c +4 -8
index 0fdb3b29c5eb..9cb99585b6ff 100644
@@ -410,11 +410,9 @@ static int atlas_buffer_postenable(struct iio_dev *indio_dev)
 	struct atlas_data *data = iio_priv(indio_dev);
 	int ret;
 
-	ret = pm_runtime_get_sync(&data->client->dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(&data->client->dev);
+	ret = pm_runtime_resume_and_get(&data->client->dev);
+	if (ret)
 		return ret;
-	}
 
 	return atlas_set_interrupt(data, true);
 }
@@ -487,11 +485,9 @@ static int atlas_read_measurement(struct atlas_data *data, int reg, __be32 *val)
 	int suspended = pm_runtime_suspended(dev);
 	int ret;
 
-	ret = pm_runtime_get_sync(dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(dev);
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret)
 		return ret;
-	}
 
 	if (suspended)
 		msleep(data->chip->delay);

drivers/iio/chemical/atlas-sensor.c static int atlas_remove(struct i2c_client *client) · line 742

Quoted 7 lines
drivers/iio/chemical/atlas-sensor.c +0 -1
@@ -741,7 +737,6 @@ static int atlas_remove(struct i2c_client *client)
 
 	pm_runtime_disable(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
-	pm_runtime_put_noidle(&client->dev);
 
 	return atlas_set_powermode(data, 0);
 }

Thanks,
Mauro

Reviewed-by on v2 6/6
#20 lore raw

Re: [PATCH v2 6/6] iio: pressure: icp10100: Balance runtime pm + use pm_runtime_resume_and_get()

In reply to Jonathan Cameron

Em Sun, 16 May 2021 17:21:03 +0100
Jonathan Cameron <[email protected]> escreveu:

Quoted 7 lines

From: Jonathan Cameron <[email protected]>

The devm_ handled runtime pm disable calls pm_runtime_put_sync_suspend() which isn't balancing a matching get call. It isn't a bug as such, because the runtime pm core doesn't decrement the reference count below zero, but it is missleading so let's drop it.

Quoted 6 lines

Using pm_runtime_resume_and_get() new call makes it easy to handle failures in resume as it doesn't hold a reference count if it exits with an error.

Cc Jean-Baptiste Maneyrol <[email protected]>

LGTM.

Quoted 20 lines
---
 drivers/iio/pressure/icp10100.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/pressure/icp10100.c +3 -1
index 48759fc4bf18..af4621eaa6b5 100644
@@ -250,7 +250,9 @@ static int icp10100_get_measures(struct icp10100_state *st,
 	__be16 measures[3];
 	int ret;
 
-	pm_runtime_get_sync(&st->client->dev);
+	ret = pm_runtime_resume_and_get(&st->client->dev);
+	if (ret < 0)
+		return ret;
 
 	mutex_lock(&st->lock);
 	cmd = &icp10100_cmd_measure[st->mode];

drivers/iio/pressure/icp10100.c static void icp10100_pm_disable(void *data) · line 532

Quoted 7 lines
drivers/iio/pressure/icp10100.c +0 -1
@@ -525,7 +527,6 @@ static void icp10100_pm_disable(void *data)
 {
 	struct device *dev = data;
 
-	pm_runtime_put_sync_suspend(dev);
 	pm_runtime_disable(dev);
 }
 

Thanks,
Mauro

Reviewed-by on v2 4/6
#13 lore raw

Re: [PATCH v2 4/6] iio: prox: pulsed-light-v2: Fix misbalance runtime pm in error path

In reply to Jonathan Cameron

Em Sun, 16 May 2021 17:21:01 +0100
Jonathan Cameron <[email protected]> escreveu:

Quoted 9 lines

From: Jonathan Cameron <[email protected]>

There is one path in which we don't do a runtime pm put and so leave the device enabled for ever more.

Fixes 4ac4e086fd8c ("iio: pulsedlight-lidar-lite: add runtime PM")
Cc Matt Ranostay <[email protected]>

I was unable to apply it on the top of next-20210615, although the patch looks good to me.

Quoted 18 lines
---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +1 -1
index 822a68ae5e03..ecaeb1e11007 100644
@@ -164,7 +164,7 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
 	ret = lidar_write_control(data, LIDAR_REG_CONTROL_ACQUIRE);
 	if (ret < 0) {
 		dev_err(&client->dev, "cannot send start measurement command");
-		return ret;
+		goto err;
 	}
 
 	while (tries--) {

drivers/iio/proximity/pulsedlight-lidar-lite-v2.c static int lidar_get_measurement(struct lidar_data *data, u16 *reg) · line 194

Quoted 7 lines
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +1 -0
@@ -188,6 +188,7 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
 		}
 		ret = -EIO;
 	}
+err:
 	pm_runtime_mark_last_busy(&client->dev);
 	pm_runtime_put_autosuspend(&client->dev);
 

Thanks,
Mauro

#17 lore raw

Re: [PATCH v2 5/6] iio: prox: pulsed-light-v2: Use pm_runtime_resume_and_get()

In reply to Matt Ranostay

Em Sun, 16 May 2021 13:01:29 -0700
Matt Ranostay <[email protected]> escreveu:

Quoted 10 lines · Jonathan Cameron
Quoted 7 lines

From: Jonathan Cameron <[email protected]>

Using this new call makes it easy to handle any errors as a result of runtime resume as it exits without leaving the reference count elevated.

LGTM.

Quoted 20 lines
Quoted 20 lines
---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +3 -1
index ecaeb1e11007..e94f63932edb 100644
@@ -158,7 +158,9 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
        int tries = 10;
        int ret;
 
-       pm_runtime_get_sync(&client->dev);
+       ret = pm_runtime_resume_and_get(&client->dev);
+       if (ret < 0)
+               return ret;
 
Quoted 5 lines
Quoted 5 lines
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +0 -1
        /* start sample */
        ret = lidar_write_control(data, LIDAR_REG_CONTROL_ACQUIRE);
--

2.31.1

Thanks,
Mauro

author maintainer
#3 lore raw

Re: [PATCH v2 1/6] iio: imu: mpu6050: Balance runtime pm + use pm_runtime_resume_and_get()

In reply to Mauro Carvalho Chehab
Quoted 20 lines · On Wed, 16 Jun 2021 09:15:23 +0200 Mauro Carvalho Chehab…

Em Sun, 16 May 2021 17:20:58 +0100
Jonathan Cameron <[email protected]> escreveu:

Quoted 17 lines

From: Jonathan Cameron <[email protected]>

Remove an unblanced pm_runtime_put_sync_suspend() call
in inv_pu_pm_disable(). Not this call is not a bug, because the runtime pm core will not allow the reference counter to go negative. It is however confusing and serves no purpose.

pm_runtime_resume_and_get() case found using coccicheck script under review at:
https://lore.kernel.org/lkml/[email protected]/

pm_runtime_resume_and_get() returns <= 0 only so simplify related checks to bring this more inline with nearby calls.

This is a prequel to taking a closer look at the runtime pm in IIO drivers in general.

Quoted 6 lines
Quoted 2 lines
Cc Jean-Baptiste Maneyrol <[email protected]>

LGTM.

Thanks!

Applied to the togreg branch of iio.git and pushed out as testing for 0-day to see if it can find anything we missed.

Jonathan

Quoted 84 lines
Quoted 69 lines

---
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c    | 19 ++++++-------------
 drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c |  6 ++----
 2 files changed, 8 insertions(+), 17 deletions(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +6 -13
index 6244a07048df..4cae3765e327 100644
@@ -570,11 +570,9 @@ static int inv_mpu6050_read_channel_data(struct iio_dev *indio_dev,
 	freq_hz = INV_MPU6050_DIVIDER_TO_FIFO_RATE(st->chip_config.divider);
 	period_us = 1000000 / freq_hz;
 
-	result = pm_runtime_get_sync(pdev);
-	if (result < 0) {
-		pm_runtime_put_noidle(pdev);
+	result = pm_runtime_resume_and_get(pdev);
+	if (result)
 		return result;
-	}
 
 	switch (chan->type) {
 	case IIO_ANGL_VEL:
@@ -812,11 +810,9 @@ static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
 		return result;
 
 	mutex_lock(&st->lock);
-	result = pm_runtime_get_sync(pdev);
-	if (result < 0) {
-		pm_runtime_put_noidle(pdev);
+	result = pm_runtime_resume_and_get(pdev);
+	if (result)
 		goto error_write_raw_unlock;
-	}
 
 	switch (mask) {
 	case IIO_CHAN_INFO_SCALE:
@@ -930,11 +926,9 @@ inv_mpu6050_fifo_rate_store(struct device *dev, struct device_attribute *attr,
 		result = 0;
 		goto fifo_rate_fail_unlock;
 	}
-	result = pm_runtime_get_sync(pdev);
-	if (result < 0) {
-		pm_runtime_put_noidle(pdev);
+	result = pm_runtime_resume_and_get(pdev);
+	if (result)
 		goto fifo_rate_fail_unlock;
-	}
 
 	result = regmap_write(st->map, st->reg->sample_rate_div, d);
 	if (result)
@@ -1422,7 +1416,6 @@ static void inv_mpu_pm_disable(void *data)
 {
 	struct device *dev = data;
 
-	pm_runtime_put_sync_suspend(dev);
 	pm_runtime_disable(dev);
 }
 
drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c +0 -0
index e21ba778595a..2d0e8cdd4848 100644
@@ -173,11 +173,9 @@ static int inv_mpu6050_set_enable(struct iio_dev *indio_dev, bool enable)
 
 	if (enable) {
 		scan = inv_scan_query(indio_dev);

drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c static int inv_mpu6050_set_enable(struct iio_dev *indio_dev, bool enable) · line 181

Quoted 10 lines
drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c +2 -4
-		result = pm_runtime_get_sync(pdev);
-		if (result < 0) {
-			pm_runtime_put_noidle(pdev);
+		result = pm_runtime_resume_and_get(pdev);
+		if (result)
 			return result;
-		}
 		/*
 		 * In case autosuspend didn't trigger, turn off first not
 		 * required sensors.  

Thanks,
Mauro

author maintainer Applied
#6 lore raw

Re: [PATCH v2 2/6] iio: adc: ads1015: Balance runtime pm + pm_runtime_resume_and_get()

In reply to Mauro Carvalho Chehab
Quoted 14 lines · On Wed, 16 Jun 2021 09:15:55 +0200 Mauro Carvalho Chehab…

Em Sun, 16 May 2021 17:20:59 +0100
Jonathan Cameron <[email protected]> escreveu:

Quoted 11 lines

From: Jonathan Cameron <[email protected]>

The call to pm_runtime_put_noidle() in remove() is not balancing a counter increment. Note this doesn't matter as the runtime pm core will not allow the counter to go negative. However, it is confusing to the reader so let's remove it.

The pm_runtime_resume_and_get() replacement was found using coccicheck script under review at:
https://lore.kernel.org/lkml/[email protected]/

Quoted 8 lines
Quoted 4 lines

This is a prequel to taking a closer look at the runtime pm in IIO drivers in general.

LGTM.

Applied

Quoted 33 lines
Quoted 21 lines
---
 drivers/iio/adc/ti-ads1015.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/iio/adc/ti-ads1015.c +1 -3
index 5b828428be77..b0352e91ac16 100644
@@ -323,9 +323,7 @@ static int ads1015_set_power_state(struct ads1015_data *data, bool on)
 	struct device *dev = regmap_get_device(data->regmap);
 
 	if (on) {
-		ret = pm_runtime_get_sync(dev);
-		if (ret < 0)
-			pm_runtime_put_noidle(dev);
+		ret = pm_runtime_resume_and_get(dev);
 	} else {
 		pm_runtime_mark_last_busy(dev);
 		ret = pm_runtime_put_autosuspend(dev);

drivers/iio/adc/ti-ads1015.c static int ads1015_remove(struct i2c_client *client) · line 1073

Quoted 7 lines
drivers/iio/adc/ti-ads1015.c +0 -1
@@ -1070,7 +1068,6 @@ static int ads1015_remove(struct i2c_client *client)
 
 	pm_runtime_disable(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
-	pm_runtime_put_noidle(&client->dev);
 
 	/* power down single shot mode */
 	return ads1015_set_conv_mode(data, ADS1015_SINGLESHOT);  

Thanks,
Mauro

author maintainer Applied
#10 lore raw

Re: [PATCH v2 3/6] iio: chemical: atlas-sensor: Balance runtime pm + pm_runtime_resume_and_get()

In reply to Mauro Carvalho Chehab
Quoted 21 lines · On Wed, 16 Jun 2021 09:16:20 +0200 Mauro Carvalho Chehab…

Em Sun, 16 May 2021 17:21:00 +0100
Jonathan Cameron <[email protected]> escreveu:

Quoted 18 lines

From: Jonathan Cameron <[email protected]>

The pm_runtime_put_noidle() call in remove isn't balanced with any get, so drop it. Note this isn't a bug as the runtime pm core will not allow the reference count to go negative, making this a noop. However, it is confusing to the reader so let's drop it.

pm_runtime_resume_and_get() replacement found using the coccicheck script under review at:
https://lore.kernel.org/lkml/[email protected]/

As pm_runtime_resume_and_get() returns <= 0 take advantage of that to change the error checking to if (ret) which is more in keeping with the rest of this driver.

This is a prequel to taking a closer look at the runtime pm in IIO drivers in general.

Quoted 6 lines
Quoted 2 lines

LGTM.

Applied

Quoted 50 lines
Quoted 38 lines
---
 drivers/iio/chemical/atlas-sensor.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/iio/chemical/atlas-sensor.c +4 -8
index 0fdb3b29c5eb..9cb99585b6ff 100644
@@ -410,11 +410,9 @@ static int atlas_buffer_postenable(struct iio_dev *indio_dev)
 	struct atlas_data *data = iio_priv(indio_dev);
 	int ret;
 
-	ret = pm_runtime_get_sync(&data->client->dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(&data->client->dev);
+	ret = pm_runtime_resume_and_get(&data->client->dev);
+	if (ret)
 		return ret;
-	}
 
 	return atlas_set_interrupt(data, true);
 }
@@ -487,11 +485,9 @@ static int atlas_read_measurement(struct atlas_data *data, int reg, __be32 *val)
 	int suspended = pm_runtime_suspended(dev);
 	int ret;
 
-	ret = pm_runtime_get_sync(dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(dev);
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret)
 		return ret;
-	}
 
 	if (suspended)
 		msleep(data->chip->delay);

drivers/iio/chemical/atlas-sensor.c static int atlas_remove(struct i2c_client *client) · line 742

Quoted 7 lines
drivers/iio/chemical/atlas-sensor.c +0 -1
@@ -741,7 +737,6 @@ static int atlas_remove(struct i2c_client *client)
 
 	pm_runtime_disable(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
-	pm_runtime_put_noidle(&client->dev);
 
 	return atlas_set_powermode(data, 0);
 }  

Thanks,
Mauro

author maintainer
#14 lore raw

Re: [PATCH v2 4/6] iio: prox: pulsed-light-v2: Fix misbalance runtime pm in error path

In reply to Mauro Carvalho Chehab
Quoted 13 lines · On Wed, 16 Jun 2021 09:18:42 +0200 Mauro Carvalho Chehab…

Em Sun, 16 May 2021 17:21:01 +0100
Jonathan Cameron <[email protected]> escreveu:

Quoted 9 lines

From: Jonathan Cameron <[email protected]>

There is one path in which we don't do a runtime pm put and so leave the device enabled for ever more.

Fixes 4ac4e086fd8c ("iio: pulsedlight-lidar-lite: add runtime PM")
Cc Matt Ranostay <[email protected]>
Quoted 4 lines

I was unable to apply it on the top of next-20210615, although the patch looks good to me.

Ah. This crossed with another fix for the same issue.

I'll take another look at whether the alternate fix works as well as this and revisit this one at a future date.

Thanks,

Jonathan

Quoted 31 lines
Quoted 19 lines
---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +1 -1
index 822a68ae5e03..ecaeb1e11007 100644
@@ -164,7 +164,7 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
 	ret = lidar_write_control(data, LIDAR_REG_CONTROL_ACQUIRE);
 	if (ret < 0) {
 		dev_err(&client->dev, "cannot send start measurement command");
-		return ret;
+		goto err;
 	}
 
 	while (tries--) {

drivers/iio/proximity/pulsedlight-lidar-lite-v2.c static int lidar_get_measurement(struct lidar_data *data, u16 *reg) · line 194

Quoted 7 lines
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +1 -0
@@ -188,6 +188,7 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
 		}
 		ret = -EIO;
 	}
+err:
 	pm_runtime_mark_last_busy(&client->dev);
 	pm_runtime_put_autosuspend(&client->dev);
 

Thanks,
Mauro

author maintainer Applied
#18 lore raw

Re: [PATCH v2 5/6] iio: prox: pulsed-light-v2: Use pm_runtime_resume_and_get()

In reply to Mauro Carvalho Chehab
Quoted 12 lines · On Wed, 16 Jun 2021 09:19:13 +0200 Mauro Carvalho Chehab…

Em Sun, 16 May 2021 13:01:29 -0700
Matt Ranostay <[email protected]> escreveu:

Quoted 9 lines · Jonathan Cameron
Quoted 7 lines

From: Jonathan Cameron <[email protected]>

Using this new call makes it easy to handle any errors as a result of runtime resume as it exits without leaving the reference count elevated.

Quoted 5 lines
Quoted 1 line

LGTM.

Applied.

Quoted 31 lines
Quoted 21 lines
Quoted 21 lines
---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +3 -1
index ecaeb1e11007..e94f63932edb 100644
@@ -158,7 +158,9 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
        int tries = 10;
        int ret;
 
-       pm_runtime_get_sync(&client->dev);
+       ret = pm_runtime_resume_and_get(&client->dev);
+       if (ret < 0)
+               return ret;
 
Quoted 5 lines
Quoted 5 lines
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +0 -1
        /* start sample */
        ret = lidar_write_control(data, LIDAR_REG_CONTROL_ACQUIRE);
--

2.31.1

Thanks,
Mauro

author maintainer Applied
#21 lore raw

Re: [PATCH v2 6/6] iio: pressure: icp10100: Balance runtime pm + use pm_runtime_resume_and_get()

In reply to Mauro Carvalho Chehab
Quoted 14 lines · On Wed, 16 Jun 2021 09:16:38 +0200 Mauro Carvalho Chehab…

Em Sun, 16 May 2021 17:21:03 +0100
Jonathan Cameron <[email protected]> escreveu:

Quoted 11 lines

From: Jonathan Cameron <[email protected]>

The devm_ handled runtime pm disable calls pm_runtime_put_sync_suspend() which isn't balancing a matching get call. It isn't a bug as such, because the runtime pm core doesn't decrement the reference count below zero, but it is missleading so let's drop it.

Using pm_runtime_resume_and_get() new call makes it easy to handle failures in resume as it doesn't hold a reference count if it exits with an error.

Quoted 6 lines
Quoted 2 lines
Cc Jean-Baptiste Maneyrol <[email protected]>

LGTM.

Applied.

Quoted 33 lines
Quoted 21 lines
---
 drivers/iio/pressure/icp10100.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/pressure/icp10100.c +3 -1
index 48759fc4bf18..af4621eaa6b5 100644
@@ -250,7 +250,9 @@ static int icp10100_get_measures(struct icp10100_state *st,
 	__be16 measures[3];
 	int ret;
 
-	pm_runtime_get_sync(&st->client->dev);
+	ret = pm_runtime_resume_and_get(&st->client->dev);
+	if (ret < 0)
+		return ret;
 
 	mutex_lock(&st->lock);
 	cmd = &icp10100_cmd_measure[st->mode];

drivers/iio/pressure/icp10100.c static void icp10100_pm_disable(void *data) · line 532

Quoted 7 lines
drivers/iio/pressure/icp10100.c +0 -1
@@ -525,7 +527,6 @@ static void icp10100_pm_disable(void *data)
 {
 	struct device *dev = data;
 
-	pm_runtime_put_sync_suspend(dev);
 	pm_runtime_disable(dev);
 }
 

Thanks,
Mauro