iio: chemical: ens160: use regmap_assign_bits() for conditional set/clear

Replace if/else block using regmap_set_bits()/regmap_clear_bits() with
the simpler regmap_assign_bits() call.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
This commit is contained in:
Peng Fan 2026-09-24 16:35:26 +08:00 committed by Jonathan Cameron
parent c051d08d98
commit eb48e411a3

View File

@ -283,12 +283,7 @@ static int ens160_set_trigger_state(struct iio_trigger *trig, bool state)
ENS160_REG_CONFIG_INTDAT |
ENS160_REG_CONFIG_INT_CFG;
if (state)
return regmap_set_bits(data->regmap, ENS160_REG_CONFIG,
int_bits);
else
return regmap_clear_bits(data->regmap, ENS160_REG_CONFIG,
int_bits);
return regmap_assign_bits(data->regmap, ENS160_REG_CONFIG, int_bits, state);
}
static const struct iio_trigger_ops ens160_trigger_ops = {