bitfield: Restore be16_replace_bits()
PATCH 1/1 bitfield: Restore be16_replace_bits()
Commit 1c88ceb09d5e5 ("bitfield: get rid of __MAKE_OP machinery") removed a bunch of unused bitfield operations including be16_replace_bits() but commit 508bdb4938928 ("iio: adc: Add AD7768 and AD7768-4 core support") introduces a new user. Restore the function so the build still works once both branches are merged.
--- include/linux/bitfield-fix-width.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/linux/bitfield-fix-width.h +6 -0
@@ -93,6 +93,12 @@ u16 be16_get_bits(__be16 v, u16 field)return (be16_to_cpu (v) & field) /field_multiplier (field); } +static __always_inline __must_check +__be16 be16_replace_bits(__be16 old, u16 val, u16 field) +{ +return (old & ~cpu_to_be16 (field)) |be16_encode_bits (val, field); +} +static __always_inline __must_check __u16 u16_encode_bits(u16 v, u16 field) {
---
base-commit: 1c88ceb09d5e5506456a625043bc9b35ce86fc41
change-id: 20260923-bitfield-be16_replace_bits-1d6c48fb608b
Best regards,
Signature · 1 line
Mark Brown <[email protected]>
Yury Norov
AppliedQuoted 7 lines · Mark Brown
Commit
1c88ceb09d5e5("bitfield: get rid of__MAKE_OPmachinery") removed a bunch of unused bitfield operations includingbe16_replace_bits()but commit508bdb4938928("iio: adc: Add AD7768 and AD7768-4 core support") introduces a new user. Restore the function so the build still works once both branches are merged.Signed-off-by Mark Brown <[email protected]>
Applied, thanks!
Quoted 29 lines
--- include/linux/bitfield-fix-width.h | 6 ++++++ 1 file changed, 6 insertions(+)include/linux/bitfield-fix-width.h +6
-1@@ -93,6 +93,12 @@ u16 be16_get_bits(__be16 v, u16 field)return (be16_to_cpu (v) & field) /field_multiplier (field); } +static __always_inline __must_check +__be16 be16_replace_bits(__be16 old, u16 val, u16 field) +{ +return (old & ~cpu_to_be16 (field)) |be16_encode_bits (val, field); +} +static __always_inline __must_check __u16 u16_encode_bits(u16 v, u16 field) { ---base-commit:
1c88ceb09d5e5506456a625043bc9b35ce86fc41
change-id: 20260923-bitfield-be16_replace_bits-1d6c48fb608bBest regards,
Signature · 1 line
Mark Brown <[email protected]>