iio: dln2-adc: fix iio_triggered_buffer_postenable() position
authorAlexandru Ardelean <alexandru.ardelean@analog.com>
Wed, 23 Oct 2019 08:26:34 +0000 (11:26 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Dec 2019 15:35:33 +0000 (16:35 +0100)
commit77a6a2656c81f2d2e165cb3208a63d2c5f186de8
tree9976ea2459f6add59709f912acb4931ae578206c
parenta498e02d09dcd0db255e89f55657a3bd85801d89
iio: dln2-adc: fix iio_triggered_buffer_postenable() position

[ Upstream commit a7bddfe2dfce1d8859422124abe1964e0ecd386e ]

The iio_triggered_buffer_postenable() hook should be called first to
attach the poll function. The iio_triggered_buffer_predisable() hook is
called last (as is it should).

This change moves iio_triggered_buffer_postenable() to be called first. It
adds iio_triggered_buffer_predisable() on the error paths of the postenable
hook.
For the predisable hook, some code-paths have been changed to make sure
that the iio_triggered_buffer_predisable() hook gets called in case there
is an error before it.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/adc/dln2-adc.c