aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/light/vcnl4000.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2020-05-25 14:38:53 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2020-06-20 17:34:44 +0100
commitf11d59d87b8622d4cf9f856c0b8029fb030d8612 (patch)
tree249450dfe73731ab943e918cd5ed5ddd6c66c28b /drivers/iio/light/vcnl4000.c
parentiio: at91_adc: remove usage of iio_priv_to_dev() helper (diff)
downloadlinux-dev-f11d59d87b8622d4cf9f856c0b8029fb030d8612.tar.xz
linux-dev-f11d59d87b8622d4cf9f856c0b8029fb030d8612.zip
iio: Move attach/detach of the poll func to the core
All devices using a triggered buffer need to attach and detach the trigger to the device in order to properly work. Instead of doing this in each and every driver by hand move this into the core. At this point in time, all drivers should have been resolved to attach/detach the poll-function in the same order. This patch removes all explicit calls of iio_triggered_buffer_postenable() & iio_triggered_buffer_predisable() in all drivers, since the core handles now the pollfunc attach/detach. The more peculiar change is for the 'at91-sama5d2_adc' driver, since it's not immediately obvious that removing the hooks doesn't break anything. Eugen was able to test on at91-sama5d2-adc driver, sama5d2-xplained board. All seems to be fine. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Tested-by: Eugen Hristev <eugen.hristev@microchip.com> #for at91-sama5d2-adc Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/light/vcnl4000.c')
-rw-r--r--drivers/iio/light/vcnl4000.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index ac1ab715d4dd..fff4b36b8b58 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -957,50 +957,29 @@ static int vcnl4010_buffer_postenable(struct iio_dev *indio_dev)
int ret;
int cmd;
- ret = iio_triggered_buffer_postenable(indio_dev);
- if (ret)
- return ret;
-
/* Do not enable the buffer if we are already capturing events. */
- if (vcnl4010_is_in_periodic_mode(data)) {
- ret = -EBUSY;
- goto end;
- }
+ if (vcnl4010_is_in_periodic_mode(data))
+ return -EBUSY;
ret = i2c_smbus_write_byte_data(data->client, VCNL4010_INT_CTRL,
VCNL4010_INT_PROX_EN);
if (ret < 0)
- goto end;
+ return ret;
cmd = VCNL4000_SELF_TIMED_EN | VCNL4000_PROX_EN;
- ret = i2c_smbus_write_byte_data(data->client, VCNL4000_COMMAND, cmd);
- if (ret < 0)
- goto end;
-
- return 0;
-end:
- iio_triggered_buffer_predisable(indio_dev);
-
- return ret;
+ return i2c_smbus_write_byte_data(data->client, VCNL4000_COMMAND, cmd);
}
static int vcnl4010_buffer_predisable(struct iio_dev *indio_dev)
{
struct vcnl4000_data *data = iio_priv(indio_dev);
- int ret, ret_disable;
+ int ret;
ret = i2c_smbus_write_byte_data(data->client, VCNL4010_INT_CTRL, 0);
if (ret < 0)
- goto end;
-
- ret = i2c_smbus_write_byte_data(data->client, VCNL4000_COMMAND, 0);
-
-end:
- ret_disable = iio_triggered_buffer_predisable(indio_dev);
- if (ret == 0)
- ret = ret_disable;
+ return ret;
- return ret;
+ return i2c_smbus_write_byte_data(data->client, VCNL4000_COMMAND, 0);
}
static const struct iio_buffer_setup_ops vcnl4010_buffer_ops = {