diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2022-02-13 13:30:11 +0100 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-02-13 17:18:45 +0100 |
commit | 261ecd47b4d17c186aa17202f8ee325f380610e0 (patch) | |
tree | e4fc5b8ec5236cd44834139a6a7d042400583c8b /drivers/iio/proximity/as3935.c | |
parent | iio: adc: cpcap-adc: remove redundant assignment to variable cal_data_diff (diff) | |
download | linux-261ecd47b4d17c186aa17202f8ee325f380610e0.tar.xz linux-261ecd47b4d17c186aa17202f8ee325f380610e0.zip |
iio: as3935: Use devm_delayed_work_autocancel()
Use devm_delayed_work_autocancel() instead of hand writing it.
It saves a few lines of code.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/8d5c50f191bd8f751849d72127f83b14a7636d64.1644755396.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/proximity/as3935.c')
-rw-r--r-- | drivers/iio/proximity/as3935.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c index bd7595db31d4..00e06491b188 100644 --- a/drivers/iio/proximity/as3935.c +++ b/drivers/iio/proximity/as3935.c @@ -12,6 +12,7 @@ #include <linux/interrupt.h> #include <linux/delay.h> #include <linux/workqueue.h> +#include <linux/devm-helpers.h> #include <linux/mutex.h> #include <linux/err.h> #include <linux/irq.h> @@ -344,14 +345,6 @@ static SIMPLE_DEV_PM_OPS(as3935_pm_ops, as3935_suspend, as3935_resume); #define AS3935_PM_OPS NULL #endif -static void as3935_stop_work(void *data) -{ - struct iio_dev *indio_dev = data; - struct as3935_state *st = iio_priv(indio_dev); - - cancel_delayed_work_sync(&st->work); -} - static int as3935_probe(struct spi_device *spi) { struct device *dev = &spi->dev; @@ -432,8 +425,7 @@ static int as3935_probe(struct spi_device *spi) calibrate_as3935(st); - INIT_DELAYED_WORK(&st->work, as3935_event_work); - ret = devm_add_action(dev, as3935_stop_work, indio_dev); + ret = devm_delayed_work_autocancel(dev, &st->work, as3935_event_work); if (ret) return ret; |