linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] iio: imu: adis16400: Use devm_iio_device_alloc
@ 2013-07-30  8:44 Sachin Kamat
  2013-07-30  8:44 ` [PATCH 2/6] iio: imu: adis16480: " Sachin Kamat
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Sachin Kamat @ 2013-07-30  8:44 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, jic23, sachin.kamat, Manuel Stahl

Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
---
This series compile tested on togreg branch of
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
---
 drivers/iio/imu/adis16400_core.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c
index f60591f..3fb7757 100644
--- a/drivers/iio/imu/adis16400_core.c
+++ b/drivers/iio/imu/adis16400_core.c
@@ -871,7 +871,7 @@ static int adis16400_probe(struct spi_device *spi)
 	struct iio_dev *indio_dev;
 	int ret;
 
-	indio_dev = iio_device_alloc(sizeof(*st));
+	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
 	if (indio_dev == NULL)
 		return -ENOMEM;
 
@@ -893,12 +893,12 @@ static int adis16400_probe(struct spi_device *spi)
 
 	ret = adis_init(&st->adis, indio_dev, spi, &adis16400_data);
 	if (ret)
-		goto error_free_dev;
+		return ret;
 
 	ret = adis_setup_buffer_and_trigger(&st->adis, indio_dev,
 			adis16400_trigger_handler);
 	if (ret)
-		goto error_free_dev;
+		return ret;
 
 	/* Get the device into a sane initial state */
 	ret = adis16400_initial_setup(indio_dev);
@@ -913,8 +913,6 @@ static int adis16400_probe(struct spi_device *spi)
 
 error_cleanup_buffer:
 	adis_cleanup_buffer_and_trigger(&st->adis, indio_dev);
-error_free_dev:
-	iio_device_free(indio_dev);
 	return ret;
 }
 
@@ -928,8 +926,6 @@ static int adis16400_remove(struct spi_device *spi)
 
 	adis_cleanup_buffer_and_trigger(&st->adis, indio_dev);
 
-	iio_device_free(indio_dev);
-
 	return 0;
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-08-03 16:57 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-30  8:44 [PATCH 1/6] iio: imu: adis16400: Use devm_iio_device_alloc Sachin Kamat
2013-07-30  8:44 ` [PATCH 2/6] iio: imu: adis16480: " Sachin Kamat
2013-08-03 17:49   ` Jonathan Cameron
2013-07-30  8:44 ` [PATCH 3/6] iio: imu: inv_mpu6050: " Sachin Kamat
2013-08-03 17:50   ` Jonathan Cameron
2013-07-30  8:44 ` [PATCH 4/6] iio: light: hid-sensor-als: " Sachin Kamat
2013-08-02 16:08   ` Srinivas Pandruvada
2013-08-03 17:54     ` Jonathan Cameron
2013-07-30  8:44 ` [PATCH 5/6] iio: light: lm3533-als: " Sachin Kamat
2013-08-03 17:54   ` Jonathan Cameron
2013-07-30  8:44 ` [PATCH 6/6] iio: light: tsl2563: Use devm_* APIs Sachin Kamat
2013-07-30  9:07   ` Amit Kucheria
2013-08-03 17:57     ` Jonathan Cameron
2013-08-03 17:49 ` [PATCH 1/6] iio: imu: adis16400: Use devm_iio_device_alloc Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).