summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2024-12-02 04:08:40 +0300
committerEric Biggers <ebiggers@google.com>2024-12-02 04:23:02 +0300
commit38a9a5121c3bcf2ed857430a92e493568b247c35 (patch)
tree0c3b00d05b9fd06890f530ac7aa9c5c517ed9773 /include
parentcc354fa7f0160a96896a3b8d7f298a036e3b8602 (diff)
downloadlinux-38a9a5121c3bcf2ed857430a92e493568b247c35.tar.xz
lib/crc32: make crc32c() go directly to lib
Now that the lower level __crc32c_le() library function is optimized for each architecture, make crc32c() just call that instead of taking an inefficient and error-prone detour through the shash API. Note: a future cleanup should make crc32c_le() be the actual library function instead of __crc32c_le(). That will require updating callers of __crc32c_le() to use crc32c_le() instead, and updating callers of crc32c_le() that expect a 'const void *' arg to expect 'const u8 *' instead. Similarly, a future cleanup should remove LIBCRC32C by making everyone who is selecting it just select CRC32 directly instead. Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20241202010844.144356-16-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/crc32c.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/crc32c.h b/include/linux/crc32c.h
index 357ae4611a45..47eb78003c26 100644
--- a/include/linux/crc32c.h
+++ b/include/linux/crc32c.h
@@ -2,9 +2,12 @@
#ifndef _LINUX_CRC32C_H
#define _LINUX_CRC32C_H
-#include <linux/types.h>
+#include <linux/crc32.h>
-extern u32 crc32c(u32 crc, const void *address, unsigned int length);
+static inline u32 crc32c(u32 crc, const void *address, unsigned int length)
+{
+ return __crc32c_le(crc, address, length);
+}
/* This macro exists for backwards-compatibility. */
#define crc32c_le crc32c