From patchwork Mon Jan 6 14:40:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 855278 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp9475393wrq; Mon, 6 Jan 2025 06:40:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWiOwl+h4mxO0uxcUnM58Qdl5GSbacStkRJzYe7dQ93qDdVHn+LhfJdkbDsAEVB8sAWk+1sfA==@linaro.org X-Google-Smtp-Source: AGHT+IElB7TmDA0ZeoUOz+EWYBGJu7vEhFjEP1FtollmZUoLrco5lZnQ8JWv8nRpEYuAZP9hf9wd X-Received: by 2002:a17:907:1c85:b0:aa6:29dc:11b with SMTP id a640c23a62f3a-aac3342c7f4mr5785795366b.16.1736174452125; Mon, 06 Jan 2025 06:40:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736174452; cv=none; d=google.com; s=arc-20240605; b=dp6XYdkPS2NFhhWtycXUvhRV0Y0tbzfQSEQy8L4YYTOMxQ7hTWIquwnKf97mdd+69e h9kZg+lEds2SLS2Dai11ZwhfRI/jM6bOHcDUnBRKia5NWk0gMEGSbQTp/BD1u0mnNRi5 8IkdY9iBBFHm9sUAlt6gMqCyUqkBWAybPtDRwT4dnwBeTDbZbHu9yf85ABFbkVFcwBNV lWayUZGqIgLb0YnY0x0tW4NTjV6HNEG9CMxqG0ar8+dS7eNwm57uqc8oDUi3/dBikJkl FniLRTajBcsVD3QD1dHpM2M0ectCLvlMFXTU0IYOKUHVuAHdhziIiFpCt8T0UdG52WkA nS9g== 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=c7w4aa9YSpeHJo6M0z+rlH++alaRMGDtF52ANeErY2A=; b=JwIK70JJ2Qi6hOeiL7sfCPKbcpf9Od3fsmDN9sexiuvBvtl4uzdt17dYA8cjFI3Ivf ZB8jmsyNi5tAYBNMzUiWuA9cbgwMnH0clBA2+eKEWiBnoU9Cejj68Rv0qaWN06L9q0nS tsQYOYM3ULpirUg0gAHj5mqF1Yts+vbRTRXKE6zjczmvceUp5Yr2ERhuyrlOivoq6Aa6 9Q44AFblM3Q2BC3XZqBi2DZwNJQoGNBXj2O89j9B3qznHSDFuUzdwCpPYzQI93ZOsvoY wofFKFHkXXJsTkTsf/fipCmMRS+pO/CZzi3Jo3BqT9Y0DrAeCZ9URJuws68+9kr7OEIX VKKA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GbhumgAg; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-aac0e7f4eccsi2184665866b.117.2025.01.06.06.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2025 06:40:52 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GbhumgAg; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 2E53A8056D; Mon, 6 Jan 2025 15:40:46 +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="GbhumgAg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4917680613; Mon, 6 Jan 2025 15:40:45 +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-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (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 3B0CE801E8 for ; Mon, 6 Jan 2025 15:40:43 +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-wr1-x434.google.com with SMTP id ffacd0b85a97d-385ef8b64b3so11317238f8f.0 for ; Mon, 06 Jan 2025 06:40:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736174442; x=1736779242; 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=GbhumgAgTpF4ndXPw5B/Caend7spDWunR3hnHhDmA1j5IdbUa/KmnifW241VcZZbk2 L6v1UmYg1Ie3WxLUXIogOyW8jkrBPuKHiuwKcjblQMYFwR50Mz+MY9uKvuWCr2lDkjbA +dR5myCOx/G2OUpWJFmgtn6t4oblhoIDWlcHCD1PNgQbOXIJZh5g053kz+EK+1IcUoG4 Gnnty3nrfN4SNA6az6KGfjYa8uRD5QwtvJy+6ChRt+3k5LuGfyQdm+jC99iNN+xCaxhy d5PoVxt+VfB7H1drOcpr/NxaAXPwmkIfpggKOTnXRHmTEXax8VJC95cWfs5sW+WV5/MJ n5hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736174442; x=1736779242; 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=JB1xq/JPbj1FgLvsUE4KWrB+7umS0hjUxGBAWzIxtM2UDvz8eXE0yhCnhaKSDu88D4 7w8FQFXPD7DJmiAfSH/yX4XLYby6QPxnw0dUFHXY/Biy13VTj7mn6KDF4wWk26536wuy npZK/40kYGqwATAeEIqCZ1hEl91LjDB0tl485qRJiSu95H4O7XVD6Ymu9d6HpRxCUFhC 8so43XGGxgSBiXByx1QHKjX4WfCvSUxnJVhwtQ1Ra3k7UlxZp5iPdiDzep/Gu+izYZYp lyH5fBQkecbnyYeQiAfRwKLSuDSo2y92GT3ygB01y7sVE4a1o4TcaMIp8uheAK6gPqnd 6Wdg== X-Gm-Message-State: AOJu0YwordAov89A6tofyD5OVXryPsW/OxuxhHuQF/FowQb3e1bFz7ip YepLMMz0o1MV87n8PUdGzWENIWdRGQ4T4LaS9yQuEVYTRaMbOVBOQHUb5/K0FiBNu2klqmkpXI/ xgmk= X-Gm-Gg: ASbGncvFcEaLxnFKkztPic4+KhuWG70yf2ZiaYodjH+kiBaKtlgFbxRG6ZhWeHxXtgV qJmAdNlWRUOFEsR0FESyru51VeLr7u4BaA6LLou+LspSlBWod8xgJr3EYVRWBhq7MHENKb+GT4Y Il2bCcyVY7PazF7Q8McTenlbDJ2RbM1ZE9RxGWkPPWDTHP3g8ED8zQYavtzQOOBJAfWkQW5n9tD 5fPp3zCHdxN4wFdUbFBEdmy0e6mMKVn33plQg3lQCnukMKZBaVpotyuSkLLb2B4mw== X-Received: by 2002:a05:6000:1564:b0:38a:624b:e7fe with SMTP id ffacd0b85a97d-38a624bee1bmr15444735f8f.7.1736174442439; Mon, 06 Jan 2025 06:40:42 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436724169afsm519332585e9.25.2025.01.06.06.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2025 06:40:42 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Tom Rini , Simon Glass , Michal Simek , Jerome Forissier , Raymond Mao , Heinrich Schuchardt , Caleb Connolly , Dan Carpenter Subject: [PATCH v4 2/2] initcall: remove initcall_run_list() Date: Mon, 6 Jan 2025 15:40:14 +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; -}