Message ID | 20221207085137.445249-64-sjg@chromium.org |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show
Return-Path: <u-boot-bounces@lists.denx.de> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=kOpVMjbC; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NRs0S1F2kz23ns for <incoming@patchwork.ozlabs.org>; Wed, 7 Dec 2022 20:08:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 368B985754; Wed, 7 Dec 2022 09:57:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="kOpVMjbC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DBDC9855C7; Wed, 7 Dec 2022 09:57:41 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) (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 CA4EC85651 for <u-boot@lists.denx.de>; Wed, 7 Dec 2022 09:57:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x102a.google.com with SMTP id q15so15913905pja.0 for <u-boot@lists.denx.de>; Wed, 07 Dec 2022 00:57:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; 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=ZmgCqpTPmOGg/XRPR8TUMrpLFF+x3KUHsbyXTHVGSNc=; b=kOpVMjbCJnTXmP6INrTEsCerFaP8oWu4REcLH1QD2TyrGAzqySBzq0ig7qbxbyzSOH KyBgFfyGKLw1HOYfC9Q7u772xkDdsgpw+j0dtgE6h39rK2t0BeCxD3HrvQ4JQBL7523d RUNVt52SjvUzsOqm9X5eGAAgf02CI30WmkQfg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ZmgCqpTPmOGg/XRPR8TUMrpLFF+x3KUHsbyXTHVGSNc=; b=v9kh0mBSGWRR83lw0BBpt21SG12FN01YFwWrzQZJ8zdtArvbdWdbWIsD/DGTCeCunv BrbF9V3aHV5bWX3+Fs9TLuAIAsNYFurphh51eSl1TEZDaERB1BR41NTFXv1kx9wXzYFl 89B97t90cyPASkC6vNNU8BGqHvESON+bOJNZYm9jH2Fi6oTDMEZ7yn2pbeWH/3iw2TFq PkJhoLgZSV4jFyfOv/ytrPsMHfX5o1SdGRY3AfxeIHdZrRWQ5M+VamCx8gYxsENlt10S hvbc6SYoIJ8bfprukHN7SqA+dqg5zJPSI+EGj2goGaEj3soTIRo3WuKwmzxpzlmKbDI0 55Ug== X-Gm-Message-State: ANoB5plH94T/7cRi3gy+ZQ2g4cx85n20EbJ3Rk+ZDK//HCJEKDfuBQrn uk7fpchhcQiRAhmMk8qdDvKcw83naWki3Wy5 X-Google-Smtp-Source: AA0mqf7glWsrdE5uB8VFw6pqrUNPvKNOaYyQNJwnZp7z6Ku1qMwRnhUrdvDagDN+mqTVxqehJxuYOA== X-Received: by 2002:a17:902:8c97:b0:189:13df:9dac with SMTP id t23-20020a1709028c9700b0018913df9dacmr71642897plo.34.1670403450043; Wed, 07 Dec 2022 00:57:30 -0800 (PST) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id l16-20020a170903121000b0018157b415dbsm14145514plh.63.2022.12.07.00.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 00:57:29 -0800 (PST) From: Simon Glass <sjg@chromium.org> To: U-Boot Mailing List <u-boot@lists.denx.de> Cc: U-Boot Custodians <u-boot-custodians@lists.denx.de>, Simon Glass <sjg@chromium.org>, Heinrich Schuchardt <xypron.glpk@gmx.de>, Kory Maincent <kory.maincent@bootlin.com> Subject: [PATCH 63/71] extension: Refactor to allow non-command usage Date: Wed, 7 Dec 2022 21:51:29 +1300 Message-Id: <20221207085137.445249-64-sjg@chromium.org> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog In-Reply-To: <20221207085137.445249-1-sjg@chromium.org> References: <20221207085137.445249-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean |
Series |
bootstd: Allow migration from distro_bootcmd scripts
|
expand
|
diff --git a/cmd/extension_board.c b/cmd/extension_board.c index f94abd612d5..f7685d47b8b 100644 --- a/cmd/extension_board.c +++ b/cmd/extension_board.c @@ -80,8 +80,7 @@ static int do_extension_list(struct cmd_tbl *cmdtp, int flag, return CMD_RET_SUCCESS; } -static int do_extension_scan(struct cmd_tbl *cmdtp, int flag, - int argc, char *const argv[]) +static int extension_scan(bool show) { struct extension *extension, *next; int extension_num; @@ -91,12 +90,23 @@ static int do_extension_scan(struct cmd_tbl *cmdtp, int flag, free(extension); } extension_num = extension_board_scan(&extension_list); + if (show && extension_num >= 0) + printf("Found %d extension board(s).\n", extension_num); + + /* either the number of extensions, or -ve for error */ + return extension_num; +} + +static int do_extension_scan(struct cmd_tbl *cmdtp, int flag, + int argc, char *const argv[]) +{ + int extension_num; + + extension_num = extension_scan(true); if (extension_num < 0) return CMD_RET_FAILURE; - printf("Found %d extension board(s).\n", extension_num); - return CMD_RET_SUCCESS; }
The current extension code is designed to be used from commands. We want to add a boot driver which uses it. To help with this, split the code into the command processing and a function which actually does the scan. Really the extension code should be in common/ or use driver model, but this is a start. Signed-off-by: Simon Glass <sjg@chromium.org> --- cmd/extension_board.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)