From patchwork Fri Jan 3 11:13:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 854865 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp8187772wrq; Fri, 3 Jan 2025 03:14:27 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWH7CQ0tBseeYbcCkD/0TIGOe1VcCl2Qs6d6Qt1Tmknw6hT5TrVQpzca3/bGt/0RpUTe9rloA==@linaro.org X-Google-Smtp-Source: AGHT+IHgKzzMevZCrz1SUDl8lcCQq3Ip0etxu1KDgprvC4ZPkdpQpzJSzNmNAM1mSmLT4hNcBpIn X-Received: by 2002:a17:907:8dce:b0:aae:df74:acd1 with SMTP id a640c23a62f3a-aaedf74c300mr3254627166b.11.1735902867704; Fri, 03 Jan 2025 03:14:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735902867; cv=none; d=google.com; s=arc-20240605; b=F7/1T1jM50cArJgzLpvZYeEyQSMPjDWvK/CktHmepUJCsIAI86ixjcB5dhcrNNXW4i laFvdH5LcTPqvAgbOqenc+gfwqVF41py6JYWQgTqzHYAAJILB10VZZ0BheD4tE+CfyQ6 j2E+2A1MI0YU3VqIlRATpU3Og/IjbEYNRHFeVRRiINgjfD52e6udf/ugc0Fw+V2ST22O RIQ213p4xv49SvT9s3LWAhCiEv0xmq0D/GTcTweqBxvj+gvwd4xyKlEsegfotUNL1Ms4 VuKQyFTIWKCve+qGyNvpVvhVxZuuHxAWce/ZrgA+OBJRxLdL0JKTCeaI5SpizG/LRorW XZBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O+OcPxI2SSdquESZgqrciQ1/6QS8udlDuX8uSxv68oQ=; fh=CNnbbzflKG7ylJ86l34Ik34OFHtwbu+6ouoe5RXwBQc=; b=N6xmmrhJPovRZHRxg6p/ezgcpY5Cx/JX094+uqBGZ3R+wqxX6XbNpn57bkb4a+nzM1 aaLMHU/4uATGEoZxFOeqqHnfRAakn9FNoyWdY36orSICNroYp7zYwQLS+QDLlcRRoXV2 G9A6cCb3gkWDt+A8pzR0elzOXISZTEBzDO4lJ+UReurn2iGcR6MLyEUKa5sHQLeTbkHV 6gh2YYgU4Dfl1HTR0CYiY4VLGpjQNFXsNV1Irak0KtD8yDibcrle9XkYzd/vMHx28vDd CuJjXCLq5WVsC3EpN+x60JLbyP3qU+FIqQ1d/DHQjDrcWzw9LuTG3G1QuxIrwcJDuiKU mvZA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EVaRkp/K"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-aac0f046c73si1821327766b.617.2025.01.03.03.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 03:14:27 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EVaRkp/K"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 285588044A; Fri, 3 Jan 2025 12:13:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="EVaRkp/K"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 172EF80295; Fri, 3 Jan 2025 12:13:44 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 6DE7B80196 for ; Fri, 3 Jan 2025 12:13:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4361f664af5so137493525e9.1 for ; Fri, 03 Jan 2025 03:13:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735902821; x=1736507621; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=O+OcPxI2SSdquESZgqrciQ1/6QS8udlDuX8uSxv68oQ=; b=EVaRkp/KKh+qLCU7JY48Vd/Kd4kVu25yj2fP0zQjddzsXXHt/AAAyPDjBTxp7gR+Jq eoN15DelYihHB0RB2s9NLcWaBt4n7alpHdCjRaVlPt1tIg92zd+Mj/WqEndfVWO66ywy e09d+mmUQjmnrtopV5iRSqreJVeMp6HSZCrC7cpRAK3STOctrWq5GhTctdNnuPBKBGkk qgjKaErl9hdpurrBCuVc7GNPhAxKii/LnL1w27l+yYApBz4j3k0n57ixL6k+eD9+QNuQ 14Gwxh72Yg7VPwDeMF+qsjgX56q+rls0gklkAcXT4OYsn15xTcWhd2NRGfV4PRX8e5Mx pbWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735902821; x=1736507621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O+OcPxI2SSdquESZgqrciQ1/6QS8udlDuX8uSxv68oQ=; b=aTQp6/rHPIEtVBOfFOCWJAFwvfpdxbSXX0v039wPkPtlRuMFOaqiOK/e6eJhXlz4rB Dxol7Hs4mwgWGoJySHci3SooDdLkQV/d+gOTO85A23ieJX1ooTeQm1gT7seci4mx6p45 OjvC0JjQX85iMoGO/keO9bDJQ0YIaxaG18kUQsl23nqUcM5K/MyFHhFX/cXBxbG7dRQt FzdhElaeQr/oHb8+tfOII4a2xMAMHGtRc69aCUWNDXsBm8U9KsgQ5YPdxtg76AOOzB6L RlHwrBi7FzAjSLAdfuaj7f4jErJ/Mo38KxZh0UzLb7EwAyx5W2nqO0j2WV8z2VhJuvOH gp6w== X-Gm-Message-State: AOJu0Yzt2vpG7stciFZoFPAUHT41M+nsNTHZuPJD+9dBQJxBFhrO/6Cx WMhpf8dDZ6vQqlhnHFbPKcbwpc21M9my/OtnbLPAlGo10vuwdakx/4ujHxy8rMJHyiSnQ9lY1fM AxRs= X-Gm-Gg: ASbGncucpQbQfl/QjGxZ8t3QvplTMsE/xaBV6pC4VEM1zy99KaxFkhKLLxHQ8R1CLHo pwJ6rCLCLeAX4TjcYPv20NKBlpvaKf1yZcvRGYgH8WyHdliLEUUGTC+p1jr/QeTzUXF32QODnow hIauvs1q6TPy0MSOMA32AHNqDhzNn4hqxBuvuETFiPgnfiJO/IBAOGbNMNsbuDmNsyphLrbAHyW 9rM5e+CeK74iI4Xr2dxjK2fSVh+MjusS09sivq/w6ERgbO1Qv8M2H9nqRU7OEBm/w== X-Received: by 2002:a05:600c:1388:b0:434:a7e3:db5c with SMTP id 5b1f17b1804b1-436686440abmr400101335e9.11.1735902820604; Fri, 03 Jan 2025 03:13:40 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656a0b361sm513138075e9.0.2025.01.03.03.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 03:13:40 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Tom Rini , Simon Glass , Michal Simek , Jerome Forissier , Raymond Mao , Sughosh Ganu , Heinrich Schuchardt , Caleb Connolly , Dan Carpenter Subject: [PATCH v3 5/5] initcall: remove initcall_run_list() Date: Fri, 3 Jan 2025 12:13:17 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean Now that all initcalls have been converted to static calls, remove initcall_run_list(). Signed-off-by: Jerome Forissier --- include/initcall.h | 24 ----------- lib/Makefile | 1 - lib/initcall.c | 102 --------------------------------------------- 3 files changed, 127 deletions(-) delete mode 100644 lib/initcall.c diff --git a/include/initcall.h b/include/initcall.h index 8e22526dd9e..220a55ad84d 100644 --- a/include/initcall.h +++ b/include/initcall.h @@ -12,30 +12,6 @@ _Static_assert(EVT_COUNT < 256, "Can only support 256 event types with 8 bits"); -/** - * init_fnc_t - Init function - * - * Return: 0 if OK -ve on error - */ -typedef int (*init_fnc_t)(void); - -/* Top bit indicates that the initcall is an event */ -#define INITCALL_IS_EVENT GENMASK(BITS_PER_LONG - 1, 8) -#define INITCALL_EVENT_TYPE GENMASK(7, 0) - -#define INITCALL_EVENT(_type) (void *)((_type) | INITCALL_IS_EVENT) - -/** - * initcall_run_list() - Run through a list of function calls - * - * This calls functions one after the other, stopping at the first error, or - * when NULL is obtained. - * - * @init_sequence: NULL-terminated init sequence to run - * Return: 0 if OK, or -ve error code from the first failure - */ -int initcall_run_list(const init_fnc_t init_sequence[]); - #define INITCALL(_call) \ do { \ if (_call()) { \ diff --git a/lib/Makefile b/lib/Makefile index 5cb3278d2ef..13fb36ce3ad 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -44,7 +44,6 @@ obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o obj-$(CONFIG_SMBIOS_PARSER) += smbios-parser.o obj-$(CONFIG_IMAGE_SPARSE) += image-sparse.o -obj-y += initcall.o obj-y += ldiv.o obj-$(CONFIG_XXHASH) += xxhash.o obj-y += net_utils.o diff --git a/lib/initcall.c b/lib/initcall.c deleted file mode 100644 index 2686b9aed5c..00000000000 --- a/lib/initcall.c +++ /dev/null @@ -1,102 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (c) 2013 The Chromium OS Authors. - */ - -#include -#include -#include -#include -#include - -DECLARE_GLOBAL_DATA_PTR; - -static ulong calc_reloc_ofs(void) -{ -#ifdef CONFIG_EFI_APP - return (ulong)image_base; -#endif - /* - * Sandbox is relocated by the OS, so symbols always appear at - * the relocated address. - */ - if (IS_ENABLED(CONFIG_SANDBOX) || (gd->flags & GD_FLG_RELOC)) - return gd->reloc_off; - - return 0; -} - -/** - * initcall_is_event() - Get the event number for an initcall - * - * func: Function pointer to check - * Return: Event number, if this is an event, else 0 - */ -static int initcall_is_event(init_fnc_t func) -{ - ulong val = (ulong)func; - - if ((val & INITCALL_IS_EVENT) == INITCALL_IS_EVENT) - return val & INITCALL_EVENT_TYPE; - - return 0; -} - -/* - * To enable debugging. add #define DEBUG at the top of the including file. - * - * To find a symbol, use grep on u-boot.map - */ -int initcall_run_list(const init_fnc_t init_sequence[]) -{ - ulong reloc_ofs; - const init_fnc_t *ptr; - enum event_t type; - init_fnc_t func; - int ret = 0; - - for (ptr = init_sequence; func = *ptr, func; ptr++) { - reloc_ofs = calc_reloc_ofs(); - type = initcall_is_event(func); - - if (type) { - if (!CONFIG_IS_ENABLED(EVENT)) - continue; - debug("initcall: event %d/%s\n", type, - event_type_name(type)); - } else if (reloc_ofs) { - debug("initcall: %p (relocated to %p)\n", - (char *)func - reloc_ofs, (char *)func); - } else { - debug("initcall: %p\n", (char *)func - reloc_ofs); - } - - ret = type ? event_notify_null(type) : func(); - if (ret) - break; - } - - if (ret) { - if (CONFIG_IS_ENABLED(EVENT)) { - char buf[60]; - - /* don't worry about buf size as we are dying here */ - if (type) { - sprintf(buf, "event %d/%s", type, - event_type_name(type)); - } else { - sprintf(buf, "call %p", - (char *)func - reloc_ofs); - } - - printf("initcall failed at %s (err=%dE)\n", buf, ret); - } else { - printf("initcall failed at call %p (err=%d)\n", - (char *)func - reloc_ofs, ret); - } - - return ret; - } - - return 0; -}