From patchwork Thu Oct 3 21:27:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1992508 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=hcWw5odW; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XKPtY2NWlz1xt7 for ; Fri, 4 Oct 2024 07:28:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0BF7188D47; Thu, 3 Oct 2024 23:28:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject 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="hcWw5odW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0E81888D8F; Thu, 3 Oct 2024 23:28:17 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20627.outbound.protection.outlook.com [IPv6:2a01:111:f403:2613::627]) (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 9CF9088B2D for ; Thu, 3 Oct 2024 23:28:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject 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=arcselector10001; d=microsoft.com; cv=none; b=l4D0DN051ImCUPe05UDHqHicEV3NygY5k9HUNVgbvT8wVbe8JtpnwyfCFaNVM/yiUvY82CHO9BRaX3oEFiyT9lb/XW8StCJbLwZ3zF1xg2+MmJxocF0vxDGe3+KW9ivPajd1py+pW/ATmMuKXBiI3uC/P66zslYmz4xKLkPizK+HPcJyAXl1KkFj5YJsdW2KoReVbnHEZBi7C4uEfz6ba1+Q53wsNzVAs+ARlqFftmLaCFI8+JS4xZSUwHA48qwFuArlxWJVLUCzxHRQ+6gf/HA25otnv9Atzc0oBBGOBMF0LlrXytZqocbYJwDqSW4FQWc58M/5ZgLmfZlLuKlLJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GVZVOhuOTlDpm3QwjiSCpmTK23isKmqk3ualVy5lEdM=; b=iwin/jvh1vw2VGV4Y9nhoQNeUqAoxS5uIOPAFe19HHzVuPhWGAhBfgGA+Aa1qbz6QAuCxtztlTf6v938vZa56xpQUvOjNlIG5lwDzhd1ZZboy+vRkEQkiEk4DCqpYs8thmWPPCadVvq2M31G0erlDd+gDGqFFZRvLZa3ZXr6tqnJR77mBaXjiBiBBSDDVc8xprI/9asiH+iYTiLkE/rA34xJ1fZY15x9F+8sq+ACJPMHEnXxTHVsKr7keekAELsaDAYggHSeXkItlW505K9DCEx43pDdARMWfcCZUrGZRWJRZTifzRjeMLSNU/esR0c2ciudiLb5DwjzqgZtyCS+JA== 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=GVZVOhuOTlDpm3QwjiSCpmTK23isKmqk3ualVy5lEdM=; b=hcWw5odW5i6v2AQKJmNhVyvkg4ctG6fjbXIL4R5vDqaRrnwYbMGBnAlh/vP2SKrY1Wd+Bm48U1pZZUlpmIC/rJwg09lNCevSWQsIE156+eb90t0lAC9XBbQ8QOC0/xazpdoNOPzuUn3nsQdZm7VSjO2kQnTOw7g21PslMGjJUGc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=prevas.dk; Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) by DB9PR10MB8118.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:4c5::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.9; Thu, 3 Oct 2024 21:28:13 +0000 Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::9fcc:5df3:197:6691]) by DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::9fcc:5df3:197:6691%3]) with mapi id 15.20.8048.007; Thu, 3 Oct 2024 21:28:13 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Stefan Roese , Tom Rini , Rasmus Villemoes Subject: [PATCH 02/13] cyclic: introduce u-boot/schedule.h Date: Thu, 3 Oct 2024 23:27:51 +0200 Message-ID: <20241003212802.3810-3-ravi@prevas.dk> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003212802.3810-1-ravi@prevas.dk> References: <20241003212802.3810-1-ravi@prevas.dk> X-ClientProxiedBy: MM0P280CA0007.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:a::22) To DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR10MB7100:EE_|DB9PR10MB8118:EE_ X-MS-Office365-Filtering-Correlation-Id: bd60eedb-7e03-41e1-efc6-08dce3f24948 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: +G+lJVZrx1kd5/VhgW9VOUamkpjOe6bc4B9J5iBDIhvdsnW6ZXcyOG3t1kls2lLe6YdLdKXztagZ9UH72C9nPR8CNmu+Fh71nqdDj1RmvAIOUebuAGx5fV24sJPlQo3jlDwH34DQjtny6si24cqSt8Wbi86vUn+hphzNxTT5+neAPRzlwefYX/x0Nf5+9t5iYmELhqqAZyrXOpQ30NdvQJmP9UQCVCSxhmuStRGcSDMFpXrw1fpsfHttV9xPDS5SSpS+0MLfuN/02ciRDIv4pDXh37elciNUcie3r+DOIAW07dmODzFWu4AxUBdzUe5BRuNum5qSJGgq3TCkZTaD14YT7igyfWTWpjfEAMJYlZoBlPouR/FtMP6FGvIwy50mDgVLfGKxPR8msHTlHGADJdImJmgvN8N4yehuiY7/Yd9z8NWU8m6Zh7WarhY+NG5Q2gJI+jTbXYQWYUjd7OkyF1jgPwrNYpR3PXaK36DfQuZEMo2LSiAI0Ic3fdftnO5/vwphrh3XRfI4HUOifB1dEPva/lb1xctvHt5Uz8xL7F2fpg2bjzrLB+VRPulKpdbLJaHtfLqHLPuQEpfJWniPZu7yd4W9K83Go4Q8yzX8Jsrmqtk1gSXCKQtXC9lCGp+ilnSyVvh4azf/rm8aQrn15vLXwfIoxK70Qp9UEJaFNI+Shp6VoQZQy1XN0cDZWa223xB7NVoHtSIHc/+RtPSp2bv6OvUnBv28abKGMENa/tf5efs6NsRIp5J3P0UTXVX9Ps3phRpWRuL4ypHq4vcPRnzlUnpazE+bYh+9bHw1dYOln2742pMawkZnGt5EvmNk2x+8OC5KeEFkZkQJqqg+YE0Uq6VhcxdfyBxIdj4W0lbJee3IjOj325Lm+HqyADqzuyp0H78TILJViYAzdjaZeK0JQ9E7GZNB5HxP8DwIxr+kIKyIkpveG8KVQkYIgpt1hVW7yaX5H6Ik39HXkIpqsfkpGWW2pU70NPuZDv80R32G+hArn5bwlGOnGMYH4+lupsc0Wj/CxMKamkCbThp5AYMcgRZalE0zjLF705QZ34lBspjHNN/Pp/mVVirCNW9z0pzY82G0g/27v0obX4x/tCJVV8xuv6G0TGlwJUym1Uaq1fEGXk5qqZV6d2Y4W/IxR6wNnwJ5bB2aM5vot6WwJhSpGY5LebMMwquZ8uE9fA3k/WLYtqW+08lNMAYFFRvJhFsVo4KR/+12nTWp2q5bkhAfNM7axlY9ZnqEya+CorUsyUDuNtMcoGYC6ATLKCLZ6ziwRt40PHQVugRh/jHkvE0Irod6Uwmkf+ViKl4XSL2ugmEgqD0ggD55bRRCaWgbrCFRpZU9SYDDQfMENjIcXg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-Anti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k8DGR9ZBmZWKUcwgJCWorLCPK45xYZBAHbIY4SSSO6OrzgNLSCHDiAARJr0Jf4mJ84CCd130PaCi4BY81P0TaNbpagqC9PCQox2IrnfVMad/qnPIh0XfpTum8d7f/JxD9T5b16dnOSfJNssqWGVgVWbTIy5iZ1EzPl5pNMb5VpCB5XSWO9ADp1SRHWYIsoxqkMLSqEQ9iueR7H08iCoYwtH9geqADrWvjeRuh1ibKDh/Co8XW3RnIU2j9EdDGXa1vw+3nhYJAjWR72hqvuoehk5UuEG6kUFw/Z0zaPoN/whQqfMp9Sl4IP1yze7gOdeJ8Vpz6klNXNxb5OciJqHNsN6gSCFIc8mhoRfpp0rhT6EQve1JPvDuKsoH9ZTax3uih0W1iREV5Qozi+y1iRGxkSZkbYuZayHFTC/MrDW+0U9VZ2e5AyWbvQe9c6XtojJKPUmr8FM4RMlCCGWkt9uuuNAUAAzX5Ra7fQYYCRXNhmyKxzbrdBX8UmUbBoJSyA66IZZ9PThoqNalQicgQtLuxHVTEU4rbLjUHHXTgWScREo7JZGHd5QZKvF7cjeKGAaBDaxM5FtNhO9tRJTGZKiZBAFlYEXDg7+w== X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: bd60eedb-7e03-41e1-efc6-08dce3f24948 X-MS-Exchange-CrossTenant-AuthSource: DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2024 21:28:13.1766 (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: qieM6AqLx3cwKQPXsJqQHQOHo/A9VuLiZgChNkN6DYz9OSGJu3isGNLvYQP+16hXUIdj2gzVWvfvSwMRrxd9xL+lBzpcGFsY3GjvOxwxz2M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR10MB8118 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 I noticed an "unnecessary" include of in global_data.h, in the sense that nothing in cyclic.h is needed in order to define 'struct global_data'. Well, it's not unnecessary, as it implicitly ensures that everybody gets a declaration of schedule(), and schedule() is (obviously) called all over the tree. Almost none of those places directly include , but for historical reasons, many do include (most schedule() instances are replacements of WATCHDOG_RESET()). However, very few TUs actually need the declarations of the cyclic_register() and struct cyclic_info, and they also don't really need anything from the watchdog.h header. So introduce a new header which just contains a declaration of schedule(), which can then be included from all the places that do call schedule(). I removed the direct reference to cyclic_run(), because we shouldn't have two public functions for doing roughly the same without being very explicit about when one should call one or the other. Testing of later patches that explicitly include when schedule() is used revealed a problem with host tool build on win32, which apparently picked up a host . To avoid that problem, put the new header in include/u-boot/ and hence make the include statements say . Signed-off-by: Rasmus Villemoes --- common/cyclic.c | 1 + include/cyclic.h | 12 +----------- include/u-boot/schedule.h | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 include/u-boot/schedule.h diff --git a/common/cyclic.c b/common/cyclic.c index ec38fad6775..38d815bec35 100644 --- a/common/cyclic.c +++ b/common/cyclic.c @@ -15,6 +15,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/include/cyclic.h b/include/cyclic.h index cd95b691d48..e8de616dcd5 100644 --- a/include/cyclic.h +++ b/include/cyclic.h @@ -13,6 +13,7 @@ #include #include +#include // to be removed later /** * struct cyclic_info - Information about cyclic execution function @@ -94,13 +95,6 @@ struct hlist_head *cyclic_get_list(void); */ void cyclic_run(void); -/** - * schedule() - Schedule all potentially waiting tasks - * - * Basically a wrapper for cyclic_run(), pontentially enhanced by some - * other parts, that need to get handled periodically. - */ -void schedule(void); #else static inline void cyclic_register(struct cyclic_info *cyclic, cyclic_func_t func, @@ -116,10 +110,6 @@ static inline void cyclic_run(void) { } -static inline void schedule(void) -{ -} - static inline int cyclic_unregister_all(void) { return 0; diff --git a/include/u-boot/schedule.h b/include/u-boot/schedule.h new file mode 100644 index 00000000000..4fd34c41229 --- /dev/null +++ b/include/u-boot/schedule.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef _U_BOOT_SCHEDULE_H +#define _U_BOOT_SCHEDULE_H + +#if CONFIG_IS_ENABLED(CYCLIC) +/** + * schedule() - Schedule all potentially waiting tasks + * + * Run all pending tasks registered via the cyclic framework, and + * potentially perform other actions that need to be done + * periodically. + */ +void schedule(void); + +#else + +static inline void schedule(void) +{ +} + +#endif + +#endif