Skip to content

2.6.7-mm2, Add common CRC16 module

Andrey Panin lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/42.6.7-mm2, Use it in async PPP driverdrivers/net/Kconfig drivers/net/ppp_async.c include/linux/ppp_defs.h+5 -380 replies
2/42.6.7-mm2, Use it in IRDA driversinclude/net/irda/crc.h net/irda/Kconfig net/irda/Makefile +1 more+5 -760 replies
3/42.6.7-mm2, Use it in ISDN driversdrivers/isdn/hisax/Kconfig drivers/isdn/hisax/isdnhdlc.c drivers/isdn/hisax/netjet.c +3 more+15 -1630 replies
4/42.6.7-mm2, Use it in AX.25 driversdrivers/net/hamradio/Kconfig drivers/net/hamradio/baycom_epp.c drivers/net/hamradio/hdlcdrv.c+10 -892 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] 2.6.7-mm2, Add common CRC16 module

Currently we have 8 copies of CRC16 calculation table in different device drivers, this patch creates common crc16.c module to replace them.

Please take a look.

 include/linux/crc16.h |   15 ++++++++++
 lib/Kconfig           |    8 +++++
 lib/Makefile          |    1 
 lib/crc16.c           |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 93 insertions(+)
include/linux/crc16.h +15 -0
diff -urpN -X /usr/share/dontdiff linux-2.6.7-mm2.vanilla/include/linux/crc16.h linux-2.6.7-mm2/include/linux/crc16.h
@@ -0,0 +1,15 @@
+#ifndef _LINUX_CRC16_H
+#define _LINUX_CRC16_H
+
+#include <linux/types.h>
+
+extern u16 const crc16_table[256];
+
+extern u16 crc16(u16 crc, const u8 *buffer, size_t len);
+
+static inline u16 crc16_byte(u16 crc, const u8 c)
+{
+	return (crc >> 8) ^ crc16_table[(crc ^ c) & 0xff];
+}
+
+#endif /* _LINUX_CRC16_H */
lib/crc16.c +69 -0

69 lines not on this page · raw message

lib/Kconfig +8 -0
diff -urpN -X /usr/share/dontdiff linux-2.6.7-mm2.vanilla/lib/Kconfig linux-2.6.7-mm2/lib/Kconfig
@@ -4,6 +4,14 @@
 
 menu "Library routines"
 
+config CRC16
+	tristate "CRC16 functions"
+	help
+	  This option is provided for the case where no in-kernel-tree
+	  modules require CRC16 functions, but a module built outside the
+	  kernel tree does. Such modules that use library CRC16 functions
+	  require M here.
+
 config CRC32
 	tristate "CRC32 functions"
 	help
lib/Makefile +1 -0
diff -urpN -X /usr/share/dontdiff linux-2.6.7-mm2.vanilla/lib/Makefile linux-2.6.7-mm2/lib/Makefile
@@ -18,6 +18,7 @@ ifneq ($(CONFIG_HAVE_DEC_LOCK),y) 
   lib-y += dec_and_lock.o
 endif
 
+obj-$(CONFIG_CRC16)	+= crc16.o
 obj-$(CONFIG_CRC32)	+= crc32.o
 obj-$(CONFIG_LIBCRC32C)	+= libcrc32c.o