[PATCH/RFC 10/17] media: ti-vpe: cal: Use bitfield helpers
Geert Uytterhoeven
geert+renesas at glider.be
Mon Nov 22 16:54:03 CET 2021
Use the field_prep() helper, instead of open-coding the same operation.
Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
Compile-tested only.
Marked RFC, as this depends on [PATCH 01/17], but follows a different
path to upstream.
---
drivers/media/platform/ti-vpe/cal.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/ti-vpe/cal.h b/drivers/media/platform/ti-vpe/cal.h
index 527e22d022f300b7..5fcf1b55ff2879ac 100644
--- a/drivers/media/platform/ti-vpe/cal.h
+++ b/drivers/media/platform/ti-vpe/cal.h
@@ -303,7 +303,7 @@ static inline void cal_write_field(struct cal_dev *cal, u32 offset, u32 value,
u32 val = cal_read(cal, offset);
val &= ~mask;
- val |= (value << __ffs(mask)) & mask;
+ val |= field_prep(mask, value);
cal_write(cal, offset, val);
}
@@ -312,7 +312,7 @@ static inline void cal_set_field(u32 *valp, u32 field, u32 mask)
u32 val = *valp;
val &= ~mask;
- val |= (field << __ffs(mask)) & mask;
+ val |= field_prep(mask, field);
*valp = val;
}
--
2.25.1
More information about the Alsa-devel
mailing list