diff options
author | Denis CIOCCA <denis.ciocca@st.com> | 2013-09-18 10:00:00 +0100 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-09-21 19:24:08 +0100 |
commit | f60b12b02ec8d9057863423c6d7b27169638e1d9 (patch) | |
tree | 1fdb021fa78aba304e67a3fd60e41d5bd28f5dca /drivers/iio/magnetometer/st_magn_core.c | |
parent | fb4ea1f828d515b766c081647935bad5a38e0586 (diff) | |
download | op-kernel-dev-f60b12b02ec8d9057863423c6d7b27169638e1d9.zip op-kernel-dev-f60b12b02ec8d9057863423c6d7b27169638e1d9.tar.gz |
iio:magn: 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/magnetometer/st_magn_core.c')
-rw-r--r-- | drivers/iio/magnetometer/st_magn_core.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index 729c71a..82461ef 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c @@ -373,10 +373,11 @@ int st_magn_common_probe(struct iio_dev *indio_dev, if (err < 0) return err; + err = st_magn_allocate_ring(indio_dev); + if (err < 0) + return err; + if (irq > 0) { - err = st_magn_allocate_ring(indio_dev); - if (err < 0) - return err; err = st_sensors_allocate_trigger(indio_dev, NULL); if (err < 0) goto st_magn_probe_trigger_error; @@ -392,8 +393,7 @@ st_magn_device_register_error: if (irq > 0) st_sensors_deallocate_trigger(indio_dev); st_magn_probe_trigger_error: - if (irq > 0) - st_magn_deallocate_ring(indio_dev); + st_magn_deallocate_ring(indio_dev); return err; } @@ -404,10 +404,10 @@ void st_magn_common_remove(struct iio_dev *indio_dev) struct st_sensor_data *mdata = iio_priv(indio_dev); iio_device_unregister(indio_dev); - if (mdata->get_irq_data_ready(indio_dev) > 0) { + if (mdata->get_irq_data_ready(indio_dev) > 0) st_sensors_deallocate_trigger(indio_dev); - st_magn_deallocate_ring(indio_dev); - } + + st_magn_deallocate_ring(indio_dev); } EXPORT_SYMBOL(st_magn_common_remove); |