"Das U-Boot" Source Tree

Remove duplication of table_compute_checksum function

It seems like there was some merge error when first cleaning up and
sharing this function. We have both an inline version of the function
in include/tables_csum.h and a non-inline version in lib/tables_csum.c.
Rework things so that we only have the non-inline version (due to number
of calls, we should not inline this).

Fixes: 1befb38b8682 ("x86: Move table csum into separate file")
Fixes: 2b445e4d3194 ("x86: Move table csum into separate header")
Cc: Alexander Graf <agraf@csgraf.de>
Signed-off-by: Tom Rini <trini@konsulko.com>

Tom Rini 2df59b2b 34855b39

+12 -27
arch/sandbox/include/asm/tables.h

This is a binary file and will not be displayed.

-13
arch/x86/include/asm/tables.h
··· 17 17 #define CB_TABLE_ADDR 0x800 18 18 19 19 /** 20 - * table_compute_checksum() - Compute a table checksum 21 - * 22 - * This computes an 8-bit checksum for the configuration table. 23 - * All bytes in the configuration table, including checksum itself and 24 - * reserved bytes must add up to zero. 25 - * 26 - * @v: configuration table base address 27 - * @len: configuration table size 28 - * @return: the 8-bit checksum 29 - */ 30 - u8 table_compute_checksum(void *v, int len); 31 - 32 - /** 33 20 * table_fill_string() - Fill a string with pad in the configuration table 34 21 * 35 22 * This fills a string in the configuration table. It copies number of bytes
-3
drivers/misc/qfw.c
··· 15 15 #include <dm.h> 16 16 #include <misc.h> 17 17 #include <tables_csum.h> 18 - #ifdef CONFIG_GENERATE_ACPI_TABLE 19 - #include <asm/tables.h> 20 - #endif 21 18 22 19 #if defined(CONFIG_GENERATE_ACPI_TABLE) && !defined(CONFIG_SANDBOX) 23 20 /*
+12 -11
include/tables_csum.h
··· 6 6 #ifndef _TABLES_CSUM_H_ 7 7 #define _TABLES_CSUM_H_ 8 8 9 - static inline u8 table_compute_checksum(void *v, int len) 10 - { 11 - u8 *bytes = v; 12 - u8 checksum = 0; 13 - int i; 14 - 15 - for (i = 0; i < len; i++) 16 - checksum -= bytes[i]; 17 - 18 - return checksum; 19 - } 9 + /** 10 + * table_compute_checksum() - Compute a table checksum 11 + * 12 + * This computes an 8-bit checksum for the configuration table. 13 + * All bytes in the configuration table, including checksum itself and 14 + * reserved bytes must add up to zero. 15 + * 16 + * @v: configuration table base address 17 + * @len: configuration table size 18 + * @return: the 8-bit checksum 19 + */ 20 + u8 table_compute_checksum(void *v, int len); 20 21 21 22 #endif