Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Alexander Graf | 1befb38 | 2016-08-19 01:23:21 +0200 | [diff] [blame] | 2 | /* |
3 | * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com> | ||||
Alexander Graf | 1befb38 | 2016-08-19 01:23:21 +0200 | [diff] [blame] | 4 | */ |
5 | |||||
Tom Rini | 467382c | 2023-12-14 13:16:58 -0500 | [diff] [blame] | 6 | #include <linux/types.h> |
Alexander Graf | 1befb38 | 2016-08-19 01:23:21 +0200 | [diff] [blame] | 7 | |
Heinrich Schuchardt | e3db8d6 | 2024-01-09 09:36:44 +0100 | [diff] [blame] | 8 | u8 table_compute_checksum(const void *v, const int len) |
Alexander Graf | 1befb38 | 2016-08-19 01:23:21 +0200 | [diff] [blame] | 9 | { |
Heinrich Schuchardt | e3db8d6 | 2024-01-09 09:36:44 +0100 | [diff] [blame] | 10 | const u8 *bytes = v; |
Alexander Graf | 1befb38 | 2016-08-19 01:23:21 +0200 | [diff] [blame] | 11 | u8 checksum = 0; |
12 | int i; | ||||
13 | |||||
14 | for (i = 0; i < len; i++) | ||||
15 | checksum -= bytes[i]; | ||||
16 | |||||
17 | return checksum; | ||||
18 | } |