Skip to content

Commit f3e5fe4

Browse files
committed
lib/crc7: unexport crc7_be_syndrome_table
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/[email protected] Signed-off-by: Eric Biggers <[email protected]>
1 parent 415999e commit f3e5fe4

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

include/linux/crc7.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
#define _LINUX_CRC7_H
44
#include <linux/types.h>
55

6-
extern const u8 crc7_be_syndrome_table[256];
7-
8-
static inline u8 crc7_be_byte(u8 crc, u8 data)
9-
{
10-
return crc7_be_syndrome_table[crc ^ data];
11-
}
12-
136
extern u8 crc7_be(u8 crc, const u8 *buffer, size_t len);
147

158
#endif

lib/crc7.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
#include <linux/module.h>
88
#include <linux/crc7.h>
99

10-
1110
/*
1211
* Table for CRC-7 (polynomial x^7 + x^3 + 1).
1312
* This is a big-endian CRC (msbit is highest power of x),
1413
* aligned so the msbit of the byte is the x^6 coefficient
1514
* and the lsbit is not used.
1615
*/
17-
const u8 crc7_be_syndrome_table[256] = {
16+
static const u8 crc7_be_syndrome_table[256] = {
1817
0x00, 0x12, 0x24, 0x36, 0x48, 0x5a, 0x6c, 0x7e,
1918
0x90, 0x82, 0xb4, 0xa6, 0xd8, 0xca, 0xfc, 0xee,
2019
0x32, 0x20, 0x16, 0x04, 0x7a, 0x68, 0x5e, 0x4c,
@@ -48,7 +47,6 @@ const u8 crc7_be_syndrome_table[256] = {
4847
0x1c, 0x0e, 0x38, 0x2a, 0x54, 0x46, 0x70, 0x62,
4948
0x8c, 0x9e, 0xa8, 0xba, 0xc4, 0xd6, 0xe0, 0xf2
5049
};
51-
EXPORT_SYMBOL(crc7_be_syndrome_table);
5250

5351
/**
5452
* crc7_be - update the CRC7 for the data buffer
@@ -65,7 +63,7 @@ EXPORT_SYMBOL(crc7_be_syndrome_table);
6563
u8 crc7_be(u8 crc, const u8 *buffer, size_t len)
6664
{
6765
while (len--)
68-
crc = crc7_be_byte(crc, *buffer++);
66+
crc = crc7_be_syndrome_table[crc ^ *buffer++];
6967
return crc;
7068
}
7169
EXPORT_SYMBOL(crc7_be);

0 commit comments

Comments
 (0)