[PATCH 1/6] iio: imu: inv_icm42600: Use inv_icm42600_disable_vddio_reg()

Sean Nyekjaer posted 6 patches 3 months ago
There is a newer version of this series
[PATCH 1/6] iio: imu: inv_icm42600: Use inv_icm42600_disable_vddio_reg()
Posted by Sean Nyekjaer 3 months ago
Replace direct calls to regulator_disable() with the existing
inv_icm42600_disable_vddio_reg() helper. This improves consistency
and ensures any future changes to the disable logic are centralized.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
---
 drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
index a4d42e7e21807f7954def431e9cf03dffaa5bd5e..69496d1c1ff73132f5e7bd076d18a62c293285a2 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
@@ -892,7 +892,7 @@ static int inv_icm42600_suspend(struct device *dev)
 
 	/* disable vddio regulator if chip is sleeping */
 	if (!wakeup)
-		regulator_disable(st->vddio_supply);
+		inv_icm42600_disable_vddio_reg(st);
 
 out_unlock:
 	mutex_unlock(&st->lock);
@@ -973,7 +973,7 @@ static int inv_icm42600_runtime_suspend(struct device *dev)
 	if (ret)
 		goto error_unlock;
 
-	regulator_disable(st->vddio_supply);
+	inv_icm42600_disable_vddio_reg(st);
 
 error_unlock:
 	mutex_unlock(&st->lock);

-- 
2.50.0
Re: [PATCH 1/6] iio: imu: inv_icm42600: Use inv_icm42600_disable_vddio_reg()
Posted by Jonathan Cameron 2 months, 3 weeks ago
On Wed, 09 Jul 2025 14:35:09 +0200
Sean Nyekjaer <sean@geanix.com> wrote:

> Replace direct calls to regulator_disable() with the existing
> inv_icm42600_disable_vddio_reg() helper. This improves consistency
> and ensures any future changes to the disable logic are centralized.
> 
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>

That function only exists to match type for the devm_ callback
at the cost of using type safety.  So I'm not sure loosing type
safety in more of the code is a good direction to go in.

> ---
>  drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
> index a4d42e7e21807f7954def431e9cf03dffaa5bd5e..69496d1c1ff73132f5e7bd076d18a62c293285a2 100644
> --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
> +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
> @@ -892,7 +892,7 @@ static int inv_icm42600_suspend(struct device *dev)
>  
>  	/* disable vddio regulator if chip is sleeping */
>  	if (!wakeup)
> -		regulator_disable(st->vddio_supply);
> +		inv_icm42600_disable_vddio_reg(st);
>  
>  out_unlock:
>  	mutex_unlock(&st->lock);
> @@ -973,7 +973,7 @@ static int inv_icm42600_runtime_suspend(struct device *dev)
>  	if (ret)
>  		goto error_unlock;
>  
> -	regulator_disable(st->vddio_supply);
> +	inv_icm42600_disable_vddio_reg(st);
>  
>  error_unlock:
>  	mutex_unlock(&st->lock);
>