summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2026-01-15 17:24:16 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2026-01-16 22:44:57 +0300
commit188c33824098ced363676b4e63f062b7a747ed81 (patch)
tree954d5fe63625c3ea0896c7a4d41a5cb3b172f199
parentf65de31fb6aba70133a0cb57bba6f84b5fb4d695 (diff)
downloadlinux-188c33824098ced363676b4e63f062b7a747ed81.tar.xz
iio: imu: smi330: Convert to common field_{get,prep}() helpers
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> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r--drivers/iio/imu/smi330/smi330_core.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/iio/imu/smi330/smi330_core.c b/drivers/iio/imu/smi330/smi330_core.c
index 0cf673b44b62..7ec5ae7f521a 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;