Hello, This series update the write_event_config callback signature to use a boolean instead of an int for state variable. iio_ev_state_store is actually using kstrtobool to check user input, then gives the converted boolean value to write_event_config. First, fix the write_event_config callbacks from iio drivers that are checking state input, or that are converting state to bool. This is useless code, then update 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. Signed-off-by: Julien Stephan <jstephan@xxxxxxxxxxxx> --- Changes in v2: - removed commits that were already applied - added new commits to fix comments from Jonathan Cameron: cleanup code in few callbacks to update driver internal function signature to also use bool for state and update the driver internal state variable to bool. - few minor fixes along the way on different driver - Link to v1: https://lore.kernel.org/r/20241024-iio-fix-write-event-config-signature-v1-0-7d29e5a31b00@xxxxxxxxxxxx --- Julien Stephan (15): iio: light: ltr390: simplify code in write_event_config callback iio: proximity: hx9023s: simplify code in write_event_config callback iio: light: tsl2772: simplify code in write_event_config callback iio: proximity: irsd200: simplify code in write_event_config callback iio: proximity: sx9500: simplify code in write_event_config callback iio: light: adux1020: write_event_config: use local variable for interrupt value iio: fix write_event_config signature iio: accel: mma9551: use bool for event state iio: accel: sca3000: use bool for event state iio: imu: bmi323: use bool for event state iio: imu: st_lsm6dsx: use bool for event state iio: light: apds9300: use bool for event state iio: light: apds9306: simplifies if branch in apds9306_write_event_config iio: light: apds9960: convert als_int and pxs_int to bool iio: light: apds9960: remove useless return drivers/iio/accel/adxl367.c | 2 +- drivers/iio/accel/adxl372.c | 2 +- drivers/iio/accel/adxl380.c | 2 +- drivers/iio/accel/bma400_core.c | 2 +- drivers/iio/accel/bmc150-accel-core.c | 2 +- drivers/iio/accel/fxls8962af-core.c | 2 +- drivers/iio/accel/kxcjk-1013.c | 2 +- drivers/iio/accel/mma8452.c | 2 +- drivers/iio/accel/mma9551.c | 8 ++++---- drivers/iio/accel/mma9553.c | 3 ++- drivers/iio/accel/sca3000.c | 6 +++--- drivers/iio/adc/ad7091r-base.c | 3 ++- drivers/iio/adc/ad7291.c | 2 +- drivers/iio/adc/ad799x.c | 2 +- drivers/iio/adc/hi8435.c | 2 +- drivers/iio/adc/max1363.c | 2 +- drivers/iio/adc/pac1921.c | 3 ++- drivers/iio/adc/palmas_gpadc.c | 2 +- drivers/iio/adc/ti-ads1015.c | 2 +- drivers/iio/adc/xilinx-ams.c | 2 +- drivers/iio/adc/xilinx-xadc-events.c | 2 +- drivers/iio/adc/xilinx-xadc.h | 2 +- drivers/iio/cdc/ad7150.c | 2 +- drivers/iio/dac/ad5421.c | 2 +- drivers/iio/dac/ad8460.c | 2 +- drivers/iio/dummy/iio_simple_dummy.h | 2 +- drivers/iio/dummy/iio_simple_dummy_events.c | 2 +- drivers/iio/gyro/bmg160_core.c | 2 +- drivers/iio/imu/bmi323/bmi323_core.c | 10 +++++----- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 +- drivers/iio/imu/kmx61.c | 2 +- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 ++-- drivers/iio/light/adux1020.c | 11 ++++++----- drivers/iio/light/apds9300.c | 10 +++++----- drivers/iio/light/apds9306.c | 7 ++----- drivers/iio/light/apds9960.c | 8 +++----- drivers/iio/light/bh1745.c | 2 +- drivers/iio/light/cm36651.c | 2 +- drivers/iio/light/gp2ap002.c | 2 +- drivers/iio/light/gp2ap020a00f.c | 2 +- drivers/iio/light/iqs621-als.c | 2 +- drivers/iio/light/ltr390.c | 7 ++----- drivers/iio/light/ltr501.c | 2 +- drivers/iio/light/max44009.c | 2 +- drivers/iio/light/opt3001.c | 2 +- drivers/iio/light/stk3310.c | 2 +- drivers/iio/light/tcs3472.c | 2 +- drivers/iio/light/tsl2563.c | 2 +- drivers/iio/light/tsl2591.c | 2 +- drivers/iio/light/tsl2772.c | 6 +++--- drivers/iio/light/us5182d.c | 2 +- drivers/iio/light/vcnl4000.c | 5 +++-- drivers/iio/light/veml6030.c | 2 +- drivers/iio/position/iqs624-pos.c | 2 +- drivers/iio/proximity/aw96103.c | 2 +- drivers/iio/proximity/cros_ec_mkbp_proximity.c | 2 +- drivers/iio/proximity/hx9023s.c | 4 ++-- drivers/iio/proximity/irsd200.c | 5 +++-- drivers/iio/proximity/sx9500.c | 6 +++--- drivers/iio/proximity/sx_common.c | 2 +- drivers/iio/proximity/sx_common.h | 2 +- drivers/iio/proximity/vcnl3020.c | 2 +- drivers/iio/temperature/mcp9600.c | 2 +- drivers/iio/temperature/tmp007.c | 2 +- include/linux/iio/iio.h | 2 +- 65 files changed, 100 insertions(+), 102 deletions(-) --- base-commit: ce2785a44e784240e3dbb142942c9d88c2cac3d0 change-id: 20241023-iio-fix-write-event-config-signature-1bc1f52fdedf Best regards, -- Julien Stephan <jstephan@xxxxxxxxxxxx>