iio: __iio_update_buffers: Update mode before preenable/after postdisable
It is clear that we transition to INDIO_DIRECT_MODE when disabling the buffer(s) and it is also clear that we transition from INDIO_DIRECT_MODE when enabling the buffer(s). So leaving the currentmode field INDIO_DIRECT_MODE until after the preenable() callback and updating it to INDIO_DIRECT_MODE before the postdisable() callback doesn't add additional value. On the other hand some drivers will need to perform different actions depending on which mode the device is going to operate in/was operating in. Moving the update of currentmode before preenable() and after postdisable() enables us to have drivers which perform mode dependent actions in those callbacks. Note, was originally not intended as such, but fixes an issue introduced in the at91-sama5d2 adc driver. Signed-off-by:Lars-Peter Clausen <lars@metafoo.de> Signed-off-by:
Alexandru Ardelean <alexandru.ardelean@analog.com> Fixes: 065056cb ("iio: at91-sama5d2_adc: split at91_adc_current_chan_is_touch() helper") Tested-by:
Eugen Hristev <eugen.hristev@microchip.com> Signed-off-by:
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Showing
Please register or sign in to comment