]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iio: light: adux1020: write_event_config: use local variable for interrupt value
authorJulien Stephan <jstephan@baylibre.com>
Thu, 31 Oct 2024 15:27:01 +0000 (16:27 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 3 Nov 2024 20:33:43 +0000 (20:33 +0000)
state parameter is currently an int, 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.  The code
in adux1020_write_event_config re-uses state parameter to store an
integer value. To prepare for updating the write_event_config signature
to use a boolean for state, introduce a new local int variable.

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

index 2e0170be077aef9aa194fab51afbb33aec02e513..06d5bc1d246c08fa37994add7fc23dce866de9ad 100644 (file)
@@ -526,12 +526,11 @@ static int adux1020_write_event_config(struct iio_dev *indio_dev,
                        mask = ADUX1020_PROX_OFF1_INT;
 
                if (state)
-                       state = 0;
+                       ret = regmap_clear_bits(data->regmap,
+                                               ADUX1020_REG_INT_MASK, mask);
                else
-                       state = mask;
-
-               ret = regmap_update_bits(data->regmap, ADUX1020_REG_INT_MASK,
-                                        mask, state);
+                       ret = regmap_set_bits(data->regmap,
+                                             ADUX1020_REG_INT_MASK, mask);
                if (ret < 0)
                        goto fail;