This patch fix buffer registration that allows to use generic IIO trigger. Signed-off-by: Denis Ciocca <denis.ciocca@xxxxxx> --- drivers/iio/gyro/st_gyro_core.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c index e13c2b0..8a45d43 100644 --- a/drivers/iio/gyro/st_gyro_core.c +++ b/drivers/iio/gyro/st_gyro_core.c @@ -329,13 +329,13 @@ int st_gyro_common_probe(struct iio_dev *indio_dev, if (err < 0) goto st_gyro_common_probe_error; - if (gdata->get_irq_data_ready(indio_dev) > 0) { - err = st_gyro_allocate_ring(indio_dev); - if (err < 0) - goto st_gyro_common_probe_error; + err = st_gyro_allocate_ring(indio_dev); + if (err < 0) + goto st_gyro_common_probe_error; + if (gdata->get_irq_data_ready(indio_dev) > 0) { err = st_sensors_allocate_trigger(indio_dev, - ST_GYRO_TRIGGER_OPS); + ST_GYRO_TRIGGER_OPS); if (err < 0) goto st_gyro_probe_trigger_error; } @@ -350,8 +350,7 @@ st_gyro_device_register_error: if (gdata->get_irq_data_ready(indio_dev) > 0) st_sensors_deallocate_trigger(indio_dev); st_gyro_probe_trigger_error: - if (gdata->get_irq_data_ready(indio_dev) > 0) - st_gyro_deallocate_ring(indio_dev); + st_gyro_deallocate_ring(indio_dev); st_gyro_common_probe_error: return err; } @@ -362,10 +361,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); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html