X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Ftables_csum.h;h=4812333093a1e90dd306f29f73790b3a9eaea9a1;hb=ddd39d0cc1a025a1e2e3c792cc8286dbdfa29b54;hp=27d147b1643c13c498da2cfea1021031a4610fb5;hpb=68ff827ec74fdca8f17d469f22e1032ed14cb795;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/tables_csum.h b/include/tables_csum.h index 27d147b..4812333 100644 --- a/include/tables_csum.h +++ b/include/tables_csum.h @@ -1,22 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2015, Bin Meng - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _TABLES_CSUM_H_ #define _TABLES_CSUM_H_ -static inline u8 table_compute_checksum(void *v, int len) -{ - u8 *bytes = v; - u8 checksum = 0; - int i; - - for (i = 0; i < len; i++) - checksum -= bytes[i]; - - return checksum; -} +/** + * table_compute_checksum() - Compute a table checksum + * + * This computes an 8-bit checksum for the configuration table. + * All bytes in the configuration table, including checksum itself and + * reserved bytes must add up to zero. + * + * @v: configuration table base address + * @len: configuration table size + * @return: the 8-bit checksum + */ +u8 table_compute_checksum(void *v, int len); #endif