Message ID | 20200915093345.85614-8-nuno.sa@analog.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Use ADIS devm functions for trigger/buffer setup | expand |
On Tue, 15 Sep 2020 11:33:42 +0200 Nuno Sá <nuno.sa@analog.com> wrote: > 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. > > Signed-off-by: Nuno Sá <nuno.sa@analog.com> > --- > drivers/iio/imu/adis16480.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c > index 1eb4f98076f1..b6a129a70d4b 100644 > --- a/drivers/iio/imu/adis16480.c > +++ b/drivers/iio/imu/adis16480.c > @@ -1264,20 +1264,18 @@ static int adis16480_probe(struct spi_device *spi) > st->clk_freq = st->chip_info->int_clk; > } > > - ret = adis_setup_buffer_and_trigger(&st->adis, indio_dev, NULL); > + ret = devm_adis_setup_buffer_and_trigger(&st->adis, indio_dev, NULL); > if (ret) > goto error_clk_disable_unprepare; > > ret = iio_device_register(indio_dev); > if (ret) > - goto error_cleanup_buffer; > + goto error_clk_disable_unprepare; > > adis16480_debugfs_init(indio_dev); > > return 0; > > -error_cleanup_buffer: > - adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); > error_clk_disable_unprepare: > clk_disable_unprepare(st->ext_clk); > error_stop_device: > @@ -1293,7 +1291,6 @@ static int adis16480_remove(struct spi_device *spi) > iio_device_unregister(indio_dev); > adis16480_stop_device(indio_dev); > > - adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); This change the remove order so that it will not be a reverse of the order seen in probe. Perhaps you can solve that by using devm_add_action_or_reset() calls to handle the few other remaining things in remove? Thanks, Jonathan > clk_disable_unprepare(st->ext_clk); > > return 0;
diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c index 1eb4f98076f1..b6a129a70d4b 100644 --- a/drivers/iio/imu/adis16480.c +++ b/drivers/iio/imu/adis16480.c @@ -1264,20 +1264,18 @@ static int adis16480_probe(struct spi_device *spi) st->clk_freq = st->chip_info->int_clk; } - ret = adis_setup_buffer_and_trigger(&st->adis, indio_dev, NULL); + ret = devm_adis_setup_buffer_and_trigger(&st->adis, indio_dev, NULL); if (ret) goto error_clk_disable_unprepare; ret = iio_device_register(indio_dev); if (ret) - goto error_cleanup_buffer; + goto error_clk_disable_unprepare; adis16480_debugfs_init(indio_dev); return 0; -error_cleanup_buffer: - adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); error_clk_disable_unprepare: clk_disable_unprepare(st->ext_clk); error_stop_device: @@ -1293,7 +1291,6 @@ static int adis16480_remove(struct spi_device *spi) iio_device_unregister(indio_dev); adis16480_stop_device(indio_dev); - adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); clk_disable_unprepare(st->ext_clk); return 0;
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. Signed-off-by: Nuno Sá <nuno.sa@analog.com> --- drivers/iio/imu/adis16480.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)