iio: imu: inv_mpu6050: simplify code in write_event_config callback
authorJulien Stephan <jstephan@baylibre.com>
Thu, 24 Oct 2024 09:11:27 +0000 (11:11 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Fri, 1 Nov 2024 14:54:45 +0000 (14:54 +0000)
iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.

Remove useless code in write_event_config callback.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20241024-iio-fix-write-event-config-signature-v1-5-7d29e5a31b00@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
drivers/iio/light/apds9960.c

index 5680be1..21ebf0f 100644 (file)
@@ -1176,21 +1176,18 @@ static int inv_mpu6050_write_event_config(struct iio_dev *indio_dev,
                                          int state)
 {
        struct inv_mpu6050_state *st = iio_priv(indio_dev);
-       int enable;
 
        /* support only WoM (accel roc rising) event */
        if (chan->type != IIO_ACCEL || type != IIO_EV_TYPE_ROC ||
            dir != IIO_EV_DIR_RISING)
                return -EINVAL;
 
-       enable = !!state;
-
        guard(mutex)(&st->lock);
 
-       if (st->chip_config.wom_en == enable)
+       if (st->chip_config.wom_en == state)
                return 0;
 
-       return inv_mpu6050_enable_wom(st, enable);
+       return inv_mpu6050_enable_wom(st, state);
 }
 
 static int inv_mpu6050_read_event_value(struct iio_dev *indio_dev,
index 3c14e4c..3a56eaa 100644 (file)
@@ -762,8 +762,6 @@ static int apds9960_write_event_config(struct iio_dev *indio_dev,
        struct apds9960_data *data = iio_priv(indio_dev);
        int ret;
 
-       state = !!state;
-
        switch (chan->type) {
        case IIO_PROXIMITY:
                if (data->pxs_int == state)