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/impedance-analyzer/ad5933.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/impedance-analyzer/ad5933.c')
-rw-r--r-- | drivers/staging/iio/impedance-analyzer/ad5933.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c index e199bbe..65399d1 100644 --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c @@ -675,7 +675,7 @@ static void ad5933_work(struct work_struct *work) static int __devinit ad5933_probe(struct i2c_client *client, const struct i2c_device_id *id) { - int ret, regdone = 0, voltage_uv = 0; + int ret, voltage_uv = 0; struct ad5933_platform_data *pdata = client->dev.platform_data; struct ad5933_state *st; struct iio_dev *indio_dev = iio_allocate_device(sizeof(*st)); @@ -727,11 +727,6 @@ static int __devinit ad5933_probe(struct i2c_client *client, if (ret) goto error_disable_reg; - ret = iio_device_register(indio_dev); - if (ret) - goto error_unreg_ring; - regdone = 1; - /* skip temp0_input, register in0_(real|imag)_raw */ ret = iio_ring_buffer_register(indio_dev, &ad5933_channels[1], 2); if (ret) @@ -745,6 +740,10 @@ static int __devinit ad5933_probe(struct i2c_client *client, if (ret) goto error_uninitialize_ring; + ret = iio_device_register(indio_dev); + if (ret) + goto error_uninitialize_ring; + return 0; error_uninitialize_ring: @@ -758,10 +757,7 @@ error_put_reg: if (!IS_ERR(st->reg)) regulator_put(st->reg); - if (regdone) - iio_device_unregister(indio_dev); - else - iio_free_device(indio_dev); + iio_free_device(indio_dev); return ret; } |