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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250713153227.08af0a54@jic23-huawei>
Date: Sun, 13 Jul 2025 15:32:27 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Sean Nyekjaer <sean@...nix.com>
Cc: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@....com>, David Lechner
 <dlechner@...libre.com>, Nuno Sá <nuno.sa@...log.com>, Andy
 Shevchenko <andy@...nel.org>, linux-iio@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/6] iio: imu: inv_icm42600: Avoid configuring if
 already pm_runtime suspended

On Wed, 09 Jul 2025 14:35:14 +0200
Sean Nyekjaer <sean@...nix.com> wrote:

> Do as in suspend, skip resume configuration steps if the device is already
> pm_runtime suspended. This avoids reconfiguring a device that is already
> in the correct low-power state and ensures that pm_runtimeM handles the
> power state transitions properly.
> 
> Fixes: 31c24c1e93c3 ("iio: imu: inv_icm42600: add core of new inv_icm42600 driver")
> Signed-off-by: Sean Nyekjaer <sean@...nix.com>
> ---

Not really related to what you have here, but this code would really
benefit from using guard(mutex)()

Jonathan

>  drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
> index 37b3a7754da1c4e381e38c9871e55a941e19cef4..d745a40b042e1c86b232aaae0820942d11d51c79 100644
> --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
> +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
> @@ -824,17 +824,15 @@ static int inv_icm42600_suspend(struct device *dev)
>  	struct device *accel_dev;
>  	bool wakeup;
>  	int accel_conf;
> -	int ret;
> +	int ret = 0;
>  
>  	mutex_lock(&st->lock);
>  
>  	st->suspended.gyro = st->conf.gyro.mode;
>  	st->suspended.accel = st->conf.accel.mode;
>  	st->suspended.temp = st->conf.temp_en;
> -	if (pm_runtime_suspended(dev)) {
> -		ret = 0;
> +	if (pm_runtime_suspended(dev))
>  		goto out_unlock;
> -	}
>  
>  	/* disable FIFO data streaming */
>  	if (st->fifo.on) {
> @@ -887,10 +885,13 @@ static int inv_icm42600_resume(struct device *dev)
>  	struct inv_icm42600_sensor_state *accel_st = iio_priv(st->indio_accel);
>  	struct device *accel_dev;
>  	bool wakeup;
> -	int ret;
> +	int ret = 0;
>  
>  	mutex_lock(&st->lock);
>  
> +	if (pm_runtime_suspended(dev))
> +		goto out_unlock;
> +
>  	/* check wakeup capability */
>  	accel_dev = &st->indio_accel->dev;
>  	wakeup = st->apex.on && device_may_wakeup(accel_dev);
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ