From: Simon Glass <simon.glass@canonical.com> Move the rol32() rotate-left function from ext4_uboot.h to include/linux/bitops.h where it logically belongs alongside other bit manipulation functions. Also add ror32() for completeness. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- fs/ext4l/ext4_uboot.h | 7 +------ include/linux/bitops.h | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index b2a33a17198..68dca2f8d4e 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -65,12 +65,7 @@ #undef no_printk #define no_printk(fmt, ...) ({ 0; }) -/* Rotate left - not available in U-Boot */ -static inline u32 rol32(u32 word, unsigned int shift) -{ - return (word << (shift & 31)) | (word >> ((-shift) & 31)); -} - +/* rol32 and ror32 are now in linux/bitops.h */ /* Time types - timespec64 and time64_t are now in linux/time.h */ /* diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 86f7ee492b4..a3cfbbd5250 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -148,6 +148,26 @@ static inline unsigned long hweight_long(unsigned long w) return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w); } +/** + * rol32 - rotate a 32-bit value left + * @word: value to rotate + * @shift: bits to roll + */ +static inline u32 rol32(u32 word, unsigned int shift) +{ + return (word << (shift & 31)) | (word >> ((-shift) & 31)); +} + +/** + * ror32 - rotate a 32-bit value right + * @word: value to rotate + * @shift: bits to roll + */ +static inline u32 ror32(u32 word, unsigned int shift) +{ + return (word >> (shift & 31)) | (word << ((-shift) & 31)); +} + #include <asm/bitops.h> /* linux/include/asm-generic/bitops/non-atomic.h */ -- 2.43.0