drivers/iio/imu/smi330/smi330_core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
Drop the driver-specific smi330_field_get() and smi330_field_prep()
macros, in favor of the globally available variants from
<linux/bitfield.h>.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v7:
- Update for the renamed smi330_field_{get,prep}() helpers,
v6:
- No changes,
v5:
- New.
---
drivers/iio/imu/smi330/smi330_core.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/imu/smi330/smi330_core.c b/drivers/iio/imu/smi330/smi330_core.c
index 7564f12543e0ca04..83e0dff5d973d046 100644
--- a/drivers/iio/imu/smi330/smi330_core.c
+++ b/drivers/iio/imu/smi330/smi330_core.c
@@ -67,10 +67,6 @@
#define SMI330_CHIP_ID 0x42
#define SMI330_SOFT_RESET_DELAY 2000
-/* Non-constant mask variant of FIELD_GET() and FIELD_PREP() */
-#define smi330_field_get(_mask, _reg) (((_reg) & (_mask)) >> (ffs(_mask) - 1))
-#define smi330_field_prep(_mask, _val) (((_val) << (ffs(_mask) - 1)) & (_mask))
-
#define SMI330_ACCEL_CHANNEL(_axis) { \
.type = IIO_ACCEL, \
.modified = 1, \
@@ -361,7 +357,7 @@ static int smi330_get_sensor_config(struct smi330_data *data,
if (ret)
return ret;
- reg_val = smi330_field_get(attr->mask, reg_val);
+ reg_val = field_get(attr->mask, reg_val);
if (attr->type == IIO_VAL_INT) {
for (i = 0; i < attr->len; i++) {
@@ -410,7 +406,7 @@ static int smi330_set_sensor_config(struct smi330_data *data,
if (ret)
return ret;
- reg_val = smi330_field_prep(attr->mask, reg_val);
+ reg_val = field_prep(attr->mask, reg_val);
ret = regmap_update_bits(data->regmap, reg, attr->mask, reg_val);
if (ret)
return ret;
--
2.43.0
On Thu, 15 Jan 2026 15:24:16 +0100 Geert Uytterhoeven <geert+renesas@glider.be> wrote: > Drop the driver-specific smi330_field_get() and smi330_field_prep() > macros, in favor of the globally available variants from > <linux/bitfield.h>. > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Hi Geert Thanks for coming back to this. Applied to the testing branch of iio.git. Once the bots are happy with that I'll push it out as togreg for linux-next to pick up. Jonathan
© 2016 - 2026 Red Hat, Inc.