From c3a4d1c3ee1f528a62e0de55ed034fa6d23c0add Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 14 Nov 2019 12:57:14 -0700 Subject: [PATCH] common: Drop linux/crc8.h We have an existing U-Boot header for the one function that this defines. Use that instead of the linux/ one. Move over the nice comment. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- board/theadorable/theadorable.c | 2 +- drivers/tpm/tpm2_tis_sandbox.c | 2 +- drivers/tpm/tpm_tis_sandbox.c | 2 +- include/linux/crc8.h | 23 ----------------------- include/u-boot/crc.h | 14 +++++++++++++- lib/crc8.c | 7 ++++++- 6 files changed, 22 insertions(+), 28 deletions(-) delete mode 100644 include/linux/crc8.h diff --git a/board/theadorable/theadorable.c b/board/theadorable/theadorable.c index d42350319c..2958d5ff88 100644 --- a/board/theadorable/theadorable.c +++ b/board/theadorable/theadorable.c @@ -14,11 +14,11 @@ #include #include #include -#include #include #ifdef CONFIG_NET #include #endif +#include #include "theadorable.h" #include "../drivers/ddr/marvell/axp/ddr3_hw_training.h" diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c index f282ea6adf..522988795c 100644 --- a/drivers/tpm/tpm2_tis_sandbox.c +++ b/drivers/tpm/tpm2_tis_sandbox.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include /* Hierarchies */ enum tpm2_hierarchy { diff --git a/drivers/tpm/tpm_tis_sandbox.c b/drivers/tpm/tpm_tis_sandbox.c index 3336f559e5..2dff0d3eee 100644 --- a/drivers/tpm/tpm_tis_sandbox.c +++ b/drivers/tpm/tpm_tis_sandbox.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include /* TPM NVRAM location indices. */ #define FIRMWARE_NV_INDEX 0x1007 diff --git a/include/linux/crc8.h b/include/linux/crc8.h deleted file mode 100644 index 0ab5b9ab21..0000000000 --- a/include/linux/crc8.h +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright (c) 2013 Google, Inc - */ - - -#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 - * - * @crc_start: CRC8 start value - * @vptr: Buffer to checksum - * @len: Length of buffer in bytes - * @return CRC8 checksum - */ -unsigned int crc8(unsigned int crc_start, const unsigned char *vptr, int len); - -#endif diff --git a/include/u-boot/crc.h b/include/u-boot/crc.h index 788ef29a17..b42bcda2b3 100644 --- a/include/u-boot/crc.h +++ b/include/u-boot/crc.h @@ -8,7 +8,19 @@ #ifndef _UBOOT_CRC_H #define _UBOOT_CRC_H -/* lib/crc8.c */ +/** + * 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 + * + * lib/crc8.c + * + * @crc_start: CRC8 start value + * @vptr: Buffer to checksum + * @len: Length of buffer in bytes + * @return CRC8 checksum + */ unsigned int crc8(unsigned int crc_start, const unsigned char *vptr, int len); /* lib/crc16.c - 16 bit CRC with polynomial x^16+x^12+x^5+1 (CRC-CCITT) */ diff --git a/lib/crc8.c b/lib/crc8.c index 55f7c07285..87b87b675b 100644 --- a/lib/crc8.c +++ b/lib/crc8.c @@ -3,7 +3,12 @@ * Copyright (c) 2013 Google, Inc */ -#include "linux/crc8.h" +#ifdef USE_HOSTCC +#include +#else +#include +#endif +#include #define POLY (0x1070U << 3) -- 2.39.5