[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fe46a45caaa788f333d78367968272de728f4a6e.1616966903.git.lucas.p.stankus@gmail.com>
Date: Sun, 28 Mar 2021 18:46:26 -0300
From: Lucas Stankus <lucas.p.stankus@...il.com>
To: lars@...afoo.de, Michael.Hennerich@...log.com, jic23@...nel.org
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] iio: adc: ad7923: use device-managed function for
triggered buffer
Converts the iio_triggered_buffer_setup() call to its device-managed
counterpart.
With this, the error handling routine in the ad7923_probe() function
becomes unnecessary as well as the iio_triggered_buffer_cleanup() call.
Signed-off-by: Lucas Stankus <lucas.p.stankus@...il.com>
---
drivers/iio/adc/ad7923.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/drivers/iio/adc/ad7923.c b/drivers/iio/adc/ad7923.c
index 3418ef6f0857..d07eaf3111ed 100644
--- a/drivers/iio/adc/ad7923.c
+++ b/drivers/iio/adc/ad7923.c
@@ -351,20 +351,12 @@ static int ad7923_probe(struct spi_device *spi)
if (ret)
return ret;
- ret = iio_triggered_buffer_setup(indio_dev, NULL,
- &ad7923_trigger_handler, NULL);
+ ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev, NULL,
+ &ad7923_trigger_handler, NULL);
if (ret)
return ret;
- ret = iio_device_register(indio_dev);
- if (ret)
- goto error_cleanup_ring;
-
- return 0;
-
-error_cleanup_ring:
- iio_triggered_buffer_cleanup(indio_dev);
- return ret;
+ return iio_device_register(indio_dev);
}
static int ad7923_remove(struct spi_device *spi)
@@ -372,7 +364,6 @@ static int ad7923_remove(struct spi_device *spi)
struct iio_dev *indio_dev = spi_get_drvdata(spi);
iio_device_unregister(indio_dev);
- iio_triggered_buffer_cleanup(indio_dev);
return 0;
}
--
2.31.0
Powered by blists - more mailing lists