aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/accel/lis3l02dq_core.c
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2011-09-02 17:14:40 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-09-06 16:02:01 -0700
commit26d25ae3f0d8ffe350aacc75b71198d6b35bd1f4 (patch)
tree8b7867c7cfb8202e5313c462256ebf7e9932a1f1 /drivers/staging/iio/accel/lis3l02dq_core.c
parent330c6c57e6284a755d7e8a031b3c917571ee6dc3 (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/accel/lis3l02dq_core.c')
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_core.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c
index 61d114a8b19..ee91cc719bc 100644
--- a/drivers/staging/iio/accel/lis3l02dq_core.c
+++ b/drivers/staging/iio/accel/lis3l02dq_core.c
@@ -663,7 +663,7 @@ static const struct iio_info lis3l02dq_info = {
static int __devinit lis3l02dq_probe(struct spi_device *spi)
{
- int ret, regdone = 0;
+ int ret;
struct lis3l02dq_state *st;
struct iio_dev *indio_dev;
@@ -690,11 +690,6 @@ static int __devinit lis3l02dq_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,
lis3l02dq_channels,
ARRAY_SIZE(lis3l02dq_channels));
@@ -722,6 +717,11 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi)
ret = lis3l02dq_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:
@@ -735,9 +735,6 @@ error_uninitialize_ring:
error_unreg_ring_funcs:
lis3l02dq_unconfigure_ring(indio_dev);
error_free_dev:
- if (regdone)
- iio_device_unregister(indio_dev);
- else
iio_free_device(indio_dev);
error_ret:
return ret;
@@ -790,9 +787,8 @@ static int lis3l02dq_remove(struct spi_device *spi)
lis3l02dq_remove_trigger(indio_dev);
iio_ring_buffer_unregister(indio_dev);
lis3l02dq_unconfigure_ring(indio_dev);
- iio_device_unregister(indio_dev);
- return 0;
+ iio_device_unregister(indio_dev);
err_ret:
return ret;