Skip to contentSkip to conversation

lib: crc_ccitt_false() is identical to crc_itu_t()

PATCH Applied Mathis Marion 1 participant 1 message Dec 19, 2023

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: crc_ccitt_false() is identical to crc_itu_t()

From: Mathis Marion <[email protected]>

crc_ccitt_false() was introduced in commit 0d85adb5fbd33 ("lib/crc-ccitt: Add CCITT-FALSE CRC16 variant"), but it is redundant with crc_itu_t(). Since the latter is more used, it is the one being kept.

---
 .../driver-api/surface_aggregator/ssh.rst     |  2 +-
 drivers/mfd/Kconfig                           |  2 +-
 drivers/mfd/rave-sp.c                         |  4 +-
 drivers/platform/surface/aggregator/Kconfig   |  2 +-
 include/linux/crc-ccitt.h                     |  7 ---
 include/linux/surface_aggregator/serial_hub.h |  4 +-
 lib/crc-ccitt.c                               | 55 -------------------
 7 files changed, 7 insertions(+), 69 deletions(-)
Documentation/driver-api/surface_aggregator/ssh.rst +1 -1
index b955b673838b..58a757319931 100644
@@ -39,7 +39,7 @@ Note that the standard disclaimer for this subsystem also applies to this
 document: All of this has been reverse-engineered and may thus be erroneous
 and/or incomplete.
 
-All CRCs used in the following are two-byte ``crc_ccitt_false(0xffff, ...)``.
+All CRCs used in the following are two-byte ``crc_itu_t(0xffff, ...)``.
 All multi-byte values are little-endian, there is no implicit padding between
 values.
 
drivers/mfd/Kconfig +1 -1
index 90ce58fd629e..925c19ee513b 100644
@@ -2255,7 +2255,7 @@ config MFD_VEXPRESS_SYSREG
 config RAVE_SP_CORE
 	tristate "RAVE SP MCU core driver"
 	depends on SERIAL_DEV_BUS
-	select CRC_CCITT
+	select CRC_ITU_T
 	help
 	  Select this to get support for the Supervisory Processor
 	  device found on several devices in RAVE line of hardware.
drivers/mfd/rave-sp.c +2 -2
index da50eba10014..f62422740de2 100644
@@ -9,7 +9,7 @@
  */
 
 #include <linux/atomic.h>
-#include <linux/crc-ccitt.h>
+#include <linux/crc-itu-t.h>
 #include <linux/delay.h>
 #include <linux/export.h>
 #include <linux/init.h>
@@ -251,7 +251,7 @@ static void csum_8b2c(const u8 *buf, size_t size, u8 *crc)
 
 static void csum_ccitt(const u8 *buf, size_t size, u8 *crc)
 {
-	const u16 calculated = crc_ccitt_false(0xffff, buf, size);
+	const u16 calculated = crc_itu_t(0xffff, buf, size);
 
 	/*
 	 * While the rest of the wire protocol is little-endian,
drivers/platform/surface/aggregator/Kconfig +1 -1
index 88afc38ffdc5..957c216c180c 100644
@@ -5,7 +5,7 @@ menuconfig SURFACE_AGGREGATOR
 	tristate "Microsoft Surface System Aggregator Module Subsystem and Drivers"
 	depends on SERIAL_DEV_BUS
 	depends on ACPI && !RISCV
-	select CRC_CCITT
+	select CRC_ITU_T
 	help
 	  The Surface System Aggregator Module (Surface SAM or SSAM) is an
 	  embedded controller (EC) found on 5th- and later-generation Microsoft
include/linux/crc-ccitt.h +0 -7
index 72c92c396bb8..cd4f420231ba 100644
@@ -5,19 +5,12 @@
 #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 */
include/linux/surface_aggregator/serial_hub.h +2 -2
index 5c4ae1a26183..d8dbef6b7fc2 100644
@@ -12,7 +12,7 @@
 #ifndef _LINUX_SURFACE_AGGREGATOR_SERIAL_HUB_H
 #define _LINUX_SURFACE_AGGREGATOR_SERIAL_HUB_H
 
-#include <linux/crc-ccitt.h>
+#include <linux/crc-itu-t.h>
 #include <linux/kref.h>
 #include <linux/ktime.h>
 #include <linux/list.h>
@@ -188,7 +188,7 @@ static_assert(sizeof(struct ssh_command) == 8);
  */
 static inline u16 ssh_crc(const u8 *buf, size_t len)
 {
-	return crc_ccitt_false(0xffff, buf, len);
+	return crc_itu_t(0xffff, buf, len);
 }
 
 /*
lib/crc-ccitt.c +0 -55

66 lines not on this page · raw message

Signature · 1 line
2.43.0