Commit 2b445e4d31940d512b3257f7398b794be710b8a9
Committed by
Bin Meng
1 parent
d5a815327d
Exists in
v2017.01-smarct4x
and in
25 other branches
x86: Move table csum into separate header
We need the checksum function without all the other table functionality soon, so let's split it out into its own header file. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Showing 3 changed files with 24 additions and 12 deletions Side-by-side Diff
arch/x86/include/asm/tables.h
arch/x86/lib/tables.c
... | ... | @@ -38,18 +38,6 @@ |
38 | 38 | #endif |
39 | 39 | }; |
40 | 40 | |
41 | -u8 table_compute_checksum(void *v, int len) | |
42 | -{ | |
43 | - u8 *bytes = v; | |
44 | - u8 checksum = 0; | |
45 | - int i; | |
46 | - | |
47 | - for (i = 0; i < len; i++) | |
48 | - checksum -= bytes[i]; | |
49 | - | |
50 | - return checksum; | |
51 | -} | |
52 | - | |
53 | 41 | void table_fill_string(char *dest, const char *src, size_t n, char pad) |
54 | 42 | { |
55 | 43 | int start, len; |
include/tables_csum.h
1 | +/* | |
2 | + * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com> | |
3 | + * | |
4 | + * SPDX-License-Identifier: GPL-2.0+ | |
5 | + */ | |
6 | + | |
7 | +#ifndef _TABLES_CSUM_H_ | |
8 | +#define _TABLES_CSUM_H_ | |
9 | + | |
10 | +static inline u8 table_compute_checksum(void *v, int len) | |
11 | +{ | |
12 | + u8 *bytes = v; | |
13 | + u8 checksum = 0; | |
14 | + int i; | |
15 | + | |
16 | + for (i = 0; i < len; i++) | |
17 | + checksum -= bytes[i]; | |
18 | + | |
19 | + return checksum; | |
20 | +} | |
21 | + | |
22 | +#endif |