diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2011-09-02 16:14:40 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-09-06 23:02:01 (GMT) |
commit | 26d25ae3f0d8ffe350aacc75b71198d6b35bd1f4 (patch) | |
tree | 8b7867c7cfb8202e5313c462256ebf7e9932a1f1 /drivers/staging/iio/accel/adis16209_core.c | |
parent | 330c6c57e6284a755d7e8a031b3c917571ee6dc3 (diff) | |
download | linux-26d25ae3f0d8ffe350aacc75b71198d6b35bd1f4.tar.xz |
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/accel/adis16209_core.c')
-rw-r--r-- | drivers/staging/iio/accel/adis16209_core.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c index d59a9e4..377c6d7 100644 --- a/drivers/staging/iio/accel/adis16209_core.c +++ b/drivers/staging/iio/accel/adis16209_core.c @@ -467,7 +467,7 @@ static const struct iio_info adis16209_info = { static int __devinit adis16209_probe(struct spi_device *spi) { - int ret, regdone = 0; + int ret; struct adis16209_state *st; struct iio_dev *indio_dev; @@ -494,11 +494,6 @@ static int __devinit adis16209_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, adis16209_channels, ARRAY_SIZE(adis16209_channels)); @@ -517,6 +512,10 @@ static int __devinit adis16209_probe(struct spi_device *spi) ret = adis16209_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: @@ -526,10 +525,7 @@ error_uninitialize_ring: error_unreg_ring_funcs: adis16209_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; } |