Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'crc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux

Pull CRC updates from Eric Biggers:
"Cleanups for the kernel's CRC (cyclic redundancy check) code:

- Use __ro_after_init where appropriate

- Remove unnecessary static_key on s390

- Rename some source code files

- Rename the crc32 and crc32c crypto API modules

- Use subsys_initcall instead of arch_initcall

- Restore maintainers for crc_kunit.c

- Fold crc16_byte() into crc16.c

- Add some SPDX license identifiers"

* tag 'crc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux:
lib/crc32: add SPDX license identifier
lib/crc16: unexport crc16_table and crc16_byte()
w1: ds2406: use crc16() instead of crc16_byte() loop
MAINTAINERS: add crc_kunit.c back to CRC LIBRARY
lib/crc: make arch-optimized code use subsys_initcall
crypto: crc32 - remove "generic" from file and module names
x86/crc: drop "glue" from filenames
sparc/crc: drop "glue" from filenames
s390/crc: drop "glue" from filenames
powerpc/crc: rename crc32-vpmsum_core.S to crc-vpmsum-template.S
powerpc/crc: drop "glue" from filenames
arm64/crc: drop "glue" from filenames
arm/crc: drop "glue" from filenames
s390/crc32: Remove no-op module init and exit functions
s390/crc32: Remove have_vxrs static key
lib/crc: make the CPU feature static keys __ro_after_init

+59 -92
+1
MAINTAINERS
··· 6263 6263 F: arch/*/lib/crc* 6264 6264 F: include/linux/crc* 6265 6265 F: lib/crc* 6266 + F: lib/tests/crc_kunit.c 6266 6267 F: scripts/gen-crc-consts.py 6267 6268 6268 6269 CREATIVE SB0540
+2 -2
arch/arm/lib/Makefile
··· 47 47 obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o 48 48 49 49 obj-$(CONFIG_CRC32_ARCH) += crc32-arm.o 50 - crc32-arm-y := crc32-glue.o crc32-core.o 50 + crc32-arm-y := crc32.o crc32-core.o 51 51 52 52 obj-$(CONFIG_CRC_T10DIF_ARCH) += crc-t10dif-arm.o 53 - crc-t10dif-arm-y := crc-t10dif-glue.o crc-t10dif-core.o 53 + crc-t10dif-arm-y := crc-t10dif.o crc-t10dif-core.o
+3 -3
arch/arm/lib/crc-t10dif-glue.c arch/arm/lib/crc-t10dif.c
··· 16 16 #include <asm/neon.h> 17 17 #include <asm/simd.h> 18 18 19 - static DEFINE_STATIC_KEY_FALSE(have_neon); 20 - static DEFINE_STATIC_KEY_FALSE(have_pmull); 19 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_neon); 20 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pmull); 21 21 22 22 #define CRC_T10DIF_PMULL_CHUNK_SIZE 16U 23 23 ··· 60 60 } 61 61 return 0; 62 62 } 63 - arch_initcall(crc_t10dif_arm_init); 63 + subsys_initcall(crc_t10dif_arm_init); 64 64 65 65 static void __exit crc_t10dif_arm_exit(void) 66 66 {
+3 -3
arch/arm/lib/crc32-glue.c arch/arm/lib/crc32.c
··· 18 18 #include <asm/neon.h> 19 19 #include <asm/simd.h> 20 20 21 - static DEFINE_STATIC_KEY_FALSE(have_crc32); 22 - static DEFINE_STATIC_KEY_FALSE(have_pmull); 21 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_crc32); 22 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pmull); 23 23 24 24 #define PMULL_MIN_LEN 64 /* min size of buffer for pmull functions */ 25 25 ··· 103 103 static_branch_enable(&have_pmull); 104 104 return 0; 105 105 } 106 - arch_initcall(crc32_arm_init); 106 + subsys_initcall(crc32_arm_init); 107 107 108 108 static void __exit crc32_arm_exit(void) 109 109 {
+2 -2
arch/arm64/lib/Makefile
··· 14 14 lib-$(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) += uaccess_flushcache.o 15 15 16 16 obj-$(CONFIG_CRC32_ARCH) += crc32-arm64.o 17 - crc32-arm64-y := crc32.o crc32-glue.o 17 + crc32-arm64-y := crc32.o crc32-core.o 18 18 19 19 obj-$(CONFIG_CRC_T10DIF_ARCH) += crc-t10dif-arm64.o 20 - crc-t10dif-arm64-y := crc-t10dif-glue.o crc-t10dif-core.o 20 + crc-t10dif-arm64-y := crc-t10dif.o crc-t10dif-core.o 21 21 22 22 obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o 23 23
+3 -3
arch/arm64/lib/crc-t10dif-glue.c arch/arm64/lib/crc-t10dif.c
··· 17 17 #include <asm/neon.h> 18 18 #include <asm/simd.h> 19 19 20 - static DEFINE_STATIC_KEY_FALSE(have_asimd); 21 - static DEFINE_STATIC_KEY_FALSE(have_pmull); 20 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_asimd); 21 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pmull); 22 22 23 23 #define CRC_T10DIF_PMULL_CHUNK_SIZE 16U 24 24 ··· 61 61 } 62 62 return 0; 63 63 } 64 - arch_initcall(crc_t10dif_arm64_init); 64 + subsys_initcall(crc_t10dif_arm64_init); 65 65 66 66 static void __exit crc_t10dif_arm64_exit(void) 67 67 {
arch/arm64/lib/crc32-glue.c arch/arm64/lib/crc32.c
arch/arm64/lib/crc32.S arch/arm64/lib/crc32-core.S
+2 -2
arch/loongarch/lib/crc32-loongarch.c
··· 26 26 #define CRC32(crc, value, size) _CRC32(crc, value, size, crc) 27 27 #define CRC32C(crc, value, size) _CRC32(crc, value, size, crcc) 28 28 29 - static DEFINE_STATIC_KEY_FALSE(have_crc32); 29 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_crc32); 30 30 31 31 u32 crc32_le_arch(u32 crc, const u8 *p, size_t len) 32 32 { ··· 114 114 static_branch_enable(&have_crc32); 115 115 return 0; 116 116 } 117 - arch_initcall(crc32_loongarch_init); 117 + subsys_initcall(crc32_loongarch_init); 118 118 119 119 static void __exit crc32_loongarch_exit(void) 120 120 {
+2 -2
arch/mips/lib/crc32-mips.c
··· 62 62 #define CRC32C(crc, value, size) \ 63 63 _CRC32(crc, value, size, crc32c) 64 64 65 - static DEFINE_STATIC_KEY_FALSE(have_crc32); 65 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_crc32); 66 66 67 67 u32 crc32_le_arch(u32 crc, const u8 *p, size_t len) 68 68 { ··· 163 163 static_branch_enable(&have_crc32); 164 164 return 0; 165 165 } 166 - arch_initcall(crc32_mips_init); 166 + subsys_initcall(crc32_mips_init); 167 167 168 168 static void __exit crc32_mips_exit(void) 169 169 {
+2 -2
arch/powerpc/lib/Makefile
··· 79 79 CFLAGS_xor_vmx.o += -isystem $(shell $(CC) -print-file-name=include) 80 80 81 81 obj-$(CONFIG_CRC32_ARCH) += crc32-powerpc.o 82 - crc32-powerpc-y := crc32-glue.o crc32c-vpmsum_asm.o 82 + crc32-powerpc-y := crc32.o crc32c-vpmsum_asm.o 83 83 84 84 obj-$(CONFIG_CRC_T10DIF_ARCH) += crc-t10dif-powerpc.o 85 - crc-t10dif-powerpc-y := crc-t10dif-glue.o crct10dif-vpmsum_asm.o 85 + crc-t10dif-powerpc-y := crc-t10dif.o crct10dif-vpmsum_asm.o 86 86 87 87 obj-$(CONFIG_PPC64) += $(obj64-y)
+2 -2
arch/powerpc/lib/crc-t10dif-glue.c arch/powerpc/lib/crc-t10dif.c
··· 21 21 22 22 #define VECTOR_BREAKPOINT 64 23 23 24 - static DEFINE_STATIC_KEY_FALSE(have_vec_crypto); 24 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_vec_crypto); 25 25 26 26 u32 __crct10dif_vpmsum(u32 crc, unsigned char const *p, size_t len); 27 27 ··· 71 71 static_branch_enable(&have_vec_crypto); 72 72 return 0; 73 73 } 74 - arch_initcall(crc_t10dif_powerpc_init); 74 + subsys_initcall(crc_t10dif_powerpc_init); 75 75 76 76 static void __exit crc_t10dif_powerpc_exit(void) 77 77 {
+2 -2
arch/powerpc/lib/crc32-glue.c arch/powerpc/lib/crc32.c
··· 13 13 14 14 #define VECTOR_BREAKPOINT 512 15 15 16 - static DEFINE_STATIC_KEY_FALSE(have_vec_crypto); 16 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_vec_crypto); 17 17 18 18 u32 __crc32c_vpmsum(u32 crc, const u8 *p, size_t len); 19 19 ··· 72 72 static_branch_enable(&have_vec_crypto); 73 73 return 0; 74 74 } 75 - arch_initcall(crc32_powerpc_init); 75 + subsys_initcall(crc32_powerpc_init); 76 76 77 77 static void __exit crc32_powerpc_exit(void) 78 78 {
arch/powerpc/lib/crc32-vpmsum_core.S arch/powerpc/lib/crc-vpmsum-template.S
+1 -1
arch/powerpc/lib/crc32c-vpmsum_asm.S
··· 839 839 840 840 #define CRC_FUNCTION_NAME __crc32c_vpmsum 841 841 #define REFLECT 842 - #include "crc32-vpmsum_core.S" 842 + #include "crc-vpmsum-template.S"
+1 -1
arch/powerpc/lib/crct10dif-vpmsum_asm.S
··· 842 842 .octa 0x0000000000000000000000018bb70000 843 843 844 844 #define CRC_FUNCTION_NAME __crct10dif_vpmsum 845 - #include "crc32-vpmsum_core.S" 845 + #include "crc-vpmsum-template.S"
+1 -1
arch/s390/lib/Makefile
··· 26 26 obj-$(CONFIG_EXPOLINE_EXTERN) += expoline.o 27 27 28 28 obj-$(CONFIG_CRC32_ARCH) += crc32-s390.o 29 - crc32-s390-y := crc32-glue.o crc32le-vx.o crc32be-vx.o 29 + crc32-s390-y := crc32.o crc32le-vx.o crc32be-vx.o
+3 -18
arch/s390/lib/crc32-glue.c arch/s390/lib/crc32.c
··· 18 18 #define VX_ALIGNMENT 16L 19 19 #define VX_ALIGN_MASK (VX_ALIGNMENT - 1) 20 20 21 - static DEFINE_STATIC_KEY_FALSE(have_vxrs); 22 - 23 21 /* 24 22 * DEFINE_CRC32_VX() - Define a CRC-32 function using the vector extension 25 23 * ··· 32 34 unsigned long prealign, aligned, remaining; \ 33 35 DECLARE_KERNEL_FPU_ONSTACK16(vxstate); \ 34 36 \ 35 - if (datalen < VX_MIN_LEN + VX_ALIGN_MASK || \ 36 - !static_branch_likely(&have_vxrs)) \ 37 + if (datalen < VX_MIN_LEN + VX_ALIGN_MASK || !cpu_has_vx()) \ 37 38 return ___crc32_sw(crc, data, datalen); \ 38 39 \ 39 40 if ((unsigned long)data & VX_ALIGN_MASK) { \ ··· 61 64 DEFINE_CRC32_VX(crc32_be_arch, crc32_be_vgfm_16, crc32_be_base) 62 65 DEFINE_CRC32_VX(crc32c_arch, crc32c_le_vgfm_16, crc32c_base) 63 66 64 - static int __init crc32_s390_init(void) 65 - { 66 - if (cpu_have_feature(S390_CPU_FEATURE_VXRS)) 67 - static_branch_enable(&have_vxrs); 68 - return 0; 69 - } 70 - arch_initcall(crc32_s390_init); 71 - 72 - static void __exit crc32_s390_exit(void) 73 - { 74 - } 75 - module_exit(crc32_s390_exit); 76 - 77 67 u32 crc32_optimizations(void) 78 68 { 79 - if (static_key_enabled(&have_vxrs)) 69 + if (cpu_has_vx()) { 80 70 return CRC32_LE_OPTIMIZATION | 81 71 CRC32_BE_OPTIMIZATION | 82 72 CRC32C_OPTIMIZATION; 73 + } 83 74 return 0; 84 75 } 85 76 EXPORT_SYMBOL(crc32_optimizations);
+1 -1
arch/sparc/lib/Makefile
··· 54 54 obj-$(CONFIG_SPARC32) += atomic32.o 55 55 obj-$(CONFIG_SPARC64) += PeeCeeI.o 56 56 obj-$(CONFIG_CRC32_ARCH) += crc32-sparc.o 57 - crc32-sparc-y := crc32_glue.o crc32c_asm.o 57 + crc32-sparc-y := crc32.o crc32c_asm.o
+3 -3
arch/sparc/lib/crc32_glue.c arch/sparc/lib/crc32.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 - /* Glue code for CRC32C optimized for sparc64 crypto opcodes. 2 + /* CRC32c (Castagnoli), sparc64 crc32c opcode accelerated 3 3 * 4 4 * This is based largely upon arch/x86/crypto/crc32c-intel.c 5 5 * ··· 17 17 #include <asm/pstate.h> 18 18 #include <asm/elf.h> 19 19 20 - static DEFINE_STATIC_KEY_FALSE(have_crc32c_opcode); 20 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_crc32c_opcode); 21 21 22 22 u32 crc32_le_arch(u32 crc, const u8 *data, size_t len) 23 23 { ··· 74 74 pr_info("Using sparc64 crc32c opcode optimized CRC32C implementation\n"); 75 75 return 0; 76 76 } 77 - arch_initcall(crc32_sparc_init); 77 + subsys_initcall(crc32_sparc_init); 78 78 79 79 static void __exit crc32_sparc_exit(void) 80 80 {
+3 -3
arch/x86/lib/Makefile
··· 39 39 lib-$(CONFIG_MITIGATION_RETPOLINE) += retpoline.o 40 40 41 41 obj-$(CONFIG_CRC32_ARCH) += crc32-x86.o 42 - crc32-x86-y := crc32-glue.o crc32-pclmul.o 42 + crc32-x86-y := crc32.o crc32-pclmul.o 43 43 crc32-x86-$(CONFIG_64BIT) += crc32c-3way.o 44 44 45 45 obj-$(CONFIG_CRC64_ARCH) += crc64-x86.o 46 - crc64-x86-y := crc64-glue.o crc64-pclmul.o 46 + crc64-x86-y := crc64.o crc64-pclmul.o 47 47 48 48 obj-$(CONFIG_CRC_T10DIF_ARCH) += crc-t10dif-x86.o 49 - crc-t10dif-x86-y := crc-t10dif-glue.o crc16-msb-pclmul.o 49 + crc-t10dif-x86-y := crc-t10dif.o crc16-msb-pclmul.o 50 50 51 51 obj-y += msr.o msr-reg.o msr-reg-export.o hweight.o 52 52 obj-y += iomem.o
+2 -2
arch/x86/lib/crc-t10dif-glue.c arch/x86/lib/crc-t10dif.c
··· 9 9 #include <linux/module.h> 10 10 #include "crc-pclmul-template.h" 11 11 12 - static DEFINE_STATIC_KEY_FALSE(have_pclmulqdq); 12 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pclmulqdq); 13 13 14 14 DECLARE_CRC_PCLMUL_FUNCS(crc16_msb, u16); 15 15 ··· 29 29 } 30 30 return 0; 31 31 } 32 - arch_initcall(crc_t10dif_x86_init); 32 + subsys_initcall(crc_t10dif_x86_init); 33 33 34 34 static void __exit crc_t10dif_x86_exit(void) 35 35 {
+3 -3
arch/x86/lib/crc32-glue.c arch/x86/lib/crc32.c
··· 11 11 #include <linux/module.h> 12 12 #include "crc-pclmul-template.h" 13 13 14 - static DEFINE_STATIC_KEY_FALSE(have_crc32); 15 - static DEFINE_STATIC_KEY_FALSE(have_pclmulqdq); 14 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_crc32); 15 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pclmulqdq); 16 16 17 17 DECLARE_CRC_PCLMUL_FUNCS(crc32_lsb, u32); 18 18 ··· 88 88 } 89 89 return 0; 90 90 } 91 - arch_initcall(crc32_x86_init); 91 + subsys_initcall(crc32_x86_init); 92 92 93 93 static void __exit crc32_x86_exit(void) 94 94 {
+2 -2
arch/x86/lib/crc64-glue.c arch/x86/lib/crc64.c
··· 9 9 #include <linux/module.h> 10 10 #include "crc-pclmul-template.h" 11 11 12 - static DEFINE_STATIC_KEY_FALSE(have_pclmulqdq); 12 + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_pclmulqdq); 13 13 14 14 DECLARE_CRC_PCLMUL_FUNCS(crc64_msb, u64); 15 15 DECLARE_CRC_PCLMUL_FUNCS(crc64_lsb, u64); ··· 39 39 } 40 40 return 0; 41 41 } 42 - arch_initcall(crc64_x86_init); 42 + subsys_initcall(crc64_x86_init); 43 43 44 44 static void __exit crc64_x86_exit(void) 45 45 {
+6 -4
crypto/Makefile
··· 152 152 obj-$(CONFIG_CRYPTO_POLY1305) += poly1305_generic.o 153 153 obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o 154 154 obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o 155 - obj-$(CONFIG_CRYPTO_CRC32C) += crc32c_generic.o 156 - obj-$(CONFIG_CRYPTO_CRC32) += crc32_generic.o 157 - CFLAGS_crc32c_generic.o += -DARCH=$(ARCH) 158 - CFLAGS_crc32_generic.o += -DARCH=$(ARCH) 155 + obj-$(CONFIG_CRYPTO_CRC32C) += crc32c-cryptoapi.o 156 + crc32c-cryptoapi-y := crc32c.o 157 + CFLAGS_crc32c.o += -DARCH=$(ARCH) 158 + obj-$(CONFIG_CRYPTO_CRC32) += crc32-cryptoapi.o 159 + crc32-cryptoapi-y := crc32.o 160 + CFLAGS_crc32.o += -DARCH=$(ARCH) 159 161 obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o 160 162 obj-$(CONFIG_CRYPTO_KRB5ENC) += krb5enc.o 161 163 obj-$(CONFIG_CRYPTO_LZO) += lzo.o lzo-rle.o
crypto/crc32_generic.c crypto/crc32.c
crypto/crc32c_generic.c crypto/crc32c.c
+2 -10
drivers/w1/slaves/w1_ds2406.c
··· 29 29 { 30 30 u8 w1_buf[6] = {W1_F12_FUNC_READ_STATUS, 7, 0, 0, 0, 0}; 31 31 struct w1_slave *sl = kobj_to_w1_slave(kobj); 32 - u16 crc = 0; 33 - int i; 34 32 ssize_t rtnval = 1; 35 33 36 34 if (off != 0) ··· 45 47 46 48 w1_write_block(sl->master, w1_buf, 3); 47 49 w1_read_block(sl->master, w1_buf+3, 3); 48 - for (i = 0; i < 6; i++) 49 - crc = crc16_byte(crc, w1_buf[i]); 50 - if (crc == 0xb001) /* good read? */ 50 + if (crc16(0, w1_buf, sizeof(w1_buf)) == 0xb001) /* good read? */ 51 51 *buf = ((w1_buf[3]>>5)&3)|0x30; 52 52 else 53 53 rtnval = -EIO; ··· 62 66 { 63 67 struct w1_slave *sl = kobj_to_w1_slave(kobj); 64 68 u8 w1_buf[6] = {W1_F12_FUNC_WRITE_STATUS, 7, 0, 0, 0, 0}; 65 - u16 crc = 0; 66 - int i; 67 69 ssize_t rtnval = 1; 68 70 69 71 if (count != 1 || off != 0) ··· 77 83 w1_buf[3] = (((*buf)&3)<<5)|0x1F; 78 84 w1_write_block(sl->master, w1_buf, 4); 79 85 w1_read_block(sl->master, w1_buf+4, 2); 80 - for (i = 0; i < 6; i++) 81 - crc = crc16_byte(crc, w1_buf[i]); 82 - if (crc == 0xb001) /* good read? */ 86 + if (crc16(0, w1_buf, sizeof(w1_buf)) == 0xb001) /* good read? */ 83 87 w1_write_8(sl->master, 0xFF); 84 88 else 85 89 rtnval = -EIO;
+1 -8
include/linux/crc16.h
··· 15 15 16 16 #include <linux/types.h> 17 17 18 - extern u16 const crc16_table[256]; 19 - 20 - extern u16 crc16(u16 crc, const u8 *buffer, size_t len); 21 - 22 - static inline u16 crc16_byte(u16 crc, const u8 data) 23 - { 24 - return (crc >> 8) ^ crc16_table[(crc ^ data) & 0xff]; 25 - } 18 + u16 crc16(u16 crc, const u8 *p, size_t len); 26 19 27 20 #endif /* __CRC16_H */ 28 21
+1 -4
include/linux/crc32.h
··· 1 - /* 2 - * crc32.h 3 - * See linux/lib/crc32.c for license and changes 4 - */ 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 5 2 #ifndef _LINUX_CRC32_H 6 3 #define _LINUX_CRC32_H 7 4
+4 -5
lib/crc16.c
··· 8 8 #include <linux/crc16.h> 9 9 10 10 /** CRC table for the CRC-16. The poly is 0x8005 (x^16 + x^15 + x^2 + 1) */ 11 - u16 const crc16_table[256] = { 11 + static const u16 crc16_table[256] = { 12 12 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, 13 13 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, 14 14 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, ··· 42 42 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, 43 43 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 44 44 }; 45 - EXPORT_SYMBOL(crc16_table); 46 45 47 46 /** 48 47 * crc16 - compute the CRC-16 for the data buffer 49 48 * @crc: previous CRC value 50 - * @buffer: data pointer 49 + * @p: data pointer 51 50 * @len: number of bytes in the buffer 52 51 * 53 52 * Returns the updated CRC value. 54 53 */ 55 - u16 crc16(u16 crc, u8 const *buffer, size_t len) 54 + u16 crc16(u16 crc, const u8 *p, size_t len) 56 55 { 57 56 while (len--) 58 - crc = crc16_byte(crc, *buffer++); 57 + crc = (crc >> 8) ^ crc16_table[(crc & 0xff) ^ *p++]; 59 58 return crc; 60 59 } 61 60 EXPORT_SYMBOL(crc16);
+1 -3
lib/crc32.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 1 2 /* 2 3 * Aug 8, 2011 Bob Pearson with help from Joakim Tjernlund and George Spelvin 3 4 * cleaned up code to current version of sparse and added the slicing-by-8 ··· 20 19 * drivers/net/smc9194.c uses seed ~0, doesn't xor with ~0. 21 20 * fs/jffs2 uses seed 0, doesn't xor with ~0. 22 21 * fs/partitions/efi.c uses seed ~0, xor's with ~0. 23 - * 24 - * This source code is licensed under the GNU General Public License, 25 - * Version 2. See the file COPYING for more details. 26 22 */ 27 23 28 24 /* see: Documentation/staging/crc32.rst for a description of algorithms */