mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-22 20:23:57 +08:00
iio: adxl372: fix iio_triggered_buffer_{pre,post}enable positions
The iio_triggered_buffer_{predisable,postenable} functions attach/detach the poll functions. For the predisable hook, the disable code should occur before detaching the poll func, and for the postenable hook, the poll func should be attached before the enable code. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
4b65e3ba97
commit
0e4f0b42f4
@ -782,10 +782,14 @@ static int adxl372_buffer_postenable(struct iio_dev *indio_dev)
|
||||
unsigned int mask;
|
||||
int i, ret;
|
||||
|
||||
ret = adxl372_set_interrupts(st, ADXL372_INT1_MAP_FIFO_FULL_MSK, 0);
|
||||
ret = iio_triggered_buffer_postenable(indio_dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = adxl372_set_interrupts(st, ADXL372_INT1_MAP_FIFO_FULL_MSK, 0);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
mask = *indio_dev->active_scan_mask;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(adxl372_axis_lookup_table); i++) {
|
||||
@ -793,8 +797,10 @@ static int adxl372_buffer_postenable(struct iio_dev *indio_dev)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == ARRAY_SIZE(adxl372_axis_lookup_table))
|
||||
return -EINVAL;
|
||||
if (i == ARRAY_SIZE(adxl372_axis_lookup_table)) {
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
st->fifo_format = adxl372_axis_lookup_table[i].fifo_format;
|
||||
st->fifo_set_size = bitmap_weight(indio_dev->active_scan_mask,
|
||||
@ -814,26 +820,25 @@ static int adxl372_buffer_postenable(struct iio_dev *indio_dev)
|
||||
if (ret < 0) {
|
||||
st->fifo_mode = ADXL372_FIFO_BYPASSED;
|
||||
adxl372_set_interrupts(st, 0, 0);
|
||||
return ret;
|
||||
goto err;
|
||||
}
|
||||
|
||||
return iio_triggered_buffer_postenable(indio_dev);
|
||||
return 0;
|
||||
|
||||
err:
|
||||
iio_triggered_buffer_predisable(indio_dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int adxl372_buffer_predisable(struct iio_dev *indio_dev)
|
||||
{
|
||||
struct adxl372_state *st = iio_priv(indio_dev);
|
||||
int ret;
|
||||
|
||||
ret = iio_triggered_buffer_predisable(indio_dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
adxl372_set_interrupts(st, 0, 0);
|
||||
st->fifo_mode = ADXL372_FIFO_BYPASSED;
|
||||
adxl372_configure_fifo(st);
|
||||
|
||||
return 0;
|
||||
return iio_triggered_buffer_predisable(indio_dev);
|
||||
}
|
||||
|
||||
static const struct iio_buffer_setup_ops adxl372_buffer_ops = {
|
||||
|
Loading…
Reference in New Issue
Block a user