Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Geert Uytterhoeven and committed by
Jonathan Cameron
188c3382 f65de31f

+2 -6
+2 -6
drivers/iio/imu/smi330/smi330_core.c
··· 67 67 #define SMI330_CHIP_ID 0x42 68 68 #define SMI330_SOFT_RESET_DELAY 2000 69 69 70 - /* Non-constant mask variant of FIELD_GET() and FIELD_PREP() */ 71 - #define smi330_field_get(_mask, _reg) (((_reg) & (_mask)) >> (ffs(_mask) - 1)) 72 - #define smi330_field_prep(_mask, _val) (((_val) << (ffs(_mask) - 1)) & (_mask)) 73 - 74 70 #define SMI330_ACCEL_CHANNEL(_axis) { \ 75 71 .type = IIO_ACCEL, \ 76 72 .modified = 1, \ ··· 357 361 if (ret) 358 362 return ret; 359 363 360 - reg_val = smi330_field_get(attr->mask, reg_val); 364 + reg_val = field_get(attr->mask, reg_val); 361 365 362 366 if (attr->type == IIO_VAL_INT) { 363 367 for (i = 0; i < attr->len; i++) { ··· 406 410 if (ret) 407 411 return ret; 408 412 409 - reg_val = smi330_field_prep(attr->mask, reg_val); 413 + reg_val = field_prep(attr->mask, reg_val); 410 414 ret = regmap_update_bits(data->regmap, reg, attr->mask, reg_val); 411 415 if (ret) 412 416 return ret;