]> www.infradead.org Git - users/willy/xarray.git/commitdiff
iio: light: apds9306: simplifies if branch in apds9306_write_event_config
authorJulien Stephan <jstephan@baylibre.com>
Thu, 31 Oct 2024 15:27:08 +0000 (16:27 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 3 Nov 2024 20:33:44 +0000 (20:33 +0000)
Simplifies the regmap_wite if branch in apds9306_write_event_config.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-13-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/apds9306.c

index 8adc74040db2bddf93fbb773e3519abcc726b9a6..9c08e7c3ad0c17519689a630d42fe9b90438dfe8 100644 (file)
@@ -1125,10 +1125,7 @@ static int apds9306_write_event_config(struct iio_dev *indio_dev,
                }
        }
        case IIO_EV_TYPE_THRESH_ADAPTIVE:
-               if (state)
-                       return regmap_field_write(rf->int_thresh_var_en, 1);
-               else
-                       return regmap_field_write(rf->int_thresh_var_en, 0);
+               return regmap_field_write(rf->int_thresh_var_en, state);
        default:
                return -EINVAL;
        }