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

Peng Fan (OSS) posted 1 patch 3 hours ago
drivers/iio/chemical/ens160_core.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
[PATCH] iio: chemical: ens160: use regmap_assign_bits() for conditional set/clear
Posted by Peng Fan (OSS) 3 hours ago
From: Peng Fan <peng.fan@nxp.com>

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>
---
 drivers/iio/chemical/ens160_core.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/iio/chemical/ens160_core.c b/drivers/iio/chemical/ens160_core.c
index 7c1ffda38b99c..5e2b15463c99e 100644
--- a/drivers/iio/chemical/ens160_core.c
+++ b/drivers/iio/chemical/ens160_core.c
@@ -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 = {
-- 
2.50.1
Re: [PATCH] iio: chemical: ens160: use regmap_assign_bits() for conditional set/clear
Posted by Joshua Crofts 39 minutes ago
On Thu, 24 Sep 2026 16:35:26 +0800
"Peng Fan (OSS)" <peng.fan@oss.nxp.com> wrote:

> From: Peng Fan <peng.fan@nxp.com>
> 
> 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>

-- 
Kind regards,
Joshua Crofts