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/gyro | |
parent | 330c6c57e6284a755d7e8a031b3c917571ee6dc3 (diff) | |
download | linux-26d25ae3f0d8ffe350aacc75b71198d6b35bd1f4.tar.gz linux-26d25ae3f0d8ffe350aacc75b71198d6b35bd1f4.tar.bz2 linux-26d25ae3f0d8ffe350aacc75b71198d6b35bd1f4.zip |
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/gyro')
-rw-r--r-- | drivers/staging/iio/gyro/adis16060_core.c | 8 | ||||
-rw-r--r-- | drivers/staging/iio/gyro/adis16080_core.c | 9 | ||||
-rw-r--r-- | drivers/staging/iio/gyro/adis16260_core.c | 15 |
3 files changed, 10 insertions, 22 deletions
diff --git a/drivers/staging/iio/gyro/adis16060_core.c b/drivers/staging/iio/gyro/adis16060_core.c index 3f5087329e5b..481080588b18 100644 --- a/drivers/staging/iio/gyro/adis16060_core.c +++ b/drivers/staging/iio/gyro/adis16060_core.c @@ -143,7 +143,7 @@ static const struct iio_chan_spec adis16060_channels[] = { static int __devinit adis16060_r_probe(struct spi_device *spi) { - int ret, regdone = 0; + int ret; struct adis16060_state *st; struct iio_dev *indio_dev; @@ -169,16 +169,12 @@ static int __devinit adis16060_r_probe(struct spi_device *spi) ret = iio_device_register(indio_dev); if (ret) goto error_free_dev; - regdone = 1; adis16060_iio_dev = indio_dev; return 0; 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; } diff --git a/drivers/staging/iio/gyro/adis16080_core.c b/drivers/staging/iio/gyro/adis16080_core.c index 16ba0e11e443..826f8f1db0df 100644 --- a/drivers/staging/iio/gyro/adis16080_core.c +++ b/drivers/staging/iio/gyro/adis16080_core.c @@ -137,7 +137,7 @@ static const struct iio_info adis16080_info = { static int __devinit adis16080_probe(struct spi_device *spi) { - int ret, regdone = 0; + int ret; struct adis16080_state *st; struct iio_dev *indio_dev; @@ -165,15 +165,10 @@ static int __devinit adis16080_probe(struct spi_device *spi) ret = iio_device_register(indio_dev); if (ret) goto error_free_dev; - regdone = 1; - return 0; 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; } diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c index acd17e50df57..73157b21252b 100644 --- a/drivers/staging/iio/gyro/adis16260_core.c +++ b/drivers/staging/iio/gyro/adis16260_core.c @@ -577,7 +577,7 @@ static const struct iio_info adis16260_info = { static int __devinit adis16260_probe(struct spi_device *spi) { - int ret, regdone = 0; + int ret; struct adis16260_platform_data *pd = spi->dev.platform_data; struct adis16260_state *st; struct iio_dev *indio_dev; @@ -625,10 +625,6 @@ static int __devinit adis16260_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, indio_dev->channels, ARRAY_SIZE(adis16260_channels_x)); @@ -654,6 +650,10 @@ static int __devinit adis16260_probe(struct spi_device *spi) ret = adis16260_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: @@ -663,10 +663,7 @@ error_uninitialize_ring: error_unreg_ring_funcs: adis16260_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; } |