[PATCH 03/10] iio: adis16136: Use Managed device functions

Nuno Sá nuno.sa at analog.com
Tue Sep 15 09:33:38 UTC 2020


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 at analog.com>
---
 drivers/iio/gyro/adis16136.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c
index d8a96f6bbae2..a4b060d9d23f 100644
--- a/drivers/iio/gyro/adis16136.c
+++ b/drivers/iio/gyro/adis16136.c
@@ -552,13 +552,13 @@ static int adis16136_probe(struct spi_device *spi)
 	if (ret)
 		return ret;
 
-	ret = adis_setup_buffer_and_trigger(&adis16136->adis, indio_dev, NULL);
+	ret = devm_adis_setup_buffer_and_trigger(&adis16136->adis, indio_dev, NULL);
 	if (ret)
 		return ret;
 
 	ret = adis16136_initial_setup(indio_dev);
 	if (ret)
-		goto error_cleanup_buffer;
+		return ret;
 
 	ret = iio_device_register(indio_dev);
 	if (ret)
@@ -570,21 +570,16 @@ static int adis16136_probe(struct spi_device *spi)
 
 error_stop_device:
 	adis16136_stop_device(indio_dev);
-error_cleanup_buffer:
-	adis_cleanup_buffer_and_trigger(&adis16136->adis, indio_dev);
 	return ret;
 }
 
 static int adis16136_remove(struct spi_device *spi)
 {
 	struct iio_dev *indio_dev = spi_get_drvdata(spi);
-	struct adis16136 *adis16136 = iio_priv(indio_dev);
 
 	iio_device_unregister(indio_dev);
 	adis16136_stop_device(indio_dev);
 
-	adis_cleanup_buffer_and_trigger(&adis16136->adis, indio_dev);
-
 	return 0;
 }
 
-- 
2.28.0



More information about the devel mailing list