iio: imu: inv_mpu6050: simplify code in write_event_config callback

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>
This commit is contained in:
Julien Stephan
2024-10-24 11:11:27 +02:00
committed by Jonathan Cameron
parent d567ff3603
commit 71490e9ef5
2 changed files with 2 additions and 7 deletions

View 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,

View 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)