]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
lib/crc: crc32: Change crc32() from macro to inline function and remove cast
authorEric Biggers <ebiggers@kernel.org>
Thu, 19 Jun 2025 18:34:13 +0000 (11:34 -0700)
committerEric Biggers <ebiggers@kernel.org>
Mon, 30 Jun 2025 16:31:57 +0000 (09:31 -0700)
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>
include/linux/crc32.h

index f9c173206d4d16a6b3c4c5cd2d42d8bcb8b5433d..da78b215ff2e9365188cf6318c111163c0c7af32 100644 (file)
  */
 u32 crc32_le(u32 crc, const void *p, size_t len);
 
+/* This is just an alias for crc32_le(). */
+static inline u32 crc32(u32 crc, const void *p, size_t len)
+{
+       return crc32_le(crc, p, len);
+}
+
 /**
  * crc32_be() - Compute most-significant-bit-first IEEE CRC-32
  * @crc: Initial CRC value.  ~0 (recommended) or 0 for a new CRC computation, or
@@ -90,8 +96,6 @@ u32 crc32_optimizations(void);
 static inline u32 crc32_optimizations(void) { return 0; }
 #endif
 
-#define crc32(seed, data, length)  crc32_le(seed, (unsigned char const *)(data), length)
-
 /*
  * Helpers for hash table generation of ethernet nics:
  *