iio: gyro: adis16136: Use devm_iio_device_alloc

Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Sachin Kamat 2013-08-13 07:34:00 +01:00 committed by Jonathan Cameron
parent 42aceff5a2
commit c0ca6d31a5

View file

@ -497,7 +497,7 @@ static int adis16136_probe(struct spi_device *spi)
struct iio_dev *indio_dev;
int ret;
indio_dev = iio_device_alloc(sizeof(*adis16136));
indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*adis16136));
if (indio_dev == NULL)
return -ENOMEM;
@ -515,11 +515,11 @@ static int adis16136_probe(struct spi_device *spi)
ret = adis_init(&adis16136->adis, indio_dev, spi, &adis16136_data);
if (ret)
goto error_free_dev;
return ret;
ret = adis_setup_buffer_and_trigger(&adis16136->adis, indio_dev, NULL);
if (ret)
goto error_free_dev;
return ret;
ret = adis16136_initial_setup(indio_dev);
if (ret)
@ -537,8 +537,6 @@ error_stop_device:
adis16136_stop_device(indio_dev);
error_cleanup_buffer:
adis_cleanup_buffer_and_trigger(&adis16136->adis, indio_dev);
error_free_dev:
iio_device_free(indio_dev);
return ret;
}
@ -552,8 +550,6 @@ static int adis16136_remove(struct spi_device *spi)
adis_cleanup_buffer_and_trigger(&adis16136->adis, indio_dev);
iio_device_free(indio_dev);
return 0;
}