diff options
author | Nuno Sá <nuno.sa@analog.com> | 2020-09-15 14:02:56 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2020-09-16 19:06:10 +0100 |
commit | 460c7b4c1ab3699ad63720e2f19341568a7f1edc (patch) | |
tree | 837e3754305dd0b5d99bf7374571cbdb3cc2e2d8 /drivers/staging/iio | |
parent | 514f641b3b2af794df90d61f4346e5858177665d (diff) |
staging: iio: adis16203: Use Managed device functions
Use the adis managed device functions to setup the buffer and the trigger.
The ultimate goal will be to completely drop the non devm version from
the lib.
Since we are here, drop the `.remove` callback by further using devm
functions.
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20200915120258.161587-9-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r-- | drivers/staging/iio/accel/adis16203.c | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/staging/iio/accel/adis16203.c index c7798908ef0e..b68304da288b 100644 --- a/drivers/staging/iio/accel/adis16203.c +++ b/drivers/staging/iio/accel/adis16203.c @@ -286,35 +286,16 @@ static int adis16203_probe(struct spi_device *spi) if (ret) return ret; - ret = adis_setup_buffer_and_trigger(st, indio_dev, NULL); + ret = devm_adis_setup_buffer_and_trigger(st, indio_dev, NULL); if (ret) return ret; /* Get the device into a sane initial state */ ret = adis_initial_startup(st); if (ret) - goto error_cleanup_buffer_trigger; - - ret = iio_device_register(indio_dev); - if (ret) - goto error_cleanup_buffer_trigger; - - return 0; - -error_cleanup_buffer_trigger: - adis_cleanup_buffer_and_trigger(st, indio_dev); - return ret; -} - -static int adis16203_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct adis *st = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - adis_cleanup_buffer_and_trigger(st, indio_dev); + return ret; - return 0; + return devm_iio_device_register(&spi->dev, indio_dev); } static const struct of_device_id adis16203_of_match[] = { @@ -330,7 +311,6 @@ static struct spi_driver adis16203_driver = { .of_match_table = adis16203_of_match, }, .probe = adis16203_probe, - .remove = adis16203_remove, }; module_spi_driver(adis16203_driver); |