mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
iio: light: tsl2591: remove unneeded tsl2591_compatible_als_persist_cycle()
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>
This commit is contained in:
parent
ae8360f371
commit
b1d1bfa26c
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user