]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iio: light: tsl2591: remove unneeded tsl2591_compatible_als_persist_cycle()
authorLucas Rabaquim <lucas.rabaquim@usp.br>
Tue, 2 Jun 2026 18:11:49 +0000 (15:11 -0300)
committerJonathan Cameron <jic23@kernel.org>
Wed, 3 Jun 2026 11:10:56 +0000 (12:10 +0100)
The function was only used to verify if als_persist is a
TSL2591_PRST_ALS_INT_CYCLE_* value. However, before its call in
tsl2591_write_event_value(), the line
als_persist = tsl2591_persist_lit_to_cycle(period) is executed,
meaning that by the time tsl2591_compatible_als_persist_cycle()
is reached, als_persist is a TSL2591_PRST_ALS_INT_CYCLE_* value,
making the verification pointless.

Suggested-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260528185912.24774-1-matheus.feitosa%40usp.br
Signed-off-by: Lucas Rabaquim <lucas.rabaquim@usp.br>
Co-developed-by: Matheus Silveira <matheus.feitosa@usp.br>
Signed-off-by: Matheus Silveira <matheus.feitosa@usp.br>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/light/tsl2591.c

index ac5e1822b993d84741f50285c3796070c6f2379c..f3ffa9721ad57b073036e8d2e4e51d28a43a1ba7 100644 (file)
@@ -308,31 +308,6 @@ static int tsl2591_compatible_gain(struct tsl2591_chip *chip, const u8 als_gain)
        }
 }
 
-static int tsl2591_compatible_als_persist_cycle(struct tsl2591_chip *chip,
-                                               const u32 als_persist)
-{
-       switch (als_persist) {
-       case TSL2591_PRST_ALS_INT_CYCLE_ANY:
-       case TSL2591_PRST_ALS_INT_CYCLE_2:
-       case TSL2591_PRST_ALS_INT_CYCLE_3:
-       case TSL2591_PRST_ALS_INT_CYCLE_5:
-       case TSL2591_PRST_ALS_INT_CYCLE_10:
-       case TSL2591_PRST_ALS_INT_CYCLE_15:
-       case TSL2591_PRST_ALS_INT_CYCLE_20:
-       case TSL2591_PRST_ALS_INT_CYCLE_25:
-       case TSL2591_PRST_ALS_INT_CYCLE_30:
-       case TSL2591_PRST_ALS_INT_CYCLE_35:
-       case TSL2591_PRST_ALS_INT_CYCLE_40:
-       case TSL2591_PRST_ALS_INT_CYCLE_45:
-       case TSL2591_PRST_ALS_INT_CYCLE_50:
-       case TSL2591_PRST_ALS_INT_CYCLE_55:
-       case TSL2591_PRST_ALS_INT_CYCLE_60:
-               return 0;
-       default:
-               return -EINVAL;
-       }
-}
-
 static int tsl2591_check_als_valid(struct i2c_client *client)
 {
        int ret;
@@ -914,10 +889,6 @@ static int tsl2591_write_event_value(struct iio_dev *indio_dev,
                        goto err_unlock;
                }
 
-               ret = tsl2591_compatible_als_persist_cycle(chip, als_persist);
-               if (ret < 0)
-                       goto err_unlock;
-
                ret = tsl2591_set_als_persist_cycle(chip, als_persist);
                if (ret < 0)
                        goto err_unlock;