diff options
author | Alexandru Ardelean <aardelean@deviqon.com> | 2021-08-23 14:22:02 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-09-14 14:00:31 +0300 |
commit | 5363c6c17b1014f696bf0b2984af4b694062ce8f (patch) | |
tree | 5d7d2fee4cf5b10a9251c4c7ae39aac7ed1a8dcd /drivers/iio/gyro | |
parent | 82bcb7fb649844a561ff1ac2e2ace4252bdff793 (diff) | |
download | linux-5363c6c17b1014f696bf0b2984af4b694062ce8f.tar.xz |
iio: st_sensors: remove st_sensors_power_disable() function
This change converts the st_sensors_power_enable() function to use
devm_add_action_or_reset() handlers to register regulator_disable hooks for
when the drivers get unloaded.
The parent device of the IIO device object is used. This is based on the
assumption that all other devm_ calls in the ST sensors use this reference.
This makes the st_sensors_power_disable() un-needed.
Removing this also changes unload order a bit, as all ST drivers would call
st_sensors_power_disable() first and iio_device_unregister() after that.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210823112204.243255-4-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/gyro')
-rw-r--r-- | drivers/iio/gyro/st_gyro_i2c.c | 13 | ||||
-rw-r--r-- | drivers/iio/gyro/st_gyro_spi.c | 13 |
2 files changed, 2 insertions, 24 deletions
diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c index a8164fe48b85..0bd80dfd389f 100644 --- a/drivers/iio/gyro/st_gyro_i2c.c +++ b/drivers/iio/gyro/st_gyro_i2c.c @@ -90,16 +90,7 @@ static int st_gyro_i2c_probe(struct i2c_client *client, if (err) return err; - err = st_gyro_common_probe(indio_dev); - if (err < 0) - goto st_gyro_power_off; - - return 0; - -st_gyro_power_off: - st_sensors_power_disable(indio_dev); - - return err; + return st_gyro_common_probe(indio_dev); } static int st_gyro_i2c_remove(struct i2c_client *client) @@ -108,8 +99,6 @@ static int st_gyro_i2c_remove(struct i2c_client *client) st_gyro_common_remove(indio_dev); - st_sensors_power_disable(indio_dev); - return 0; } diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c index 9d8916871b4b..f74b09fa5cde 100644 --- a/drivers/iio/gyro/st_gyro_spi.c +++ b/drivers/iio/gyro/st_gyro_spi.c @@ -94,16 +94,7 @@ static int st_gyro_spi_probe(struct spi_device *spi) if (err) return err; - err = st_gyro_common_probe(indio_dev); - if (err < 0) - goto st_gyro_power_off; - - return 0; - -st_gyro_power_off: - st_sensors_power_disable(indio_dev); - - return err; + return st_gyro_common_probe(indio_dev); } static int st_gyro_spi_remove(struct spi_device *spi) @@ -112,8 +103,6 @@ static int st_gyro_spi_remove(struct spi_device *spi) st_gyro_common_remove(indio_dev); - st_sensors_power_disable(indio_dev); - return 0; } |