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;