From patchwork Thu Feb 27 13:56:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1245867 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=bCI5Oi8+; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48SvNb2G0cz9shj for ; Fri, 28 Feb 2020 00:56:46 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C1A6380857; Thu, 27 Feb 2020 14:56:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="bCI5Oi8+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0B7E98089D; Thu, 27 Feb 2020 14:56:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FORGED_SPF_HELO, SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0713.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1e::713]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1D16B8050F for ; Thu, 27 Feb 2020 14:56:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U15juBhF1QSJytv93+jsHNeUtCIl3Vf3TqeybBYk/6cyGHnH3pvr2OacF8He/emZBldTGRPYX4YTbpBsGl1kNpfv2P7DyNLdHh+/C0s15GKF+uhiUWvGAh/nqSHnAYHQAlTgmOKCxJ3hedtQh1B89UQEX8mv1PLtqSDs0EFvQH9hLw6F2idmwr89v5c/6SK1XiCTXKtPJ++cHJcHs4R8CCKwhi6eNS2gNU/e5/A0bJkjV2brepMWiJFLcTJ2Vy1bAaCGT7JM3AGtbBoVTfiDGqgD4o6BMVRVQ8V01C1Lr9Sgls2626YkiS6DD1nVPDvoMKPDGke13xNrHw5Asp3D3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hBy+wlrx8IYGIoS1pDt+KRx2IPkAdHFd9SeZ7Fp+7Sw=; b=oa1ZV/sGzyiZPv/zorLuDJEKO5Q2WAVomF9nOpvWSF6GDL7+UiHvnhl6/EA4hk1U7MMwFjdvHKDfUubMXS8AC6ieN+k4PqLN4gzuDFW0/x6CODLBYC0qEb1t4Op/NopGXNLfHHirASCYN4pwNH/RR0D+VayGiqGR9ahWCu5ftdzxw3PbPciKwq8c2KNj6pUOH74T+X/ZbBvIPe+whnc/wDB8mTz95ROT+62HXqQKyrWTRwLWrazwcoPokNpuIzorGqvDALJK1j+fjrAiKoPjRBUPpAKXnouCTGwIY7rb/aPrFPXind/5JmzG/iPGYfjcNGB4yY0gQmIVBDJUQgbJIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hBy+wlrx8IYGIoS1pDt+KRx2IPkAdHFd9SeZ7Fp+7Sw=; b=bCI5Oi8+xY7R1qA++Ph7zT2P3BxQRd0Re7otLW4HjrE/MW0L3v18VtUjbGNAVAXklCstwxRQsgtmQW1lRFjhvBGzAKbs3Hl5+KXIc+lPaIARRhc7kuH3CNx2nDK8g+q1ZkcxYVC8oHLCNUegGL+LpzUx0v5FudXrihw92moAf+A= Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (20.178.126.85) by VI1PR10MB3183.EURPRD10.PROD.OUTLOOK.COM (52.133.244.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14; Thu, 27 Feb 2020 13:56:10 +0000 Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::e58f:1097:b71d:32c7]) by VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::e58f:1097:b71d:32c7%5]) with mapi id 15.20.2772.012; Thu, 27 Feb 2020 13:56:10 +0000 Received: from prevas-ravi.prevas.se (5.186.115.35) by AM5P194CA0007.EURP194.PROD.OUTLOOK.COM (2603:10a6:203:8f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14 via Frontend Transport; Thu, 27 Feb 2020 13:56:09 +0000 From: Rasmus Villemoes To: "u-boot@lists.denx.de" CC: Wolfgang Denk , Simon Glass , Joe Hershberger , Rasmus Villemoes Subject: [PATCH 1/4] env: remove callback.o for an SPL build Thread-Topic: [PATCH 1/4] env: remove callback.o for an SPL build Thread-Index: AQHV7XWqCTIW3lOuE0mK79mGJ4Z8RA== Date: Thu, 27 Feb 2020 13:56:10 +0000 Message-ID: <20200227135600.28853-2-rasmus.villemoes@prevas.dk> References: <20200227135600.28853-1-rasmus.villemoes@prevas.dk> In-Reply-To: <20200227135600.28853-1-rasmus.villemoes@prevas.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM5P194CA0007.EURP194.PROD.OUTLOOK.COM (2603:10a6:203:8f::17) To VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) x-mailer: git-send-email 2.23.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=rasmus.villemoes@prevas.dk; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [5.186.115.35] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6b58fcb2-ca92-4946-1cc0-08d7bb8cccc8 x-ms-traffictypediagnostic: VI1PR10MB3183: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2399; x-forefront-prvs: 03264AEA72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(396003)(376002)(346002)(39840400004)(136003)(199004)(189003)(5660300002)(64756008)(2616005)(6666004)(66446008)(8976002)(66556008)(956004)(66946007)(6506007)(66476007)(2906002)(54906003)(71200400001)(8936002)(44832011)(107886003)(86362001)(6486002)(6512007)(186003)(36756003)(8676002)(26005)(81156014)(81166006)(316002)(1076003)(16526019)(478600001)(4326008)(52116002)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR10MB3183; H:VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: prevas.dk does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lrEG9V0/aYcPRTnm3aMsHPwO/Wkd7RqIn2MsVUTquYsrMdUEaez+Gndh+2DZO0p0fCk8jmdWSNvXoZTJKTmabFBgttPjM3rk+wqjZNTbcbXjdBYfWfXhEk/G9QLIDGwZnaEB+Vym2lEMHOSR1JVl02MGz7w+XA3UOq5SThGXcXe/7dO73wpJVjgwCHEs6E0rAU1Ta/rmVl73+O2Kr2qZUdiBOG6iVBb7QKuPvraUFKERir6D6+PlZ1YfQ7wWgeaKzqGkgS8SLzOuhsTbTqMqqyPjdsvtc+KdvkT7povCJEldHcke/77pTDyv35up8nbePs7xz3FGd1kDdv7rOah9VG0dqhIqIqO/tl8+c8V/J+xHkRzFZc6b+Zf6JFVBwIzdMy6mv5Hj4E5xsETjic/uxFXEOEBGrRFqZ6KHZmS0k4AcDH7zhBEkHrCHziifMPaI x-ms-exchange-antispam-messagedata: TAnA32/xGUNTqDhbwD65GfMx5BdrllAwXIphbGimIyJn7b7WC7UcT0L8zx94Luj5C4I8CQ9PDOEjrR3FRerHZmgaDa8C1srMs5ypxto4dWD0icpgI2NxfRaicjJEJ4/SJn2zNhDhhTuQA+OmRVbW7g== MIME-Version: 1.0 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 6b58fcb2-ca92-4946-1cc0-08d7bb8cccc8 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Feb 2020 13:56:10.3285 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: VZRLo/Z3LcvL/fql2GqQx1Wr6ZH5kaM5TGQvcJbOQ6NpWbUB5CzOEtkcK0ws9sfIq2/XVweT4mLsxGiwaos0j5kyVM1bLfoAarjmq2+B+dI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB3183 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean env.h says this about about callback declarations (U_BOOT_ENV_CALLBACK): * For SPL these are silently dropped to reduce code size, since environment * callbacks are not supported with SPL. So env_callback_init() does a lot of work to not find anything in the guaranteed empty env_clbk list. Drop callback.o entirely from the link and stub out the only public function defined in callback.o. This cuts about 600 bytes from the SPL on my ppc build. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- env/Makefile | 2 +- include/env_callback.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/env/Makefile b/env/Makefile index e2a165b8f1..c4ad654328 100644 --- a/env/Makefile +++ b/env/Makefile @@ -7,9 +7,9 @@ obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += common.o obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += env.o obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += attr.o obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += flags.o -obj-$(CONFIG_$(SPL_TPL_)ENV_SUPPORT) += callback.o ifndef CONFIG_SPL_BUILD +obj-y += callback.o obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o extra-$(CONFIG_ENV_IS_EMBEDDED) += embedded.o obj-$(CONFIG_ENV_IS_IN_EEPROM) += embedded.o diff --git a/include/env_callback.h b/include/env_callback.h index 74da20eec3..05e9516a0f 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -72,6 +72,12 @@ "serial#:serialno," \ CONFIG_ENV_CALLBACK_LIST_STATIC +#ifndef CONFIG_SPL_BUILD void env_callback_init(struct env_entry *var_entry); +#else +static inline void env_callback_init(struct env_entry *var_entry) +{ +} +#endif #endif /* __ENV_CALLBACK_H__ */ From patchwork Thu Feb 27 13:56:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1245868 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=hRE7vue5; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48SvNg4HXvz9shl for ; Fri, 28 Feb 2020 00:56:51 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D65DA80911; Thu, 27 Feb 2020 14:56:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="hRE7vue5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 13D0880671; Thu, 27 Feb 2020 14:56:20 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FORGED_SPF_HELO, SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0713.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1e::713]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6FADB80671 for ; Thu, 27 Feb 2020 14:56:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e1iaAP2iUXdSX3E9xrMMcWn9mO/rzzLVX7YHnr7hl/JTuyg9QsCK73oODjIMJxuwczaCRSL2UsUqW+STnzwdltcQSZ3hD3gkRa716kSXWxvFx+K+ZEXl3Ur5KFlfdh8ooinmuaNETGC3ks9EZ9sdBGb4FgnbLCk5X6WC9mZhNxCfYSxKDUL0BmNMXxHyWhEfLDoN+9SCxrAZNOgA63XOy/8hMt3nmE5RhppLnCA16LZx+fj5jYj6Jp1dUdoTtun9P/+E1/EPgNwix9Bk7A2bVzPIoEFc09fvxacEXFIxTmlexY2BBF3pNtBnT/gBXHUCJXKuT/SmWyBEweRkAuTiyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=grE29DFm4BiORkinIUZ33CabsVld5Yc39hSGnw4W2Zk=; b=X7PT7+jbYdhyWhI/bspRhh0pXTLref/gmyCEoGqscjlLNlRi6UvBd93CYPWYXhYbN/BXypKsuxl0SCJKFc803lg8ecjHshbmCCLLqnmcP4YRyl1QAx9YaFHhxnuso1yXIyG23D8y7RdwfJzHgJmsCN/YyOugdm30M1c6BeKHRfh8OtAmmWAckgIrIcLr4tcXI7uXGUuNJBPfm33MzLmVmKJQ7jlw//fVufUXb9Yu40Nyz1IKK1QoY7pWqqjiPhuDlzHEAPtTROkV3skrhAhbMmSawuHXrg6y21poZwpWJf2N0DCURgiwIN0SrcMO4HjXcyeKoNgZw+Qh0PpseeocAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=grE29DFm4BiORkinIUZ33CabsVld5Yc39hSGnw4W2Zk=; b=hRE7vue5LqGot3DN4So8iTvzCL0/FZQk5X7lp2za5NIXZlOgKIp/BsinCCGw4pfDkQK6vrJuN0LiIuxjE2nmdJ651k/rLZVLoIjJRN3S5JOm3+Lt5x7e9/DN7BVvQs/HqRGvNJwCOhMYMR3DOjGAxM1dRirTd94vQyw9ty2YoTw= Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (20.178.126.85) by VI1PR10MB3183.EURPRD10.PROD.OUTLOOK.COM (52.133.244.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14; Thu, 27 Feb 2020 13:56:12 +0000 Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::e58f:1097:b71d:32c7]) by VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::e58f:1097:b71d:32c7%5]) with mapi id 15.20.2772.012; Thu, 27 Feb 2020 13:56:12 +0000 Received: from prevas-ravi.prevas.se (5.186.115.35) by AM5P194CA0007.EURP194.PROD.OUTLOOK.COM (2603:10a6:203:8f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14 via Frontend Transport; Thu, 27 Feb 2020 13:56:10 +0000 From: Rasmus Villemoes To: "u-boot@lists.denx.de" CC: Wolfgang Denk , Simon Glass , Joe Hershberger , Rasmus Villemoes Subject: [PATCH 2/4] lib/hashtable.c: create helper for calling env_entry::callback Thread-Topic: [PATCH 2/4] lib/hashtable.c: create helper for calling env_entry::callback Thread-Index: AQHV7XWqkTrftNXJCkOgBdKGaMWLzg== Date: Thu, 27 Feb 2020 13:56:11 +0000 Message-ID: <20200227135600.28853-3-rasmus.villemoes@prevas.dk> References: <20200227135600.28853-1-rasmus.villemoes@prevas.dk> In-Reply-To: <20200227135600.28853-1-rasmus.villemoes@prevas.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM5P194CA0007.EURP194.PROD.OUTLOOK.COM (2603:10a6:203:8f::17) To VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) x-mailer: git-send-email 2.23.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=rasmus.villemoes@prevas.dk; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [5.186.115.35] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bfd7f6f4-ae8b-4115-e926-08d7bb8ccd3e x-ms-traffictypediagnostic: VI1PR10MB3183: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:309; x-forefront-prvs: 03264AEA72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(396003)(376002)(346002)(39840400004)(136003)(199004)(189003)(5660300002)(64756008)(2616005)(66446008)(8976002)(66556008)(956004)(66946007)(6506007)(66476007)(2906002)(54906003)(71200400001)(8936002)(44832011)(107886003)(86362001)(6486002)(6512007)(186003)(36756003)(8676002)(26005)(81156014)(81166006)(316002)(1076003)(16526019)(478600001)(4326008)(52116002)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR10MB3183; H:VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: prevas.dk does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: R9wW4FU+5nZFNgVKn1Ta/Om1gSCRZXwLl5jw3Pg5SPWJKSYOFtZaUjUd2K27PoWdkghLOv2jM+S+1Zk9p1JW6P4x3/pigMnecBFtHwBcN+065bqs/YqKLokS+7NGhKhQFlMt46pUVSw54mlv5W9jFwJiTxkyMGB40wwaRdaVMHrxxvw3YRBdGRungo+BJ7ju2OvT9S3Re9fzlW8GX8dGO+obCgwNnOdEVF3KZeor81uZivY/5139AI0znjgUTwiUiEnVVXMcYVeHQq/aNvVdhYTt4yYovwLQojgJ80qtXK1yy02VQegFYIWpNpz46stnMEb5CSBWJb7TlD+0j+5ozKtmG4CO3hBg4FK/NAzHqfB2TywH3uNYDFz72VKV+RXcUE0S8llVpu8W7OQRWqEN1XpZUtDcaTOHbfp5yDZbR6iyUyuLwjAoZVT0R0M9v6qd x-ms-exchange-antispam-messagedata: QtuESKpR7OJkQU82AuSKfbSs8sz5vSF+K1u3VKIPhlEnybEdnA8RdPbvFRQwaAKnMOJn+r25XG6ZjyJZg+7LKshPgjerEh6Yr5gSTFrcsYvB2IwWecJlC8DfyGfeXgh6gOtKlDJKvYW984fjjWZ2mQ== MIME-Version: 1.0 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: bfd7f6f4-ae8b-4115-e926-08d7bb8ccd3e X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Feb 2020 13:56:11.1101 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 2InVNM5N0yoCl3FJQsQOObJx8f+l1OJGezHfJ1qSebQc9Q+rS1cYb/ATXfqaOYlPaUI8hGWvApYZuR8ZyjuoRDYpGcgoU1L/MiMpDEbfyk8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB3183 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean This is preparation for compiling out the "call the callback" code and associated error handling for SPL, where ->callback is always NULL. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- lib/hashtable.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/hashtable.c b/lib/hashtable.c index 907e8a642f..574ec6af86 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -222,6 +222,15 @@ int hmatch_r(const char *match, int last_idx, struct env_entry **retval, return 0; } +static int +do_callback(const struct env_entry *e, const char *name, const char *value, + enum env_op op, int flags) +{ + if (e->callback) + return e->callback(name, value, op, flags); + return 0; +} + /* * Compare an existing entry with the desired key, and overwrite if the action * is ENV_ENTER. This is simply a helper function for hsearch_r(). @@ -247,9 +256,8 @@ static inline int _compare_and_overwrite_entry(struct env_entry item, } /* If there is a callback, call it */ - if (htab->table[idx].entry.callback && - htab->table[idx].entry.callback(item.key, - item.data, env_op_overwrite, flag)) { + if (do_callback(&htab->table[idx].entry, item.key, + item.data, env_op_overwrite, flag)) { debug("callback() rejected setting variable " "%s, skipping it!\n", item.key); __set_errno(EINVAL); @@ -402,9 +410,8 @@ int hsearch_r(struct env_entry item, enum env_action action, } /* If there is a callback, call it */ - if (htab->table[idx].entry.callback && - htab->table[idx].entry.callback(item.key, item.data, - env_op_create, flag)) { + if (do_callback(&htab->table[idx].entry, item.key, item.data, + env_op_create, flag)) { debug("callback() rejected setting variable " "%s, skipping it!\n", item.key); _hdelete(item.key, htab, &htab->table[idx].entry, idx); @@ -473,8 +480,8 @@ int hdelete_r(const char *key, struct hsearch_data *htab, int flag) } /* If there is a callback, call it */ - if (htab->table[idx].entry.callback && - htab->table[idx].entry.callback(key, NULL, env_op_delete, flag)) { + if (do_callback(&htab->table[idx].entry, key, NULL, + env_op_delete, flag)) { debug("callback() rejected deleting variable " "%s, skipping it!\n", key); __set_errno(EINVAL); From patchwork Thu Feb 27 13:56:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1245869 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=jQbZBGy0; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48SvNt4BFpz9shr for ; Fri, 28 Feb 2020 00:57:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3F2E380EC2; Thu, 27 Feb 2020 14:56:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="jQbZBGy0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0C1C280911; Thu, 27 Feb 2020 14:56:20 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FORGED_SPF_HELO, SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0713.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1e::713]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 39F9C80829 for ; Thu, 27 Feb 2020 14:56:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hhuB0YmN1MJvxQQpAmkWfpImQiSj/ID0NiP4KiVAG2goOjbTMrP8YdUVWQkhLcd/URn8qZpBTpheBDhkt5P5cAEr2lmnzSCzKHwuur9g7Sjun3GnQq66F0nj5SMaj85JPaWQSlrwBvlIT8EckgTtzPpDsr9KWvwG1eCadNqivYuZo7CDvAMwzQSLObZs2c2ZEhgevji7qrVFdah+ubxbnKWA+SH+MlXVuJsWm8hEoU/3/wpuLjDvhYn/JHZ2B2lOJiJPPk0vrwgqcP4N6hZTp5KKTaMhyraMlQ22qWmxvbTz9KNw1ZuIWO47+IYPawilPnczcbP4mBYKUqBhw7HUow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=au7VmFTywrn/EtG4/MLh2sQXSmFiaaufmxyJuGF1pmc=; b=PZR0s3sm74K0cK4WDpO7K82dmDeU4glikY2gJenUThY8KmRRgukawP88+MaXhsyUkellEYUk/mU1ToXj/aZoV9ph1Jf4ipOIFmhgshGvp4m/cwf7u9uPiHLnMyJI/VNSejDNDr05/igXNnoRuEqDB9BXXIWEVQM0kjSs+Y4zeUM7Fs5md4q8R2oR3NBpSfagVUVP9EmpuGXS9ldjTXIxv9Yi/zhiSuGs5T1GU4vnq1ahV04M1HUSYU010ioPxYlEa5zJL1NxO5QxnQUb6m7gOt4ouHGmdBjKzby7qjzK3m77Hp0orizzsRPab4CLBTpFPhikks+A+SR86ZQh14h0Bg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=au7VmFTywrn/EtG4/MLh2sQXSmFiaaufmxyJuGF1pmc=; b=jQbZBGy0GtXHYsP9LFzecbsOsYkuOwVsVku5VVJJf5EWhQEI4O3t1wnJccAEf8XdH8IFRUo0Oa9zFEQ5kwj9F3RSB2fuY8SWE45/QaNwXnYCJk6HIAmGvNWKjw5Ub19tdgJypZ/UVM0smmZL6dxm9xA62LSMxDT8TAbBTFSg6I0= Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (20.178.126.85) by VI1PR10MB3183.EURPRD10.PROD.OUTLOOK.COM (52.133.244.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14; Thu, 27 Feb 2020 13:56:12 +0000 Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::e58f:1097:b71d:32c7]) by VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::e58f:1097:b71d:32c7%5]) with mapi id 15.20.2772.012; Thu, 27 Feb 2020 13:56:12 +0000 Received: from prevas-ravi.prevas.se (5.186.115.35) by AM5P194CA0007.EURP194.PROD.OUTLOOK.COM (2603:10a6:203:8f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14 via Frontend Transport; Thu, 27 Feb 2020 13:56:11 +0000 From: Rasmus Villemoes To: "u-boot@lists.denx.de" CC: Wolfgang Denk , Simon Glass , Joe Hershberger , Rasmus Villemoes Subject: [PATCH 3/4] lib/hashtable.c: don't test ->callback in SPL Thread-Topic: [PATCH 3/4] lib/hashtable.c: don't test ->callback in SPL Thread-Index: AQHV7XWrOgW7rY0xIUey13WxFrRjZA== Date: Thu, 27 Feb 2020 13:56:11 +0000 Message-ID: <20200227135600.28853-4-rasmus.villemoes@prevas.dk> References: <20200227135600.28853-1-rasmus.villemoes@prevas.dk> In-Reply-To: <20200227135600.28853-1-rasmus.villemoes@prevas.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM5P194CA0007.EURP194.PROD.OUTLOOK.COM (2603:10a6:203:8f::17) To VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) x-mailer: git-send-email 2.23.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=rasmus.villemoes@prevas.dk; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [5.186.115.35] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 02ccba07-43bd-40a9-8249-08d7bb8ccda9 x-ms-traffictypediagnostic: VI1PR10MB3183: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2399; x-forefront-prvs: 03264AEA72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(396003)(376002)(346002)(39840400004)(136003)(199004)(189003)(5660300002)(64756008)(2616005)(66446008)(8976002)(66556008)(956004)(66946007)(6506007)(66476007)(2906002)(54906003)(71200400001)(8936002)(44832011)(107886003)(86362001)(4744005)(6486002)(6512007)(186003)(36756003)(8676002)(26005)(81156014)(81166006)(316002)(1076003)(16526019)(478600001)(4326008)(52116002)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR10MB3183; H:VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: prevas.dk does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: f5G4nuPogChHgHXFt11VRZKhNvnhkpjS4Q+71oriIAJm4v6gY/bNo0P9+lRVnJ3IlApkiCbkPnj11UOBRACB1MJMSWK3PBd/kzQRh/J7B57H/kDPnl6DH4mtF/+jc3O7GUnGGaNJyVaHnG6O/t7QMOsgCUiTOENz3plNgmP8weT6krynMrDbRtXWjDMCO/zjWv4/EvpgU0s3D9d15FQAb0Pm/SwHdXBmQuJ3lhFJ7i6neSq0Fa+sQpIBgE2pV10kGIGM8P/TQe9EFT6eyGqoPlIxaOUfqsZvXRCI5Xye0WQ8UA9VXm0w8Akn1zSsoJlUDH3kZW2dW9oRGzD5czjRf/PSTzEgU28nFu7jiBAdkkmnDr6iQmvJvVw8MskCI/KV3uZgqHAZuz9Wmk1J5TDlc5T1a5w4cUlwu6ALJv4rYPWylOeqeoj8Svuqi687OOWP x-ms-exchange-antispam-messagedata: 78aR2q9aZozImNKl4jPvs+iJeAqJRKGUY6CB4PmIdye5urULN3LPjGNYQ90NgcU34+5WZFR6jqp8ZzRq0VYzxmbtDR+m18hXyrh6lDKM5FO+vV/bMOo96LcPZuPstCOdo3qEKQMoFcECSxGlt9KaOQ== MIME-Version: 1.0 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 02ccba07-43bd-40a9-8249-08d7bb8ccda9 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Feb 2020 13:56:11.8846 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SIEb/KakVc1GRJn/rYWh8g2iNLHpZMNZl0hn+00XcRys1z+p4oUp9xR8eq1l/f8sQnoFxoRr1SIYcILQy4nlfZBX4uUvgS74EEB4YA4UCKM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB3183 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean In SPL, environment callbacks are not supported, so e->callback is always NULL. Removing this makes the SPL a little smaller (about 400 bytes in my ppc build) with no functional change. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- lib/hashtable.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/hashtable.c b/lib/hashtable.c index 574ec6af86..c4e1e2bd45 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -226,8 +226,10 @@ static int do_callback(const struct env_entry *e, const char *name, const char *value, enum env_op op, int flags) { +#ifndef CONFIG_SPL_BUILD if (e->callback) return e->callback(name, value, op, flags); +#endif return 0; } From patchwork Thu Feb 27 13:56:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1245870 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=ZKZvUYdL; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48SvP6039zz9shr for ; Fri, 28 Feb 2020 00:57:13 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 02CCB81022; Thu, 27 Feb 2020 14:56:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="ZKZvUYdL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0897280E7E; Thu, 27 Feb 2020 14:56:20 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FORGED_SPF_HELO, SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0713.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1e::713]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7E83480857 for ; Thu, 27 Feb 2020 14:56:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NWnL/HMdUqzVZ5pVPmtVYDnIO66dDR8jcPGUGBzbdUE0eb7XATueYQKQpuTGEPWjrmBoo4VA0nUSPM2+aSlXyRsd6wPaWc6gwVBFTvHuHdS9+GzWsCWUJXI+FjNsbmHuIO618by+7SlOtkCxU4WgqlEje50J3dloxRFfVm97Awy8frzrR/xQeViBQwtVy/+qqYEAl8TifHefbydOO4gnUKTMOsOsFpDue2gBdSDPq8pCPY25+EvlA9oC3Lg1C1AH1GThe2YVB8GyI4n6fDeWgmp4Dijub6XyxasxL6eKtj/jKF7554iBl5Baq9Lrs8d19unyUArgIHth5PXjKrLouA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c+77D6W07kTDGJ9+tAepdI5NwJCB7V57J1HMPJGjnI4=; b=BQLXey7BExk5HXIyb4WIpnzWz743VaG8rpelrdEDh4/E17e+sbKSU0zbkhqELzsyLhW4YhAbRTaThreVmls73+EPeGdOYgIGAoiSPTIOMmva/aZMILC7hJfFe3JaGfhZjOL8IVA1Gelq08/6jXVc/1+uQw82v7HjdXvOU5rW45BMVVNmUQPprQH/eKZ/2SoTcKMEgHy1gAMtapnf8JH2Pg+kR5wtdlHvuVua3U1uacwELspsKJawuWwOVK59DMbS1jE2gs+6SZdVVEckpWxF9fN6rz2MJA+Q3vWJuffZCLfRv6F5IymCdPgPZHVDUNmtFaKQLQDiJVxUZlsg7WQsjw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c+77D6W07kTDGJ9+tAepdI5NwJCB7V57J1HMPJGjnI4=; b=ZKZvUYdLTiWZpVdyXr/MExwFtVzVpD6i71h9RZYVOLjVwKbdjthaXtlNF5RcoYShz6Gu13GINaA4ws6gapH4VSScQi/ui1HToeFl+JPa4pH+KXE3E+1vevtFukpuXAv9dueNCk0Eto2jlOd2ILqquACv+9sDXmSpaojJ2Jj/fzg= Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (20.178.126.85) by VI1PR10MB3183.EURPRD10.PROD.OUTLOOK.COM (52.133.244.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14; Thu, 27 Feb 2020 13:56:13 +0000 Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::e58f:1097:b71d:32c7]) by VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::e58f:1097:b71d:32c7%5]) with mapi id 15.20.2772.012; Thu, 27 Feb 2020 13:56:13 +0000 Received: from prevas-ravi.prevas.se (5.186.115.35) by AM5P194CA0007.EURP194.PROD.OUTLOOK.COM (2603:10a6:203:8f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14 via Frontend Transport; Thu, 27 Feb 2020 13:56:12 +0000 From: Rasmus Villemoes To: "u-boot@lists.denx.de" CC: Wolfgang Denk , Simon Glass , Joe Hershberger , Rasmus Villemoes Subject: [PATCH 4/4] make env_entry::callback conditional on !CONFIG_SPL_BUILD Thread-Topic: [PATCH 4/4] make env_entry::callback conditional on !CONFIG_SPL_BUILD Thread-Index: AQHV7XWrSZdcwAJl506WzaciEPfXEA== Date: Thu, 27 Feb 2020 13:56:12 +0000 Message-ID: <20200227135600.28853-5-rasmus.villemoes@prevas.dk> References: <20200227135600.28853-1-rasmus.villemoes@prevas.dk> In-Reply-To: <20200227135600.28853-1-rasmus.villemoes@prevas.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM5P194CA0007.EURP194.PROD.OUTLOOK.COM (2603:10a6:203:8f::17) To VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) x-mailer: git-send-email 2.23.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=rasmus.villemoes@prevas.dk; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [5.186.115.35] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 858c3e7d-876e-4a34-c7ae-08d7bb8cce27 x-ms-traffictypediagnostic: VI1PR10MB3183: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 03264AEA72 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(396003)(376002)(346002)(39840400004)(136003)(199004)(189003)(5660300002)(64756008)(2616005)(66446008)(8976002)(66556008)(956004)(66946007)(6506007)(66476007)(2906002)(54906003)(71200400001)(8936002)(44832011)(107886003)(86362001)(6486002)(6512007)(186003)(36756003)(8676002)(26005)(81156014)(81166006)(316002)(1076003)(16526019)(478600001)(4326008)(52116002)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR10MB3183; H:VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: prevas.dk does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: FBP2KzEu2e9G0FRDdOpS2WNO5jjUhoI+usQIB2AD74LgBqyth/hfbeDAhIxFld+dESGF8TFYO40c5to9VthfmWLTSnaUqtFb8xTBl5u0sgL7KSmy+fdQOgmHQUKxgBbWe+N1WfGYlhbFYc59SlqGo1A+WYFFwv44q8fj8BmqEfGI+Yoyz04Y1FORB5fDblX6MYy8yyTKW7ZF6eFg1PZmBczaZAptOowavEsFDYlLkdi5itiOufujlXfgS0dQ2ctA2g/OWI/jN5nmiR9qcWHTj/ABnuZL+F4fNSi2py3HL3aEgYMNmoACVIzFbA6Eud7rrFzL+eB/OjJIKfNyZjE75T1hjLAg+xaQtZdGY5lNlnGStlIQDcRtRirhADSMzqUMTQG9AyUSvveoHaxFP3G3y3hZqXAGDzJqlH99gYLNFGieF/5x4GAdNS/1mnnG0wv0 x-ms-exchange-antispam-messagedata: RqmFH4GF/Mpc5XjMiggdlQbt+XfpA+FWXs73+qzUg8w18pPk2tTO/a5Bzgaqy9ivDwlCUHux6r2Ex2EiGvelHZD0ofHhznBwDMhpvK+ygO3HOYeJsJpuY/9Zm4mVCTvwA2x7Uchk+uPx5SWqAAwkEQ== MIME-Version: 1.0 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 858c3e7d-876e-4a34-c7ae-08d7bb8cce27 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Feb 2020 13:56:12.6852 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0Rz/ANuQTHtAVtDnDl9km9EcNf7I1Vs8GKp5Jfv3lpYOtU32sJV+xzRpM2yV4YCl1xT307G6Rd5ujxOL7sRvynyFYTXNrJNCBKEvLfsaP3c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB3183 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean The callback member of struct env_entry is always NULL for an SPL build. Removing it thus saves a bit of run-time memory in the SPL (when CONFIG_SPL_ENV_SUPPORT=y) since struct env_entry is embedded in struct env_entry_node - i.e. about 2KB for the normal case of 512+change hash table entries. Two small fixups are needed for this, all other references to the callback member are already under !CONFIG_SPL_BUILD: Don't initialize .callback in set_flags() - hsearch_r doesn't use that value anyway. And make env_callback_init() initialize ->callback to NULL for a new entry instead of relying on an unused or deleted entry having NULL in ->callback. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- env/callback.c | 2 ++ env/flags.c | 1 - include/search.h | 2 ++ lib/hashtable.c | 1 - 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/env/callback.c b/env/callback.c index f0904cfdc5..4054b9ef58 100644 --- a/env/callback.c +++ b/env/callback.c @@ -55,6 +55,8 @@ void env_callback_init(struct env_entry *var_entry) first_call = 0; } + var_entry->callback = NULL; + /* look in the ".callbacks" var for a reference to this variable */ if (callback_list != NULL) ret = env_attr_lookup(callback_list, var_name, callback_name); diff --git a/env/flags.c b/env/flags.c index 418d6cc742..b88fe7ba9c 100644 --- a/env/flags.c +++ b/env/flags.c @@ -457,7 +457,6 @@ static int set_flags(const char *name, const char *value, void *priv) e.key = name; e.data = NULL; - e.callback = NULL; hsearch_r(e, ENV_FIND, &ep, &env_htab, 0); /* does the env variable actually exist? */ diff --git a/include/search.h b/include/search.h index 0469a852e0..8f87dc72ce 100644 --- a/include/search.h +++ b/include/search.h @@ -29,8 +29,10 @@ enum env_action { struct env_entry { const char *key; char *data; +#ifndef CONFIG_SPL_BUILD int (*callback)(const char *name, const char *value, enum env_op op, int flags); +#endif int flags; }; diff --git a/lib/hashtable.c b/lib/hashtable.c index c4e1e2bd45..f82f2463cf 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -450,7 +450,6 @@ static void _hdelete(const char *key, struct hsearch_data *htab, debug("hdelete: DELETING key \"%s\"\n", key); free((void *)ep->key); free(ep->data); - ep->callback = NULL; ep->flags = 0; htab->table[idx].used = USED_DELETED;