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

lib/crc: crc32: Change crc32() from macro to inline function and remove cast

There's no need for crc32() to be a macro. Make it an inline function
instead. Also, remove the cast of the data pointer to
'unsigned char const *', which is no longer necessary now that the type
used in the function prototype is 'const void *'.

Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20250619183414.100082-3-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

+6 -2
+6 -2
include/linux/crc32.h
··· 30 30 */ 31 31 u32 crc32_le(u32 crc, const void *p, size_t len); 32 32 33 + /* This is just an alias for crc32_le(). */ 34 + static inline u32 crc32(u32 crc, const void *p, size_t len) 35 + { 36 + return crc32_le(crc, p, len); 37 + } 38 + 33 39 /** 34 40 * crc32_be() - Compute most-significant-bit-first IEEE CRC-32 35 41 * @crc: Initial CRC value. ~0 (recommended) or 0 for a new CRC computation, or ··· 95 89 #else 96 90 static inline u32 crc32_optimizations(void) { return 0; } 97 91 #endif 98 - 99 - #define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) 100 92 101 93 /* 102 94 * Helpers for hash table generation of ethernet nics: