Skip to contentSkip to conversation

iio: dac: Remove redundant pm_runtime_mark_last_busy() calls

PATCH In review Sakari Ailus 3 participants 3 messages Aug 28, 2025 – Aug 30, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 iio: dac: Remove redundant pm_runtime_mark_last_busy() calls

pm_runtime_put_autosuspend(), pm_runtime_put_sync_autosuspend(), pm_runtime_autosuspend() and pm_request_autosuspend() now include a call to pm_runtime_mark_last_busy(). Remove the now-reduntant explicit call to pm_runtime_mark_last_busy().

Also clean up error handling in stm32_dac_set_enable_state().

---
since v4:

- Rework error handling.

 drivers/iio/dac/stm32-dac.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
drivers/iio/dac/stm32-dac.c +5 -14
index 344388338d9b..b860e18d52a1 100644
@@ -82,9 +82,11 @@ static int stm32_dac_set_enable_state(struct iio_dev *indio_dev, int ch,
 
 	ret = regmap_update_bits(dac->common->regmap, STM32_DAC_CR, msk, en);
 	mutex_unlock(&dac->lock);
-	if (ret < 0) {
+	if (ret) {
 		dev_err(&indio_dev->dev, "%s failed\n", str_enable_disable(en));
-		goto err_put_pm;
+		if (enable)
+			pm_runtime_put_autosuspend(dev);
+		return ret;
 	}
 
 	/*
@@ -95,20 +97,10 @@ static int stm32_dac_set_enable_state(struct iio_dev *indio_dev, int ch,
 	if (en && dac->common->hfsel)
 		udelay(1);
 
-	if (!enable) {
-		pm_runtime_mark_last_busy(dev);
+	if (!enable)
 		pm_runtime_put_autosuspend(dev);
-	}
 
 	return 0;
-
-err_put_pm:
-	if (enable) {
-		pm_runtime_mark_last_busy(dev);
-		pm_runtime_put_autosuspend(dev);
-	}
-
-	return ret;
 }
 
 static int stm32_dac_get_value(struct stm32_dac *dac, int channel, int *val)
@@ -349,7 +341,6 @@ static int stm32_dac_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_pm_put;
 
-	pm_runtime_mark_last_busy(dev);
 	pm_runtime_put_autosuspend(dev);
 
 	return 0;
Signature · 1 line
2.47.2
Reviewed-by on v5 1/1
#1 lore raw
Quoted 4 lines · Sakari Ailus

pm_runtime_put_autosuspend(), pm_runtime_put_sync_autosuspend(), pm_runtime_autosuspend() and pm_request_autosuspend() now include a call to pm_runtime_mark_last_busy(). Remove the now-reduntant explicit call to

redundant

Quoted 3 lines

pm_runtime_mark_last_busy().

Also clean up error handling in stm32_dac_set_enable_state().

Code looks good to me in this version

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#2 lore raw
Quoted 8 lines · On Thu, 28 Aug 2025 17:43:19 +0300 Andy Shevchenko <[email protected]>…
Quoted 4 lines · Sakari Ailus

pm_runtime_put_autosuspend(), pm_runtime_put_sync_autosuspend(), pm_runtime_autosuspend() and pm_request_autosuspend() now include a call to pm_runtime_mark_last_busy(). Remove the now-reduntant explicit call to

redundant

Fixed up that whilst applying.

Thanks,

Jonathan

Quoted 9 lines
Quoted 4 lines

pm_runtime_mark_last_busy().

Also clean up error handling in stm32_dac_set_enable_state().

Code looks good to me in this version