iio: imu: inv_icm42600: make use of regmap_clear_bits(), regmap_set_bits()
authorTrevor Gamblin <tgamblin@baylibre.com>
Mon, 17 Jun 2024 13:50:07 +0000 (09:50 -0400)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 25 Jun 2024 20:04:47 +0000 (21:04 +0100)
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@baylibre.com>
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/20240617-review-v3-27-88d1338c4cca@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c

index a8cf74c84c3c4560e80e2b87f68d55fe1860ba01..aae7c56481a3fa4351e921fb98ce61d31d1d7d6a 100644 (file)
@@ -274,9 +274,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;
        }
@@ -318,9 +317,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;
 
@@ -375,8 +373,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;
 
index 61f1f6d4c421fce0012cd08eb3550c71d59a80d8..c3924cc6190ee4ad101621f22349b7804a35fa3b 100644 (file)
@@ -496,9 +496,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;
 
@@ -603,8 +602,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;
 
index 8d33504d770f7b6798f7929dbea217d418cc8fab..ebb31b385881e1a835b7ab81ad7582a729a10d5f 100644 (file)
@@ -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;
 
index cc2bf1799a46532f88f690b1c07eefa34df86b86..eae5ff7a3cc102e2487f6310d18cb55745df77b0 100644 (file)
@@ -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;