lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250825135401.1765847-1-sakari.ailus@linux.intel.com>
Date: Mon, 25 Aug 2025 16:53:49 +0300
From: Sakari Ailus <sakari.ailus@...ux.intel.com>
To: Jonathan Cameron <jic23@...nel.org>,
	David Lechner <dlechner@...libre.com>,
	Nuno Sá <nuno.sa@...log.com>,
	Andy Shevchenko <andy@...nel.org>,
	Linus Walleij <linus.walleij@...aro.org>,
	Eugen Hristev <eugen.hristev@...aro.org>,
	Nicolas Ferre <nicolas.ferre@...rochip.com>,
	Alexandre Belloni <alexandre.belloni@...tlin.com>,
	Claudiu Beznea <claudiu.beznea@...on.dev>,
	Cai Huoqing <cai.huoqing@...ux.dev>,
	Haibo Chen <haibo.chen@....com>,
	Shawn Guo <shawnguo@...nel.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Pengutronix Kernel Team <kernel@...gutronix.de>,
	Fabio Estevam <festevam@...il.com>,
	Marek Vasut <marek.vasut@...il.com>,
	Geert Uytterhoeven <geert+renesas@...der.be>,
	Magnus Damm <magnus.damm@...il.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>,
	Maxime Coquelin <mcoquelin.stm32@...il.com>,
	Alexandre Torgue <alexandre.torgue@...s.st.com>,
	Chen-Yu Tsai <wens@...e.org>,
	Jernej Skrabec <jernej.skrabec@...il.com>,
	Samuel Holland <samuel@...lland.org>,
	Francesco Dolcini <francesco@...cini.it>,
	João Paulo Gonçalves <jpaulo.silvagoncalves@...il.com>,
	Rui Miguel Silva <rmfrfs@...il.com>,
	Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@....com>,
	Subhajit Ghosh <subhajit.ghosh@...aklogic.com>,
	Gerald Loacker <gerald.loacker@...fvision.net>,
	Andreas Klinger <ak@...klinger.de>,
	Crt Mori <cmo@...exis.com>,
	Waqar Hameed <waqar.hameed@...s.com>,
	Julien Stephan <jstephan@...libre.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Sakari Ailus <sakari.ailus@...ux.intel.com>,
	Greg KH <gregkh@...uxfoundation.org>,
	Bo Liu <liubo03@...pur.com>,
	Al Viro <viro@...iv.linux.org.uk>,
	Sean Nyekjaer <sean@...nix.com>,
	Frank Li <Frank.Li@....com>,
	Han Xu <han.xu@....com>,
	Rayyan Ansari <rayyan@...ari.sh>,
	Gustavo Vaz <gustavo.vaz@....br>,
	Matti Vaittinen <mazziesaccount@...il.com>,
	Alexandru Ardelean <aardelean@...libre.com>,
	"Jiri Slaby (SUSE)" <jirislaby@...nel.org>,
	"Rob Herring (Arm)" <robh@...nel.org>,
	Fabrice Gasnier <fabrice.gasnier@...s.st.com>,
	Uwe Kleine-König <u.kleine-koenig@...libre.com>,
	Olivier Moysan <olivier.moysan@...s.st.com>,
	Christophe JAILLET <christophe.jaillet@...adoo.fr>,
	Marcelo Schmitt <marcelo.schmitt1@...il.com>,
	Vasileios Amoiridis <vassilisamir@...il.com>,
	Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
	Hans de Goede <hansg@...nel.org>,
	Javier Carrasco <javier.carrasco.cruz@...il.com>,
	Abhash Jha <abhashkumarjha123@...il.com>,
	chuguangqing <chuguangqing@...pur.com>,
	Shreeya Patel <shreeya.patel@...labora.com>,
	Per-Daniel Olsson <perdaniel.olsson@...s.com>,
	Barnabás Czémán <barnabas.czeman@...nlining.org>,
	Neil Armstrong <neil.armstrong@...aro.org>,
	David Laight <david.laight@...lab.com>,
	Jakob Hauser <jahau@...ketmail.com>
Cc: linux-iio@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	imx@...ts.linux.dev,
	linux-renesas-soc@...r.kernel.org,
	linux-stm32@...md-mailman.stormreply.com,
	linux-sunxi@...ts.linux.dev
Subject: [PATCH v3 00/12] iio: Remove redundant pm_runtime_mark_last_busy() calls

Hello everyone,

Late last year I posted a set to switch to __pm_runtime_mark_last_busy()
and gradually get rid of explicit pm_runtime_mark_last_busy() calls in
drivers, embedding them in the appropriate pm_runtime_*autosuspend*()
calls. The overall feedback I got at the time was that this is an
unnecessary intermediate step, and removing the
pm_runtime_mark_last_busy() calls can be done after adding them to the
relevant Runtime PM autosuspend related functions. The latter part has
been done and is present in v6.17-rc1.

These patches are on next-20250825.

It'd be nice to merge these as fixes for 6.17.

since v2:

- Drop some unneeded newlines.

- Further clean up stm32_dac_set_enable_state().

- Avoid #ifdefs in bmc150_magn_set_power_state() by assuming
  pm_runtime_put_autosuspend() won't meaningfully fail (and what would you
  do about it anyway?).

since v1:

- Drop unneeded braces.

- Further rework call sites that simply assigned a local variable (ret) to
  return it, by removing that local variable and the redundant else
  clause.

The diff from rebased v2
(<20250708231144.971170-1-sakari.ailus@...ux.intel.com>) for iio patches
is:

diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
index fe1783d439de..3c5d1560b163 100644
--- a/drivers/iio/accel/bmc150-accel-core.c
+++ b/drivers/iio/accel/bmc150-accel-core.c
@@ -336,7 +336,6 @@ static int bmc150_accel_set_power_state(struct bmc150_accel_data *data, bool on)
 		ret = pm_runtime_resume_and_get(dev);
 	else
 		ret = pm_runtime_put_autosuspend(dev);
-
 	if (ret < 0) {
 		dev_err(dev,
 			"Failed: %s for %d\n", __func__, on);
diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index 393294df02db..15172ba2972c 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -228,7 +228,6 @@ static int mma8452_set_runtime_pm_state(struct i2c_client *client, bool on)
 		ret = pm_runtime_resume_and_get(&client->dev);
 	else
 		ret = pm_runtime_put_autosuspend(&client->dev);
-
 	if (ret < 0) {
 		dev_err(&client->dev,
 			"failed to change power state to %d\n", on);
diff --git a/drivers/iio/accel/mma9551_core.c b/drivers/iio/accel/mma9551_core.c
index 247c2eda8420..2ccb1fb19b96 100644
--- a/drivers/iio/accel/mma9551_core.c
+++ b/drivers/iio/accel/mma9551_core.c
@@ -673,7 +673,6 @@ int mma9551_set_power_state(struct i2c_client *client, bool on)
 		ret = pm_runtime_resume_and_get(&client->dev);
 	else
 		ret = pm_runtime_put_autosuspend(&client->dev);
-
 	if (ret < 0) {
 		dev_err(&client->dev,
 			"failed to change power state to %d\n", on);
diff --git a/drivers/iio/dac/stm32-dac.c b/drivers/iio/dac/stm32-dac.c
index 0988c991cf60..e8688f9d6df7 100644
--- a/drivers/iio/dac/stm32-dac.c
+++ b/drivers/iio/dac/stm32-dac.c
@@ -82,9 +82,9 @@ 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;
+		goto err_pm_put;
 	}
 
 	/*
@@ -95,14 +95,8 @@ 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_put_autosuspend(dev);
-
-	return 0;
-
-err_put_pm:
-	if (enable)
-		pm_runtime_put_autosuspend(dev);
+err_pm_put:
+	pm_runtime_put_autosuspend(dev);
 
 	return ret;
 }
diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c
index 7c5fef79ad04..6a73f6e2f1f0 100644
--- a/drivers/iio/magnetometer/bmc150_magn.c
+++ b/drivers/iio/magnetometer/bmc150_magn.c
@@ -257,20 +257,17 @@ static int bmc150_magn_set_power_mode(struct bmc150_magn_data *data,
 
 static int bmc150_magn_set_power_state(struct bmc150_magn_data *data, bool on)
 {
-#ifdef CONFIG_PM
-	int ret;
+	int ret = 0;
 
 	if (on)
 		ret = pm_runtime_resume_and_get(data->dev);
 	else
-		ret = pm_runtime_put_autosuspend(data->dev);
-
+		pm_runtime_put_autosuspend(data->dev);
 	if (ret < 0) {
 		dev_err(data->dev,
 			"failed to change power state to %d\n", on);
 		return ret;
 	}
-#endif
 
 	return 0;
 }


Sakari Ailus (12):
  iio: accel: Remove redundant pm_runtime_mark_last_busy() calls
  iio: adc: Remove redundant pm_runtime_mark_last_busy() calls
  iio: chemical: Remove redundant pm_runtime_mark_last_busy() calls
  iio: common: Remove redundant pm_runtime_mark_last_busy() calls
  iio: dac: Remove redundant pm_runtime_mark_last_busy() calls
  iio: gyro: Remove redundant pm_runtime_mark_last_busy() calls
  iio: imu: Remove redundant pm_runtime_mark_last_busy() calls
  iio: light: Remove redundant pm_runtime_mark_last_busy() calls
  iio: magnetometer: Remove redundant pm_runtime_mark_last_busy() calls
  iio: pressure: Remove redundant pm_runtime_mark_last_busy() calls
  iio: proximity: Remove redundant pm_runtime_mark_last_busy() calls
  iio: temperature: Remove redundant pm_runtime_mark_last_busy() calls

 drivers/iio/accel/bmc150-accel-core.c         |  7 ++-----
 drivers/iio/accel/bmi088-accel-core.c         |  3 ---
 drivers/iio/accel/fxls8962af-core.c           |  1 -
 drivers/iio/accel/kxcjk-1013.c                |  4 +---
 drivers/iio/accel/kxsd9.c                     |  3 ---
 drivers/iio/accel/mma8452.c                   |  7 ++-----
 drivers/iio/accel/mma9551_core.c              |  5 +----
 drivers/iio/accel/msa311.c                    |  6 ------
 drivers/iio/adc/ab8500-gpadc.c                |  1 -
 drivers/iio/adc/at91-sama5d2_adc.c            | 13 +------------
 drivers/iio/adc/imx8qxp-adc.c                 |  2 --
 drivers/iio/adc/imx93_adc.c                   |  1 -
 drivers/iio/adc/rcar-gyroadc.c                |  8 +++-----
 drivers/iio/adc/rzg2l_adc.c                   |  2 --
 drivers/iio/adc/stm32-adc-core.c              |  1 -
 drivers/iio/adc/stm32-adc.c                   |  7 -------
 drivers/iio/adc/sun4i-gpadc-iio.c             |  2 --
 drivers/iio/adc/ti-ads1015.c                  |  6 ++----
 drivers/iio/adc/ti-ads1100.c                  |  1 -
 drivers/iio/adc/ti-ads1119.c                  |  2 --
 drivers/iio/chemical/atlas-sensor.c           |  2 --
 drivers/iio/chemical/bme680_core.c            |  3 ---
 .../common/hid-sensors/hid-sensor-trigger.c   |  1 -
 drivers/iio/dac/stm32-dac.c                   | 19 ++++---------------
 drivers/iio/gyro/bmg160_core.c                |  4 +---
 drivers/iio/gyro/fxas21002c_core.c            |  2 --
 drivers/iio/gyro/mpu3050-core.c               |  3 ---
 drivers/iio/gyro/mpu3050-i2c.c                |  1 -
 .../iio/imu/inv_icm42600/inv_icm42600_accel.c |  5 -----
 .../imu/inv_icm42600/inv_icm42600_buffer.c    |  1 -
 .../iio/imu/inv_icm42600/inv_icm42600_gyro.c  |  5 -----
 .../iio/imu/inv_icm42600/inv_icm42600_temp.c  |  1 -
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c    |  6 ------
 drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c |  1 -
 drivers/iio/imu/kmx61.c                       |  6 ++----
 drivers/iio/light/apds9306.c                  |  2 --
 drivers/iio/light/apds9960.c                  |  1 -
 drivers/iio/light/bh1780.c                    |  1 -
 drivers/iio/light/gp2ap002.c                  |  2 --
 drivers/iio/light/isl29028.c                  | 11 +++--------
 drivers/iio/light/ltrf216a.c                  |  1 -
 drivers/iio/light/pa12203001.c                | 11 +++--------
 drivers/iio/light/rpr0521.c                   |  6 ++----
 drivers/iio/light/tsl2583.c                   | 12 +++---------
 drivers/iio/light/tsl2591.c                   |  2 --
 drivers/iio/light/us5182d.c                   | 12 +++---------
 drivers/iio/light/vcnl4000.c                  | 11 +++--------
 drivers/iio/light/vcnl4035.c                  | 11 +++--------
 drivers/iio/magnetometer/ak8974.c             |  2 --
 drivers/iio/magnetometer/ak8975.c             |  1 -
 drivers/iio/magnetometer/als31300.c           |  2 --
 drivers/iio/magnetometer/bmc150_magn.c        | 13 ++++---------
 drivers/iio/magnetometer/tmag5273.c           |  2 --
 drivers/iio/magnetometer/yamaha-yas530.c      |  2 --
 drivers/iio/pressure/bmp280-core.c            |  5 -----
 drivers/iio/pressure/icp10100.c               |  1 -
 drivers/iio/pressure/mpl115.c                 |  2 --
 drivers/iio/pressure/zpa2326.c                |  2 --
 .../iio/proximity/pulsedlight-lidar-lite-v2.c |  1 -
 drivers/iio/proximity/srf04.c                 |  4 +---
 drivers/iio/temperature/mlx90614.c            |  1 -
 drivers/iio/temperature/mlx90632.c            |  1 -
 drivers/iio/temperature/mlx90635.c            |  1 -
 63 files changed, 44 insertions(+), 221 deletions(-)

-- 
2.47.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ