[PATCH v3 27/41] iio: imu: inv_icm42600: make use of regmap_clear_bits(), regmap_set_bits()

Jean-Baptiste Maneyrol Jean-Baptiste.Maneyrol at tdk.com
Thu Jun 20 13:13:21 PDT 2024


Hello Trevor,

looks good for me, thanks for the patch.

Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol at tdk.com>

Thanks,
JB
________________________________________
From: Trevor Gamblin <tgamblin at baylibre.com>
Sent: Monday, June 17, 2024 15:50
To: Jonathan Cameron <jic23 at kernel.org>; Lars-Peter Clausen <lars at metafoo.de>; Dmitry Rokosov <ddrokosov at sberdevices.ru>; Michael Hennerich <Michael.Hennerich at analog.com>; Cosmin Tanislav <cosmin.tanislav at analog.com>; Chen-Yu Tsai <wens at csie.org>; Hans de Goede <hdegoede at redhat.com>; Ray Jui <rjui at broadcom.com>; Scott Branden <sbranden at broadcom.com>; Broadcom internal kernel review list <bcm-kernel-feedback-list at broadcom.com>; Shawn Guo <shawnguo at kernel.org>; Sascha Hauer <s.hauer at pengutronix.de>; Pengutronix Kernel Team <kernel at pengutronix.de>; Fabio Estevam <festevam at gmail.com>; Neil Armstrong <neil.armstrong at linaro.org>; Kevin Hilman <khilman at baylibre.com>; Jerome Brunet <jbrunet at baylibre.com>; Martin Blumenstingl <martin.blumenstingl at googlemail.com>; Saravanan Sekar <sravanhome at gmail.com>; Orson Zhai <orsonzhai at gmail.com>; Baolin Wang <baolin.wang at linux.alibaba.com>; Chunyan Zhang <zhang.lyra at gmail.com>; Maxime Coquelin <mcoquelin.stm32 at gmail.com>; Alexandre Torgue <alexandre.torgue at foss.st.com>; Nuno Sá <nuno.sa at analog.com>; Linus Walleij <linus.walleij at linaro.org>; Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol at tdk.com>; Crt Mori <cmo at melexis.com>
Cc: linux-iio at vger.kernel.org <linux-iio at vger.kernel.org>; linux-kernel at vger.kernel.org <linux-kernel at vger.kernel.org>; linux-arm-kernel at lists.infradead.org <linux-arm-kernel at lists.infradead.org>; imx at lists.linux.dev <imx at lists.linux.dev>; linux-amlogic at lists.infradead.org <linux-amlogic at lists.infradead.org>; linux-arm-msm at vger.kernel.org <linux-arm-msm at vger.kernel.org>; linux-stm32 at st-md-mailman.stormreply.com <linux-stm32 at st-md-mailman.stormreply.com>; Uwe Kleine-König <u.kleine-koenig at baylibre.com>; Trevor Gamblin <tgamblin at baylibre.com>
Subject: [PATCH v3 27/41] iio: imu: inv_icm42600: make use of regmap_clear_bits(), regmap_set_bits()
 
This Message Is From an External Sender
This message came from outside your organization.
 
Instead of using regmap_update_bits() and passing the mask twice, use
regmap_set_bits().

Instead of using regmap_update_bits() and passing val = 0, use
regmap_clear_bits().

Suggested-by: Uwe Kleine-König <u.kleine-koenig at baylibre.com>
Signed-off-by: Trevor Gamblin <tgamblin at baylibre.com>
---
 drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c | 14 ++++++--------
 drivers/iio/imu/inv_icm42600/inv_icm42600_core.c   |  9 ++++-----
 drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c    |  4 ++--
 drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c    |  4 ++--
 4 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
index 63b85ec88c13..509fe6a3ae97 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
@@ -262,9 +262,8 @@ int inv_icm42600_buffer_update_watermark(struct inv_icm42600_state *st)
 
 	/* restore watermark interrupt */
 	if (restore) {
-		ret = regmap_update_bits(st->map, INV_ICM42600_REG_INT_SOURCE0,
-					 INV_ICM42600_INT_SOURCE0_FIFO_THS_INT1_EN,
-					 INV_ICM42600_INT_SOURCE0_FIFO_THS_INT1_EN);
+		ret = regmap_set_bits(st->map, INV_ICM42600_REG_INT_SOURCE0,
+				      INV_ICM42600_INT_SOURCE0_FIFO_THS_INT1_EN);
 		if (ret)
 			return ret;
 	}
@@ -306,9 +305,8 @@ static int inv_icm42600_buffer_postenable(struct iio_dev *indio_dev)
 	}
 
 	/* set FIFO threshold interrupt */
-	ret = regmap_update_bits(st->map, INV_ICM42600_REG_INT_SOURCE0,
-				 INV_ICM42600_INT_SOURCE0_FIFO_THS_INT1_EN,
-				 INV_ICM42600_INT_SOURCE0_FIFO_THS_INT1_EN);
+	ret = regmap_set_bits(st->map, INV_ICM42600_REG_INT_SOURCE0,
+			      INV_ICM42600_INT_SOURCE0_FIFO_THS_INT1_EN);
 	if (ret)
 		goto out_unlock;
 
@@ -363,8 +361,8 @@ static int inv_icm42600_buffer_predisable(struct iio_dev *indio_dev)
 		goto out_unlock;
 
 	/* disable FIFO threshold interrupt */
-	ret = regmap_update_bits(st->map, INV_ICM42600_REG_INT_SOURCE0,
-				 INV_ICM42600_INT_SOURCE0_FIFO_THS_INT1_EN, 0);
+	ret = regmap_clear_bits(st->map, INV_ICM42600_REG_INT_SOURCE0,
+				INV_ICM42600_INT_SOURCE0_FIFO_THS_INT1_EN);
 	if (ret)
 		goto out_unlock;
 
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
index 96116a68ab29..bb302f5540cf 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
@@ -435,9 +435,8 @@ static int inv_icm42600_setup(struct inv_icm42600_state *st,
 		return ret;
 
 	/* sensor data in big-endian (default) */
-	ret = regmap_update_bits(st->map, INV_ICM42600_REG_INTF_CONFIG0,
-				 INV_ICM42600_INTF_CONFIG0_SENSOR_DATA_ENDIAN,
-				 INV_ICM42600_INTF_CONFIG0_SENSOR_DATA_ENDIAN);
+	ret = regmap_set_bits(st->map, INV_ICM42600_REG_INTF_CONFIG0,
+			      INV_ICM42600_INTF_CONFIG0_SENSOR_DATA_ENDIAN);
 	if (ret)
 		return ret;
 
@@ -532,8 +531,8 @@ static int inv_icm42600_irq_init(struct inv_icm42600_state *st, int irq,
 		return ret;
 
 	/* Deassert async reset for proper INT pin operation (cf datasheet) */
-	ret = regmap_update_bits(st->map, INV_ICM42600_REG_INT_CONFIG1,
-				 INV_ICM42600_INT_CONFIG1_ASYNC_RESET, 0);
+	ret = regmap_clear_bits(st->map, INV_ICM42600_REG_INT_CONFIG1,
+				INV_ICM42600_INT_CONFIG1_ASYNC_RESET);
 	if (ret)
 		return ret;
 
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
index 8d33504d770f..ebb31b385881 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
@@ -28,8 +28,8 @@ static int inv_icm42600_i2c_bus_setup(struct inv_icm42600_state *st)
 			   INV_ICM42600_INTF_CONFIG6_MASK,
 			   INV_ICM42600_INTF_CONFIG6_I3C_EN);
 
-	ret = regmap_update_bits(st->map, INV_ICM42600_REG_INTF_CONFIG4,
-				 INV_ICM42600_INTF_CONFIG4_I3C_BUS_ONLY, 0);
+	ret = regmap_clear_bits(st->map, INV_ICM42600_REG_INTF_CONFIG4,
+				INV_ICM42600_INTF_CONFIG4_I3C_BUS_ONLY);
 	if (ret)
 		return ret;
 
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
index cc2bf1799a46..eae5ff7a3cc1 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
@@ -27,8 +27,8 @@ static int inv_icm42600_spi_bus_setup(struct inv_icm42600_state *st)
 	if (ret)
 		return ret;
 
-	ret = regmap_update_bits(st->map, INV_ICM42600_REG_INTF_CONFIG4,
-				 INV_ICM42600_INTF_CONFIG4_I3C_BUS_ONLY, 0);
+	ret = regmap_clear_bits(st->map, INV_ICM42600_REG_INTF_CONFIG4,
+				INV_ICM42600_INTF_CONFIG4_I3C_BUS_ONLY);
 	if (ret)
 		return ret;
 

-- 
2.45.2




More information about the linux-amlogic mailing list