]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
lib/crc7: unexport crc7_be_syndrome_table
authorEric Biggers <ebiggers@google.com>
Tue, 4 Mar 2025 22:40:52 +0000 (14:40 -0800)
committerEric Biggers <ebiggers@google.com>
Mon, 10 Mar 2025 16:29:29 +0000 (09:29 -0700)
Since neither crc7_be_syndrome_table nor crc7_be_byte() are used outside
lib/crc7.c, fold them into lib/crc7.c.

Link: https://lore.kernel.org/r/20250304224052.157915-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
include/linux/crc7.h
lib/crc7.c

index b462842f3c32c72abb1aca2c57a9cc07ff14338b..61d34749e437ddebb819278409569ba736999270 100644 (file)
@@ -3,13 +3,6 @@
 #define _LINUX_CRC7_H
 #include <linux/types.h>
 
-extern const u8 crc7_be_syndrome_table[256];
-
-static inline u8 crc7_be_byte(u8 crc, u8 data)
-{
-       return crc7_be_syndrome_table[crc ^ data];
-}
-
 extern u8 crc7_be(u8 crc, const u8 *buffer, size_t len);
 
 #endif
index 3848e313b7224610c8eabf2420ca299014ddb325..8dd991cc61146ea48c49e8baf68fb77fdaacede0 100644 (file)
@@ -7,14 +7,13 @@
 #include <linux/module.h>
 #include <linux/crc7.h>
 
-
 /*
  * Table for CRC-7 (polynomial x^7 + x^3 + 1).
  * This is a big-endian CRC (msbit is highest power of x),
  * aligned so the msbit of the byte is the x^6 coefficient
  * and the lsbit is not used.
  */
-const u8 crc7_be_syndrome_table[256] = {
+static const u8 crc7_be_syndrome_table[256] = {
        0x00, 0x12, 0x24, 0x36, 0x48, 0x5a, 0x6c, 0x7e,
        0x90, 0x82, 0xb4, 0xa6, 0xd8, 0xca, 0xfc, 0xee,
        0x32, 0x20, 0x16, 0x04, 0x7a, 0x68, 0x5e, 0x4c,
@@ -48,7 +47,6 @@ const u8 crc7_be_syndrome_table[256] = {
        0x1c, 0x0e, 0x38, 0x2a, 0x54, 0x46, 0x70, 0x62,
        0x8c, 0x9e, 0xa8, 0xba, 0xc4, 0xd6, 0xe0, 0xf2
 };
-EXPORT_SYMBOL(crc7_be_syndrome_table);
 
 /**
  * crc7_be - update the CRC7 for the data buffer
@@ -65,7 +63,7 @@ EXPORT_SYMBOL(crc7_be_syndrome_table);
 u8 crc7_be(u8 crc, const u8 *buffer, size_t len)
 {
        while (len--)
-               crc = crc7_be_byte(crc, *buffer++);
+               crc = crc7_be_syndrome_table[crc ^ *buffer++];
        return crc;
 }
 EXPORT_SYMBOL(crc7_be);