From 60d18d3fe9d1a5db663711063cd0d5c915af377a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 10 Nov 2013 10:26:47 -0700 Subject: Add crc8 routine Add an implementation of the CRC8 algorithm. This is required by the TPM emulation, but is probably useful to U-Boot in general. Signed-off-by: Simon Glass Signed-off-by: Simon Glass Reviewed-by: Simon Glass --- include/linux/crc8.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 include/linux/crc8.h (limited to 'include/linux') diff --git a/include/linux/crc8.h b/include/linux/crc8.h new file mode 100644 index 0000000000..b5fd2ac9d6 --- /dev/null +++ b/include/linux/crc8.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2013 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0+ + */ + + +#ifndef __linux_crc8_h +#define __linux_crc8_h + +/** + * crc8() - Calculate and return CRC-8 of the data + * + * This uses an x^8 + x^2 + x + 1 polynomial. A table-based algorithm would + * be faster, but for only a few bytes it isn't worth the code size + * + * @vptr: Buffer to checksum + * @len: Length of buffer in bytes + * @return CRC8 checksum + */ +unsigned int crc8(const unsigned char *vptr, int len); + +#endif -- cgit From ec4fa56743a3534c4bace2c9c72ea36b9d41000c Mon Sep 17 00:00:00 2001 From: David Feng Date: Sat, 14 Dec 2013 11:47:31 +0800 Subject: add weak entry definition Signed-off-by: David Feng --- include/linux/linkage.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/linux') diff --git a/include/linux/linkage.h b/include/linux/linkage.h index 39c712eac5..7435fcd026 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h @@ -48,6 +48,10 @@ .globl SYMBOL_NAME(name); \ LENTRY(name) +#define WEAK(name) \ + .weak SYMBOL_NAME(name); \ + LENTRY(name) + #ifndef END #define END(name) \ .size name, .-name -- cgit