summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/palmas_gpadc.c
diff options
context:
space:
mode:
authorJulien Stephan <jstephan@baylibre.com>2024-10-31 16:27:02 +0100
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2024-11-03 21:33:44 +0100
commitb4b42f28a0df6b9d31f0003f7dea3bddf272eaa4 (patch)
tree69d5daee3a9e596a439d0d0ebea471646e76d450 /drivers/iio/adc/palmas_gpadc.c
parentiio: light: adux1020: write_event_config: use local variable for interrupt value (diff)
downloadlinux-b4b42f28a0df6b9d31f0003f7dea3bddf272eaa4.tar.xz
linux-b4b42f28a0df6b9d31f0003f7dea3bddf272eaa4.zip
iio: fix write_event_config signature
write_event_config callback use an int for state, but it is actually a boolean. iio_ev_state_store is actually using kstrtobool to check user input, then gives the converted boolean value to write_event_config. Fix signature and update all iio drivers to use the new signature. This patch has been partially written using coccinelle with the following script: $ cat iio-bool.cocci // Options: --all-includes virtual patch @c1@ identifier iioinfo; identifier wecfunc; @@ static const struct iio_info iioinfo = { ..., .write_event_config = ( wecfunc | &wecfunc ), ..., }; @@ identifier c1.wecfunc; identifier indio_dev, chan, type, dir, state; @@ int wecfunc(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, enum iio_event_type type, enum iio_event_direction dir, -int +bool state) { ... } make coccicheck MODE=patch COCCI=iio-bool.cocci M=drivers/iio Unfortunately, this script didn't match all files: * all write_event_config callbacks using iio_device_claim_direct_scoped were not detected and not patched. * all files that do not assign and declare the write_event_config callback in the same file. iio.h was also manually updated. The patch was build tested using allmodconfig config. cc: Julia Lawall <julia.lawall@inria.fr> Signed-off-by: Julien Stephan <jstephan@baylibre.com> Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-7-2bcacbb517a2@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/palmas_gpadc.c')
-rw-r--r--drivers/iio/adc/palmas_gpadc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c
index 67d567ee21b4..d283ee8fb1d2 100644
--- a/drivers/iio/adc/palmas_gpadc.c
+++ b/drivers/iio/adc/palmas_gpadc.c
@@ -676,7 +676,7 @@ static int palmas_gpadc_write_event_config(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
- int state)
+ bool state)
{
struct palmas_gpadc *adc = iio_priv(indio_dev);
int adc_chan = chan->channel;