From patchwork Tue Dec 17 15:59:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 851425 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp432652wrq; Tue, 17 Dec 2024 08:00:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVU6TcZEZd82W5WRO+S15dGeQYXXs/lZV9BoihO3rQCkf2uQ3MuhX4UR6hn/5y2qPvpTCj+mQ==@linaro.org X-Google-Smtp-Source: AGHT+IGVJ07FV3Ff9Cu9OCYZEDFWT/OwQ9iT/pA8oJhy5/2f2Ts6uLYWd5rpjaIhqY+voFtXHHsc X-Received: by 2002:a05:6402:26cf:b0:5d0:e826:f0ec with SMTP id 4fb4d7f45d1cf-5d63c2e5349mr16804161a12.4.1734451250094; Tue, 17 Dec 2024 08:00:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734451250; cv=none; d=google.com; s=arc-20240605; b=TRuxhzDy2kLE2It5sv/jm71A7F2hqOPRr22E3xDDjGCsD/OEOxReyI3dPv+x6mSPa9 3bPvM2QHTZkaKRWHHHFx345V05nWIqRH+XTKTGFM3BRS5qklbOkwNH0hOAmFd7ObuheV oPZYcLUwcGEVJMd+x2eIGcgg9P2G8hXcC5Xu5JMdPfEN34kMDQdAbLlUsWEh92aDx4Wt gZy2tRvVn09EM3RAmeWQU4ph7tFYHXuYQeACQUePEKmbMEWCz+evXHWoHI3IHm4ikRXH 8Ce9Q2N/+lHcSGbgh8P/CAQAyM36/T7os/O/RU4Lz3WDdBqM5lSuKkflG2F0yVGQSo5V 35KA== 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=bc5dcGomkTmzvvZyWwHhfntlWLKNrTTzvh9e4xyRGnc=; fh=kV+nLpDDwxLXgL4ZrL9moTa+SBOj1+lGP4nM/ORLrzw=; b=CKsEtMAhsRH8mL0oiDxZn6Axts6WSheDoR/BxYxBBZ7ld1pcq64qOlLHyitSLNbUw6 9VmbC85Sg9OgQSq3z2tCFLOfy0rpni80ljY4RbCDTHtsDY6ctdykLpSijttNOoCe39Lm OKpQq01ZirAXzozvrmrgsJPJcA8p5IcTPZNTJHuADX4m11ZjKmQCkueaCOdsQWEmLpOg 41hI6Ew/d/3qWmz09HdOTEaB1dB4e866o0eGpDzU8F+UIZGyeV/DvIkMXySgIH1YY9DR 4O3eqBe5ZW61nt3hUOaPZF3mOd+BhAGByRW4MJi2k8QOJ1/UyI2OKeRvCe0DsT1bljcR hm6A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d84CpowW; 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 4fb4d7f45d1cf-5d653011ff5si5206889a12.612.2024.12.17.08.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 08:00:50 -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=d84CpowW; 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 DCA20801CE; Tue, 17 Dec 2024 17:00:14 +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="d84CpowW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0E2C180274; Tue, 17 Dec 2024 17:00:12 +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-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (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 83AC08022E for ; Tue, 17 Dec 2024 17:00:09 +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-x329.google.com with SMTP id 5b1f17b1804b1-4361f65ca01so53714645e9.1 for ; Tue, 17 Dec 2024 08:00:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734451209; x=1735056009; 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=bc5dcGomkTmzvvZyWwHhfntlWLKNrTTzvh9e4xyRGnc=; b=d84CpowWsc3zc5QalMgPAGdXv4jOKrsGWkaEmaA7Cp2OQGagtq6r2/awldIATOUneJ qznUsCuhBfX96E91cFG8HDfuQIIn0zhdOvBDxOnTCWE23eAq6Z72e0Yh7PhBtIqUDfWP KEkd4igL+R6YT6/jGdfZhSOOwMNDqJQt2CLl0dz9+fGV3IYLCbzhhfan0sFTKIqy3LEw htL7sTL6BkDG/Lqj9uwCkb16NYN7M1l38OuyQfhGC0fgIQ5jUBLx4LT7s3NIOlCUE98N F4wtfxHjD7ESolYCZYsS4VE3gV5SNZ/qrB4K3bfiuXxvg17uGkgGqJu4STlRaeODDm2a FT6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734451209; x=1735056009; 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=bc5dcGomkTmzvvZyWwHhfntlWLKNrTTzvh9e4xyRGnc=; b=l3GQo0705N+ndDoTOS8MyFG8UgFJwoByMcZs9hyA8P1D8Bg7n4JV202HH+a5ian8zb +0RncKHnfN/LHfbhkCia61gFjClSNOBuDYhfzmwqKWUoDtmiwlLB3fYCBEYQXsHBxYPo 78ghXxaCZZGmKZym9W2q3Hxn1yTQmqW83JV/ytMXZI3kW3plrE+uKZ2h8ltDfQl9aLPL PFJ6rMWVbBXS7HMw/hc21nNvz8dqKsG4+QktiUPi6/WlQAfd7dt9t+F2uUPXyB/M6sfa liyh9E4+jSUpb52ozINtyO7deP2TxSMkI6k5i8fcdtk1mP7HPy4R7HpLpaF3RkNhHy8e 12LQ== X-Gm-Message-State: AOJu0YwIRxFr4G+Nh2ah8qn4Zaf+sej8IebOnoytAmXEGVxPSJTkJ0V/ VKCAv1IdhJLJlbTnrImr+RhFlOjMGgrZo+bY+KS9a7pgBhpXivzXhNTFi2i/Aw4BcABkoY4ExUz bQF8= X-Gm-Gg: ASbGncuXakDY8RaeNAefVwGyJzmE5tPt5wtECV1hAu/n/5tTv0bB03Xrikf5+vjGSVX 4uJmzHryhbN0p6jYFHjimKHHVlJv6JCMvS9UJbHEADD+8MmBhZxdc/vGobI7x+Y4kJNOfPZPmjs pgN7BXvp0QBk0wDaT4/bUAZCfHpmD9R/4SxJwMKYLeQyvb37H/L+SYh9h3dn1TYFa4Huey9nhpf bkgg5GaT6dmW12DIW07k5q3w9IueukQkj7hMlG77Aeeg6/BQAoKGDA+r0xxHPI6Og== X-Received: by 2002:a05:600c:1e19:b0:435:1a2:2633 with SMTP id 5b1f17b1804b1-4362aa52c65mr164849365e9.15.1734451208693; Tue, 17 Dec 2024 08:00:08 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c801ad9asm11390181f8f.58.2024.12.17.08.00.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 08:00:08 -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 , Caleb Connolly , Dan Carpenter Subject: [PATCH 5/5] initcall: remove initcall_run_list() Date: Tue, 17 Dec 2024 16:59:36 +0100 Message-ID: <164daec366a7ad0e7c7a16b3d713fc1905a53125.1734448827.git.jerome.forissier@linaro.org> 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 72faab42ada..c47a0410197 100644 --- a/include/initcall.h +++ b/include/initcall.h @@ -11,30 +11,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 (!ret) { \ diff --git a/lib/Makefile b/lib/Makefile index d24ed629732..78d9d02369b 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; -}