diff options
author | Denis CIOCCA <denis.ciocca@st.com> | 2013-09-18 13:00:00 +0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-09-21 22:24:08 +0400 |
commit | fb4ea1f828d515b766c081647935bad5a38e0586 (patch) | |
tree | 130a3069d2d9a617a657c33da2f07615f40ec6d0 /drivers/iio | |
parent | e21e254e49831075f7fb13d9dbe33defb00a3d3d (diff) | |
download | linux-fb4ea1f828d515b766c081647935bad5a38e0586.tar.xz |
iio:gyro: 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/gyro/st_gyro_core.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c index 9f80817182cf..d53d91adfb55 100644 --- a/drivers/iio/gyro/st_gyro_core.c +++ b/drivers/iio/gyro/st_gyro_core.c @@ -330,11 +330,11 @@ int st_gyro_common_probe(struct iio_dev *indio_dev, if (err < 0) return err; - if (irq > 0) { - err = st_gyro_allocate_ring(indio_dev); - if (err < 0) - return err; + err = st_gyro_allocate_ring(indio_dev); + if (err < 0) + return err; + if (irq > 0) { err = st_sensors_allocate_trigger(indio_dev, ST_GYRO_TRIGGER_OPS); if (err < 0) @@ -351,8 +351,7 @@ st_gyro_device_register_error: if (irq > 0) st_sensors_deallocate_trigger(indio_dev); st_gyro_probe_trigger_error: - if (irq > 0) - st_gyro_deallocate_ring(indio_dev); + st_gyro_deallocate_ring(indio_dev); return err; } @@ -363,10 +362,10 @@ void st_gyro_common_remove(struct iio_dev *indio_dev) struct st_sensor_data *gdata = iio_priv(indio_dev); iio_device_unregister(indio_dev); - if (gdata->get_irq_data_ready(indio_dev) > 0) { + if (gdata->get_irq_data_ready(indio_dev) > 0) st_sensors_deallocate_trigger(indio_dev); - st_gyro_deallocate_ring(indio_dev); - } + + st_gyro_deallocate_ring(indio_dev); } EXPORT_SYMBOL(st_gyro_common_remove); |