diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2011-09-02 17:14:40 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-09-06 16:02:01 -0700 |
commit | 26d25ae3f0d8ffe350aacc75b71198d6b35bd1f4 (patch) | |
tree | 8b7867c7cfb8202e5313c462256ebf7e9932a1f1 /drivers/staging/iio/imu | |
parent | 330c6c57e6284a755d7e8a031b3c917571ee6dc3 (diff) |
staging:iio: rework of attribute registration.
This set also includes quite a number of bug fixes of particularly
remove functions.
Necessary due to issue pointed out in Bart Van Assche's patch:
docs/driver-model: Document device.groups
V2: Rebase due to patch reordering.
V3: Pull various error fixes and cleanups out into their own patches.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/imu')
-rw-r--r-- | drivers/staging/iio/imu/adis16400_core.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c index 3e8fcd3354f2..0fca3bf8ef37 100644 --- a/drivers/staging/iio/imu/adis16400_core.c +++ b/drivers/staging/iio/imu/adis16400_core.c @@ -821,7 +821,7 @@ static const struct iio_info adis16400_info = { static int __devinit adis16400_probe(struct spi_device *spi) { - int ret, regdone = 0; + int ret; struct adis16400_state *st; struct iio_dev *indio_dev = iio_allocate_device(sizeof(*st)); if (indio_dev == NULL) { @@ -848,11 +848,6 @@ static int __devinit adis16400_probe(struct spi_device *spi) if (ret) goto error_free_dev; - ret = iio_device_register(indio_dev); - if (ret) - goto error_unreg_ring_funcs; - regdone = 1; - ret = iio_ring_buffer_register(indio_dev, st->variant->channels, st->variant->num_channels); @@ -871,6 +866,10 @@ static int __devinit adis16400_probe(struct spi_device *spi) ret = adis16400_initial_setup(indio_dev); if (ret) goto error_remove_trigger; + ret = iio_device_register(indio_dev); + if (ret) + goto error_remove_trigger; + return 0; error_remove_trigger: @@ -881,10 +880,7 @@ error_uninitialize_ring: error_unreg_ring_funcs: adis16400_unconfigure_ring(indio_dev); error_free_dev: - if (regdone) - iio_device_unregister(indio_dev); - else - iio_free_device(indio_dev); + iio_free_device(indio_dev); error_ret: return ret; } |