7
7
#include <linux/module.h>
8
8
#include <linux/crc7.h>
9
9
10
-
11
10
/*
12
11
* Table for CRC-7 (polynomial x^7 + x^3 + 1).
13
12
* This is a big-endian CRC (msbit is highest power of x),
14
13
* aligned so the msbit of the byte is the x^6 coefficient
15
14
* and the lsbit is not used.
16
15
*/
17
- const u8 crc7_be_syndrome_table [256 ] = {
16
+ static const u8 crc7_be_syndrome_table [256 ] = {
18
17
0x00 , 0x12 , 0x24 , 0x36 , 0x48 , 0x5a , 0x6c , 0x7e ,
19
18
0x90 , 0x82 , 0xb4 , 0xa6 , 0xd8 , 0xca , 0xfc , 0xee ,
20
19
0x32 , 0x20 , 0x16 , 0x04 , 0x7a , 0x68 , 0x5e , 0x4c ,
@@ -48,7 +47,6 @@ const u8 crc7_be_syndrome_table[256] = {
48
47
0x1c , 0x0e , 0x38 , 0x2a , 0x54 , 0x46 , 0x70 , 0x62 ,
49
48
0x8c , 0x9e , 0xa8 , 0xba , 0xc4 , 0xd6 , 0xe0 , 0xf2
50
49
};
51
- EXPORT_SYMBOL (crc7_be_syndrome_table );
52
50
53
51
/**
54
52
* crc7_be - update the CRC7 for the data buffer
@@ -65,7 +63,7 @@ EXPORT_SYMBOL(crc7_be_syndrome_table);
65
63
u8 crc7_be (u8 crc , const u8 * buffer , size_t len )
66
64
{
67
65
while (len -- )
68
- crc = crc7_be_byte ( crc , * buffer ++ ) ;
66
+ crc = crc7_be_syndrome_table [ crc ^ * buffer ++ ] ;
69
67
return crc ;
70
68
}
71
69
EXPORT_SYMBOL (crc7_be );
0 commit comments