Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EDB96C433F5 for ; Mon, 4 Apr 2022 18:44:09 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 26815807DF; Mon, 4 Apr 2022 20:44:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 7E20481B5C; Mon, 4 Apr 2022 20:44:05 +0200 (CEST) Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 73D2E80085 for ; Mon, 4 Apr 2022 20:43:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=tom.rini@gmail.com Received: by mail-qk1-f181.google.com with SMTP id d65so8443374qke.5 for ; Mon, 04 Apr 2022 11:43:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZYdBAI0MOlkODQhJ0bj6Ha+zAPyV/5zMPNvxM6mU7oE=; b=5fDVfQhUS0+FHwakBMFwnpWol8R7ndFBRyP0ly2yNFD8B75PibfrXFjB4QFOuhFo7c GdIVFsb8M4HuJuV9ZAYOk8TizPSKDutm/0raOZ5Yfoa+RhIlhfY727H+dL4i1jbWgtHc 7hKlR4wfErqUHT/F3DtWcbPyuGfVFKmnmN+1nNk07S0MDxb/Lm+pyI8prWFTewDSlI4N IRz2Eah0pVdZGghSaWuxIBdkIS5ZcgIMgjskuGZDK0y+f2REJpI6Wog92ZZH2WWHvqiY ZPHwG3F1p04NnBrnKXW0bpn+jD2z/k9Tu2imS/QZmoMom3qnKJBks3D5Tw9wLodr1mTO YZyA== X-Gm-Message-State: AOAM533KksKMiBfNjIPTN02YlahuHKTun9SL+h08aqOsRNo/0EvgdnJb jB9LlPOYL4prhKzNPqHspWTi8bkk4w== X-Google-Smtp-Source: ABdhPJw3m7X26zZ0KSReXMw3xpjl1ZJm4fsCMQi7BDbF4i+C2PhdtDG+isWlqI3C5IXMI54CZhzwlg== X-Received: by 2002:a05:620a:2588:b0:680:f657:fbd6 with SMTP id x8-20020a05620a258800b00680f657fbd6mr841899qko.287.1649097834943; Mon, 04 Apr 2022 11:43:54 -0700 (PDT) Received: from bill-the-cat.lan (2603-6081-7b01-cbda-2ef0-5dff-fedb-a8ba.res6.spectrum.com. [2603:6081:7b01:cbda:2ef0:5dff:fedb:a8ba]) by smtp.gmail.com with ESMTPSA id a23-20020a05620a16d700b0067e98304705sm6402522qkn.89.2022.04.04.11.43.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 11:43:54 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Cc: Alexander Graf Subject: [PATCH] Remove duplication of table_compute_checksum function Date: Mon, 4 Apr 2022 14:43:51 -0400 Message-Id: <20220404184351.4041677-1-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean 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 Signed-off-by: Tom Rini --- arch/sandbox/include/asm/tables.h | 0 arch/x86/include/asm/tables.h | 13 ------------- drivers/misc/qfw.c | 3 --- include/tables_csum.h | 23 ++++++++++++----------- 4 files changed, 12 insertions(+), 27 deletions(-) delete mode 100644 arch/sandbox/include/asm/tables.h diff --git a/arch/sandbox/include/asm/tables.h b/arch/sandbox/include/asm/tables.h deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/arch/x86/include/asm/tables.h b/arch/x86/include/asm/tables.h index aa938837b65a..37be01240db5 100644 --- a/arch/x86/include/asm/tables.h +++ b/arch/x86/include/asm/tables.h @@ -16,19 +16,6 @@ /* SeaBIOS expects coreboot tables at address range 0x0000-0x1000 */ #define CB_TABLE_ADDR 0x800 -/** - * 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); - /** * table_fill_string() - Fill a string with pad in the configuration table * diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c index 677841aac5ef..1d54b7542b8a 100644 --- a/drivers/misc/qfw.c +++ b/drivers/misc/qfw.c @@ -15,9 +15,6 @@ #include #include #include -#ifdef CONFIG_GENERATE_ACPI_TABLE -#include -#endif #if defined(CONFIG_GENERATE_ACPI_TABLE) && !defined(CONFIG_SANDBOX) /* diff --git a/include/tables_csum.h b/include/tables_csum.h index 5f7edc419ba2..4812333093a1 100644 --- a/include/tables_csum.h +++ b/include/tables_csum.h @@ -6,16 +6,17 @@ #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 -- 2.25.1