iio: fix write_event_config signature
authorJulien Stephan <jstephan@baylibre.com>
Thu, 31 Oct 2024 15:27:02 +0000 (16:27 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 3 Nov 2024 20:33:44 +0000 (20:33 +0000)
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>
65 files changed:
drivers/iio/accel/adxl367.c
drivers/iio/accel/adxl372.c
drivers/iio/accel/adxl380.c
drivers/iio/accel/bma400_core.c
drivers/iio/accel/bmc150-accel-core.c
drivers/iio/accel/fxls8962af-core.c
drivers/iio/accel/kxcjk-1013.c
drivers/iio/accel/mma8452.c
drivers/iio/accel/mma9551.c
drivers/iio/accel/mma9553.c
drivers/iio/accel/sca3000.c
drivers/iio/adc/ad7091r-base.c
drivers/iio/adc/ad7291.c
drivers/iio/adc/ad799x.c
drivers/iio/adc/hi8435.c
drivers/iio/adc/max1363.c
drivers/iio/adc/pac1921.c
drivers/iio/adc/palmas_gpadc.c
drivers/iio/adc/ti-ads1015.c
drivers/iio/adc/xilinx-ams.c
drivers/iio/adc/xilinx-xadc-events.c
drivers/iio/adc/xilinx-xadc.h
drivers/iio/cdc/ad7150.c
drivers/iio/dac/ad5421.c
drivers/iio/dac/ad8460.c
drivers/iio/dummy/iio_simple_dummy.h
drivers/iio/dummy/iio_simple_dummy_events.c
drivers/iio/gyro/bmg160_core.c
drivers/iio/imu/bmi323/bmi323_core.c
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
drivers/iio/imu/kmx61.c
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
drivers/iio/light/adux1020.c
drivers/iio/light/apds9300.c
drivers/iio/light/apds9306.c
drivers/iio/light/apds9960.c
drivers/iio/light/bh1745.c
drivers/iio/light/cm36651.c
drivers/iio/light/gp2ap002.c
drivers/iio/light/gp2ap020a00f.c
drivers/iio/light/iqs621-als.c
drivers/iio/light/ltr390.c
drivers/iio/light/ltr501.c
drivers/iio/light/max44009.c
drivers/iio/light/opt3001.c
drivers/iio/light/stk3310.c
drivers/iio/light/tcs3472.c
drivers/iio/light/tsl2563.c
drivers/iio/light/tsl2591.c
drivers/iio/light/tsl2772.c
drivers/iio/light/us5182d.c
drivers/iio/light/vcnl4000.c
drivers/iio/light/veml6030.c
drivers/iio/position/iqs624-pos.c
drivers/iio/proximity/aw96103.c
drivers/iio/proximity/cros_ec_mkbp_proximity.c
drivers/iio/proximity/hx9023s.c
drivers/iio/proximity/irsd200.c
drivers/iio/proximity/sx9500.c
drivers/iio/proximity/sx_common.c
drivers/iio/proximity/sx_common.h
drivers/iio/proximity/vcnl3020.c
drivers/iio/temperature/mcp9600.c
drivers/iio/temperature/tmp007.c
include/linux/iio/iio.h

index e790a66..705375f 100644 (file)
@@ -1073,7 +1073,7 @@ static int adxl367_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)
 {
        enum adxl367_activity_type act;
 
index ef8dd55..5b9eb36 100644 (file)
@@ -940,7 +940,7 @@ static int adxl372_read_event_config(struct iio_dev *indio_dev, const struct iio
 
 static int adxl372_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 adxl372_state *st = iio_priv(indio_dev);
 
index 9f6f0a4..5d2bda1 100644 (file)
@@ -1386,7 +1386,7 @@ static int adxl380_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 adxl380_state *st = iio_priv(indio_dev);
        enum adxl380_axis axis;
index 0bf5f32..906d257 100644 (file)
@@ -1293,7 +1293,7 @@ static int bma400_disable_adv_interrupt(struct bma400_data *data)
 static int bma400_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)
+                                    enum iio_event_direction dir, bool state)
 {
        struct bma400_data *data = iio_priv(indio_dev);
        int ret;
index 0f32c1e..1585793 100644 (file)
@@ -804,7 +804,7 @@ static int bmc150_accel_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 bmc150_accel_data *data = iio_priv(indio_dev);
        int ret;
index ab427f3..f07fba1 100644 (file)
@@ -617,7 +617,7 @@ static int
 fxls8962af_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)
+                             enum iio_event_direction dir, bool state)
 {
        struct fxls8962af_data *data = iio_priv(indio_dev);
        u8 enable_event, enable_bits;
index f65fde0..f2496ca 100644 (file)
@@ -1081,7 +1081,7 @@ static int kxcjk1013_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 kxcjk1013_data *data = iio_priv(indio_dev);
        int ret;
index de4525b..962d289 100644 (file)
@@ -974,7 +974,7 @@ static int mma8452_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 mma8452_data *data = iio_priv(indio_dev);
        int val, ret;
index a5d20d8..605022f 100644 (file)
@@ -225,7 +225,7 @@ static int mma9551_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 mma9551_data *data = iio_priv(indio_dev);
        int ret;
index 1ea6aa0..43ba04c 100644 (file)
@@ -725,7 +725,8 @@ static int mma9553_read_event_config(struct iio_dev *indio_dev,
 static int mma9553_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)
+                                     enum iio_event_direction dir,
+                                     bool state)
 {
        struct mma9553_data *data = iio_priv(indio_dev);
        struct mma9553_event *event;
index 87c54e4..36cbfcb 100644 (file)
@@ -1253,7 +1253,7 @@ static int sca3000_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 sca3000_state *st = iio_priv(indio_dev);
        int ret;
index d687625..eb0a059 100644 (file)
@@ -150,7 +150,8 @@ static int ad7091r_read_event_config(struct iio_dev *indio_dev,
 static int ad7091r_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)
+                                     enum iio_event_direction dir,
+                                     bool state)
 {
        struct ad7091r_state *st = iio_priv(indio_dev);
 
index 4c7f887..60e12fa 100644 (file)
@@ -269,7 +269,7 @@ static int ad7291_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)
 {
        int ret = 0;
        struct ad7291_chip_info *chip = iio_priv(indio_dev);
index 0f107e3..aa44b4e 100644 (file)
@@ -406,7 +406,7 @@ static int ad799x_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 ad799x_state *st = iio_priv(indio_dev);
        int ret;
index fb635a7..689e34f 100644 (file)
@@ -132,7 +132,7 @@ static int hi8435_read_event_config(struct iio_dev *idev,
 static int hi8435_write_event_config(struct iio_dev *idev,
                                     const struct iio_chan_spec *chan,
                                     enum iio_event_type type,
-                                    enum iio_event_direction dir, int state)
+                                    enum iio_event_direction dir, bool state)
 {
        struct hi8435_priv *priv = iio_priv(idev);
        int ret;
index 8da2d8d..9a0baea 100644 (file)
@@ -944,7 +944,7 @@ error_ret:
 
 static int max1363_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)
+       enum iio_event_direction dir, bool state)
 {
        struct max1363_state *st = iio_priv(indio_dev);
 
index 43a3dd3..b0f6727 100644 (file)
@@ -699,7 +699,8 @@ static int pac1921_read_event_config(struct iio_dev *indio_dev,
 static int pac1921_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)
+                                     enum iio_event_direction dir,
+                                     bool state)
 {
        struct pac1921_priv *priv = iio_priv(indio_dev);
        u8 ovf_bit;
index 67d567e..d283ee8 100644 (file)
@@ -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;
index 052d212..47fe8e1 100644 (file)
@@ -806,7 +806,7 @@ static int ads1015_disable_event_config(struct ads1015_data *data,
 
 static int ads1015_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)
+       enum iio_event_direction dir, bool state)
 {
        struct ads1015_data *data = iio_priv(indio_dev);
        int ret;
index ebc583b..76dd034 100644 (file)
@@ -905,7 +905,7 @@ static int ams_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 ams *ams = iio_priv(indio_dev);
        unsigned int alarm;
index 90f6237..c188d3d 100644 (file)
@@ -121,7 +121,7 @@ int xadc_read_event_config(struct iio_dev *indio_dev,
 
 int xadc_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)
+       enum iio_event_direction dir, bool state)
 {
        unsigned int alarm = xadc_get_alarm_mask(chan);
        struct xadc *xadc = iio_priv(indio_dev);
index 3036f4d..b4d9d46 100644 (file)
@@ -25,7 +25,7 @@ int xadc_read_event_config(struct iio_dev *indio_dev,
        enum iio_event_direction dir);
 int xadc_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);
+       enum iio_event_direction dir, bool state);
 int xadc_read_event_value(struct iio_dev *indio_dev,
        const struct iio_chan_spec *chan, enum iio_event_type type,
        enum iio_event_direction dir, enum iio_event_info info,
index 4c03b9e..e64a41b 100644 (file)
@@ -232,7 +232,7 @@ static int ad7150_write_event_params(struct iio_dev *indio_dev,
 static int ad7150_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)
+                                    enum iio_event_direction dir, bool state)
 {
        struct ad7150_chip_info *chip = iio_priv(indio_dev);
        int ret = 0;
index 7644acf..1462ee6 100644 (file)
@@ -384,7 +384,7 @@ static int ad5421_write_raw(struct iio_dev *indio_dev,
 
 static int ad5421_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)
+       enum iio_event_direction dir, bool state)
 {
        struct ad5421_state *st = iio_priv(indio_dev);
        unsigned int mask;
index 7470d97..f235394 100644 (file)
@@ -573,7 +573,7 @@ static int ad8460_read_event_value(struct iio_dev *indio_dev,
 static int ad8460_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 val)
+                                    enum iio_event_direction dir, bool val)
 {
        struct ad8460_state *state = iio_priv(indio_dev);
        int fault;
index a91622a..8246f25 100644 (file)
@@ -60,7 +60,7 @@ int iio_simple_dummy_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);
 
 int iio_simple_dummy_read_event_value(struct iio_dev *indio_dev,
                                      const struct iio_chan_spec *chan,
index 63a2b84..c7f2d3a 100644 (file)
@@ -53,7 +53,7 @@ int iio_simple_dummy_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 iio_dummy_state *st = iio_priv(indio_dev);
 
index bb23569..ba877d0 100644 (file)
@@ -748,7 +748,7 @@ static int bmg160_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 bmg160_data *data = iio_priv(indio_dev);
        int ret;
index 1e6c083..76a88e1 100644 (file)
@@ -785,7 +785,7 @@ static const struct attribute_group bmi323_event_attribute_group = {
 static int bmi323_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)
+                                    enum iio_event_direction dir, bool state)
 {
        struct bmi323_data *data = iio_priv(indio_dev);
 
index 21ebf0f..4027135 100644 (file)
@@ -1173,7 +1173,7 @@ static int inv_mpu6050_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 inv_mpu6050_state *st = iio_priv(indio_dev);
 
index 2af7727..324c387 100644 (file)
@@ -942,7 +942,7 @@ static int kmx61_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 kmx61_data *data = kmx61_get_data(indio_dev);
        int ret = 0;
index fb4c6c3..caefa15 100644 (file)
@@ -1959,7 +1959,7 @@ static int
 st_lsm6dsx_write_event_config(struct iio_dev *iio_dev,
                              const struct iio_chan_spec *chan,
                              enum iio_event_type type,
-                             enum iio_event_direction dir, int state)
+                             enum iio_event_direction dir, bool state)
 {
        struct st_lsm6dsx_sensor *sensor = iio_priv(iio_dev);
        struct st_lsm6dsx_hw *hw = sensor->hw;
index 06d5bc1..593d614 100644 (file)
@@ -502,7 +502,8 @@ fail:
 static int adux1020_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)
+                                      enum iio_event_direction dir,
+                                      bool state)
 {
        struct adux1020_data *data = iio_priv(indio_dev);
        int ret, mask;
index 11f2ab4..95861b2 100644 (file)
@@ -321,7 +321,7 @@ static int apds9300_read_interrupt_config(struct iio_dev *indio_dev,
 
 static int apds9300_write_interrupt_config(struct iio_dev *indio_dev,
                const struct iio_chan_spec *chan, enum iio_event_type type,
-               enum iio_event_direction dir, int state)
+               enum iio_event_direction dir, bool state)
 {
        struct apds9300_data *data = iio_priv(indio_dev);
        int ret;
index 079e02b..8adc740 100644 (file)
@@ -1071,7 +1071,7 @@ static int apds9306_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 apds9306_data *data = iio_priv(indio_dev);
        struct apds9306_regfields *rf = &data->rf;
index 3a56eaa..a7f0cc9 100644 (file)
@@ -757,7 +757,7 @@ static int apds9960_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 apds9960_data *data = iio_priv(indio_dev);
        int ret;
index fc6bf06..23e9f16 100644 (file)
@@ -638,7 +638,7 @@ static int bh1745_read_event_config(struct iio_dev *indio_dev,
 static int bh1745_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)
+                                    enum iio_event_direction dir, bool state)
 {
        struct bh1745_data *data = iio_priv(indio_dev);
        int value;
index a4a1505..ae3fc32 100644 (file)
@@ -529,7 +529,7 @@ static int cm36651_write_prox_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 cm36651_data *cm36651 = iio_priv(indio_dev);
        int cmd, ret;
index f8b1d7d..d56ee21 100644 (file)
@@ -340,7 +340,7 @@ static int gp2ap002_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 gp2ap002 *gp2ap002 = iio_priv(indio_dev);
 
index 81e718c..1a352c8 100644 (file)
@@ -1159,7 +1159,7 @@ static int gp2ap020a00f_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 gp2ap020a00f_data *data = iio_priv(indio_dev);
        enum gp2ap020a00f_cmd cmd;
index 6de33fe..b9f2302 100644 (file)
@@ -271,7 +271,7 @@ static int iqs621_als_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 iqs621_als_private *iqs621_als = iio_priv(indio_dev);
        struct iqs62x_core *iqs62x = iqs621_als->iqs62x;
index 3bdffb6..df664f3 100644 (file)
@@ -553,7 +553,7 @@ static int ltr390_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 ltr390_data *data = iio_priv(indio_dev);
        int ret;
index 616dc69..604f5f9 100644 (file)
@@ -1077,7 +1077,7 @@ static int ltr501_read_event_config(struct iio_dev *indio_dev,
 static int ltr501_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)
+                                    enum iio_event_direction dir, bool state)
 {
        struct ltr501_data *data = iio_priv(indio_dev);
        int ret;
index 3b92362..8cd7f56 100644 (file)
@@ -422,7 +422,7 @@ static int max44009_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 max44009_data *data = iio_priv(indio_dev);
        int ret;
index ff7fc0d..65b2958 100644 (file)
@@ -634,7 +634,7 @@ static int opt3001_read_event_config(struct iio_dev *iio,
 
 static int opt3001_write_event_config(struct iio_dev *iio,
                const struct iio_chan_spec *chan, enum iio_event_type type,
-               enum iio_event_direction dir, int state)
+               enum iio_event_direction dir, bool state)
 {
        struct opt3001 *opt = iio_priv(iio);
        int ret;
index c6f950a..b81cc44 100644 (file)
@@ -324,7 +324,7 @@ static int stk3310_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)
 {
        int ret;
        struct stk3310_data *data = iio_priv(indio_dev);
index 04452b4..4186aac 100644 (file)
@@ -327,7 +327,7 @@ static int tcs3472_read_event_config(struct iio_dev *indio_dev,
 
 static int tcs3472_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)
+       enum iio_event_direction dir, bool state)
 {
        struct tcs3472_data *data = iio_priv(indio_dev);
        int ret = 0;
index 1a6f514..f1fe764 100644 (file)
@@ -630,7 +630,7 @@ static irqreturn_t tsl2563_event_handler(int irq, void *private)
 
 static int tsl2563_write_interrupt_config(struct iio_dev *indio_dev,
        const struct iio_chan_spec *chan, enum iio_event_type type,
-       enum iio_event_direction dir, int state)
+       enum iio_event_direction dir, bool state)
 {
        struct tsl2563_chip *chip = iio_priv(indio_dev);
        int ret = 0;
index 850c246..b81ca6f 100644 (file)
@@ -985,7 +985,7 @@ static int tsl2591_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 tsl2591_chip *chip = iio_priv(indio_dev);
        struct i2c_client *client = chip->client;
index 26082f2..349afdc 100644 (file)
@@ -1081,7 +1081,7 @@ static int tsl2772_write_interrupt_config(struct iio_dev *indio_dev,
                                          const struct iio_chan_spec *chan,
                                          enum iio_event_type type,
                                          enum iio_event_direction dir,
-                                         int val)
+                                         bool val)
 {
        struct tsl2772_chip *chip = iio_priv(indio_dev);
 
index de6967a..c83114a 100644 (file)
@@ -627,7 +627,7 @@ static int us5182d_read_event_config(struct iio_dev *indio_dev,
 
 static int us5182d_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)
+       enum iio_event_direction dir, bool state)
 {
        struct us5182d_data *data = iio_priv(indio_dev);
        int ret;
index 4e3641f..e19199b 100644 (file)
@@ -1456,7 +1456,7 @@ static int vcnl4010_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)
 {
        switch (chan->type) {
        case IIO_PROXIMITY:
@@ -1501,7 +1501,8 @@ static int vcnl4040_read_event_config(struct iio_dev *indio_dev,
 static int vcnl4040_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)
+                                      enum iio_event_direction dir,
+                                      bool state)
 {
        int ret = -EINVAL;
        u16 val, mask;
index 95751c1..208a040 100644 (file)
@@ -821,7 +821,7 @@ static int veml6030_read_interrupt_config(struct iio_dev *indio_dev,
  */
 static int veml6030_write_interrupt_config(struct iio_dev *indio_dev,
                const struct iio_chan_spec *chan, enum iio_event_type type,
-               enum iio_event_direction dir, int state)
+               enum iio_event_direction dir, bool state)
 {
        int ret;
        struct veml6030_data *data = iio_priv(indio_dev);
index 4d74523..8239239 100644 (file)
@@ -181,7 +181,7 @@ static int iqs624_pos_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 iqs624_pos_private *iqs624_pos = iio_priv(indio_dev);
        struct iqs62x_core *iqs62x = iqs624_pos->iqs62x;
index 707ba0a..cdd254d 100644 (file)
@@ -422,7 +422,7 @@ static int aw96103_read_event_config(struct iio_dev *indio_dev,
 static int aw96103_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)
+                                     enum iio_event_direction dir, bool state)
 {
        struct aw96103 *aw96103 = iio_priv(indio_dev);
 
index b1a4a92..667369b 100644 (file)
@@ -167,7 +167,7 @@ static int cros_ec_mkbp_proximity_read_event_config(struct iio_dev *indio_dev,
 static int cros_ec_mkbp_proximity_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)
+                                    enum iio_event_direction dir, bool state)
 {
        struct cros_ec_mkbp_proximity_data *data = iio_priv(indio_dev);
 
index 38441b1..4021feb 100644 (file)
@@ -874,7 +874,7 @@ static int hx9023s_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 hx9023s_data *data = iio_priv(indio_dev);
 
index fb0691d..b09d152 100644 (file)
@@ -648,7 +648,8 @@ static int irsd200_read_event_config(struct iio_dev *indio_dev,
 static int irsd200_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)
+                                     enum iio_event_direction dir,
+                                     bool state)
 {
        struct irsd200_data *data = iio_priv(indio_dev);
        unsigned int tmp;
index e3da709..c4e94d0 100644 (file)
@@ -540,7 +540,7 @@ static int sx9500_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 sx9500_data *data = iio_priv(indio_dev);
        int ret;
index bcf502e..76384c7 100644 (file)
@@ -268,7 +268,7 @@ EXPORT_SYMBOL_NS_GPL(sx_common_read_event_config, SEMTECH_PROX);
 int sx_common_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)
+                                enum iio_event_direction dir, bool state)
 {
        struct sx_common_data *data = iio_priv(indio_dev);
        unsigned int eventirq = SX_COMMON_FAR_IRQ | SX_COMMON_CLOSE_IRQ;
index da53268..fb14e6f 100644 (file)
@@ -143,7 +143,7 @@ int sx_common_read_event_config(struct iio_dev *indio_dev,
 int sx_common_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);
+                                enum iio_event_direction dir, bool state);
 
 int sx_common_probe(struct i2c_client *client,
                    const struct sx_common_chip_info *chip_info,
index d1ddf85..bb6c9cc 100644 (file)
@@ -449,7 +449,7 @@ static int vcnl3020_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)
 {
        switch (chan->type) {
        case IIO_PROXIMITY:
index f1bb097..c244786 100644 (file)
@@ -200,7 +200,7 @@ static int mcp9600_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 mcp9600_data *data = iio_priv(indio_dev);
        struct i2c_client *client = data->client;
index 9bdfa94..fd4d389 100644 (file)
@@ -216,7 +216,7 @@ static irqreturn_t tmp007_interrupt_handler(int irq, void *private)
 
 static int tmp007_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)
+               enum iio_event_direction dir, bool state)
 {
        struct tmp007_data *data = iio_priv(indio_dev);
        unsigned int status_mask;
index 5c6682b..59c58f4 100644 (file)
@@ -514,7 +514,7 @@ struct iio_info {
                                  const struct iio_chan_spec *chan,
                                  enum iio_event_type type,
                                  enum iio_event_direction dir,
-                                 int state);
+                                 bool state);
 
        int (*read_event_value)(struct iio_dev *indio_dev,
                                const struct iio_chan_spec *chan,