lib/crc-ccitt: add CCITT-FALSE CRC16 variant
Subsystems (2)
PATCH 1/1 lib/crc-ccitt: add CCITT-FALSE CRC16 variant
From: Andrey Vostrikov <[email protected]>
--- include/linux/crc-ccitt.h | 7 ++++++ lib/crc-ccitt.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 1 deletion(-)
include/linux/crc-ccitt.h +7 -0
@@ -4,12 +4,19 @@#include <linux/types.h> extern u16 const crc_ccitt_table[256 ]; +extern u16 const crc_ccitt_false_table[256 ];extern u16 crc_ccitt (u16 crc,const u8 *buffer,size_t len); +extern u16 crc_ccitt_false (u16 crc,const u8 *buffer,size_t len);static inline u16 crc_ccitt_byte (u16 crc,const u8 c) {return (crc >>8 ) ^ crc_ccitt_table[(crc ^ c) &0xff ]; } +static inline u16 crc_ccitt_false_byte (u16 crc,const u8 c) +{ +return (crc <<8 ) ^ crc_ccitt_false_table[(crc >>8 ) ^ c]; +} +#endif /* _LINUX_CRC_CCITT_H */
lib/crc-ccitt.c +57 -1
70 lines not on this page · raw message
Signature · 1 line
2.9.3
Andrew Morton
maintainerQuoted 6 lines · On Thu, 13 Apr 2017 07:29:32 -0700 Andrey Smirnov <[email protected]>…
From: Andrey Vostrikov <[email protected]>
Cc Andrew Morton <[email protected]>Signed-off-by Andrey Vostrikov <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>
We're missing a changelog. Why are you proposing adding this code to Linux?
Quoted 11 lines · Andrey Smirnov
From: Andrey Vostrikov <[email protected]>
Cc Andrew Morton <[email protected]>Signed-off-by Andrey Vostrikov <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>--- include/linux/crc-ccitt.h | 7 ++++++ lib/crc-ccitt.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 1 deletion(-)
In support of a soon to be published MFD driver using serdev to talk to a supervisory processor that uses the CCITT-FALSE CRC16 variant in it's protocol, this patch was tested successfully on an i.MX6 ARM platform.
Quoted 14 lines · On Thu, 13 Apr 2017 13:09:37 -0700 Chris Healy <[email protected]> wrote:
Quoted 11 lines · Andrey Smirnov
From: Andrey Vostrikov <[email protected]>
Cc Andrew Morton <[email protected]>Signed-off-by Andrey Vostrikov <[email protected]>Signed-off-by Andrey Smirnov <[email protected]>--- include/linux/crc-ccitt.h | 7 ++++++ lib/crc-ccitt.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 1 deletion(-)
Quoted 6 lines
In support of a soon to be published MFD driver using serdev to talk to a supervisory processor that uses the CCITT-FALSE CRC16 variant in it's protocol, this patch was tested successfully on an i.MX6 ARM platform.
Tested-by Chris Healy <[email protected]>
OK. Please add the above text to the changelog and include this patch in whatever tree adds the new driver.