diff options
author | Denis CIOCCA <denis.ciocca@st.com> | 2013-09-18 09:00:00 (GMT) |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-09-21 18:24:07 (GMT) |
commit | e21e254e49831075f7fb13d9dbe33defb00a3d3d (patch) | |
tree | 4984a8d9353742c28a0dc6a69f6e06f7b8c3a5e3 /drivers/iio | |
parent | 267a29b957cb28725aef7b9b2ea4c219caefb3b7 (diff) | |
download | linux-e21e254e49831075f7fb13d9dbe33defb00a3d3d.tar.xz |
iio:accel: Register buffer also without specific trigger
This patch fix buffer registration that allows to use generic IIO trigger.
Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/accel/st_accel_core.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index 97172dd..38caedc 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c @@ -481,11 +481,11 @@ int st_accel_common_probe(struct iio_dev *indio_dev, if (err < 0) return err; - if (irq > 0) { - err = st_accel_allocate_ring(indio_dev); - if (err < 0) - return err; + err = st_accel_allocate_ring(indio_dev); + if (err < 0) + return err; + if (irq > 0) { err = st_sensors_allocate_trigger(indio_dev, ST_ACCEL_TRIGGER_OPS); if (err < 0) @@ -502,8 +502,7 @@ st_accel_device_register_error: if (irq > 0) st_sensors_deallocate_trigger(indio_dev); st_accel_probe_trigger_error: - if (irq > 0) - st_accel_deallocate_ring(indio_dev); + st_accel_deallocate_ring(indio_dev); return err; } @@ -514,10 +513,10 @@ void st_accel_common_remove(struct iio_dev *indio_dev) struct st_sensor_data *adata = iio_priv(indio_dev); iio_device_unregister(indio_dev); - if (adata->get_irq_data_ready(indio_dev) > 0) { + if (adata->get_irq_data_ready(indio_dev) > 0) st_sensors_deallocate_trigger(indio_dev); - st_accel_deallocate_ring(indio_dev); - } + + st_accel_deallocate_ring(indio_dev); } EXPORT_SYMBOL(st_accel_common_remove); |