diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-07-30 04:44:00 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-08-03 13:55:24 -0400 |
commit | 5b778b97d494653deb2f2320393900ee51c80894 (patch) | |
tree | b2435af97ce68776df919778d1fa5940ca8dc137 /drivers/iio/imu | |
parent | 7fc5ad7e97a690ccd05ad2556c1bfb687692f215 (diff) |
iio: imu: adis16400: Use devm_iio_device_alloc
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>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/imu')
-rw-r--r-- | drivers/iio/imu/adis16400_core.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c index f60591f0b925..3fb7757a1028 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) | |||
871 | struct iio_dev *indio_dev; | 871 | struct iio_dev *indio_dev; |
872 | int ret; | 872 | int ret; |
873 | 873 | ||
874 | indio_dev = iio_device_alloc(sizeof(*st)); | 874 | indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); |
875 | if (indio_dev == NULL) | 875 | if (indio_dev == NULL) |
876 | return -ENOMEM; | 876 | return -ENOMEM; |
877 | 877 | ||
@@ -893,12 +893,12 @@ static int adis16400_probe(struct spi_device *spi) | |||
893 | 893 | ||
894 | ret = adis_init(&st->adis, indio_dev, spi, &adis16400_data); | 894 | ret = adis_init(&st->adis, indio_dev, spi, &adis16400_data); |
895 | if (ret) | 895 | if (ret) |
896 | goto error_free_dev; | 896 | return ret; |
897 | 897 | ||
898 | ret = adis_setup_buffer_and_trigger(&st->adis, indio_dev, | 898 | ret = adis_setup_buffer_and_trigger(&st->adis, indio_dev, |
899 | adis16400_trigger_handler); | 899 | adis16400_trigger_handler); |
900 | if (ret) | 900 | if (ret) |
901 | goto error_free_dev; | 901 | return ret; |
902 | 902 | ||
903 | /* Get the device into a sane initial state */ | 903 | /* Get the device into a sane initial state */ |
904 | ret = adis16400_initial_setup(indio_dev); | 904 | ret = adis16400_initial_setup(indio_dev); |
@@ -913,8 +913,6 @@ static int adis16400_probe(struct spi_device *spi) | |||
913 | 913 | ||
914 | error_cleanup_buffer: | 914 | error_cleanup_buffer: |
915 | adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); | 915 | adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); |
916 | error_free_dev: | ||
917 | iio_device_free(indio_dev); | ||
918 | return ret; | 916 | return ret; |
919 | } | 917 | } |
920 | 918 | ||
@@ -928,8 +926,6 @@ static int adis16400_remove(struct spi_device *spi) | |||
928 | 926 | ||
929 | adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); | 927 | adis_cleanup_buffer_and_trigger(&st->adis, indio_dev); |
930 | 928 | ||
931 | iio_device_free(indio_dev); | ||
932 | |||
933 | return 0; | 929 | return 0; |
934 | } | 930 | } |
935 | 931 | ||