Message ID | 20221207085137.445249-7-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=iNeKiV/O; 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 4NRrhg0hWmz23yq for <incoming@patchwork.ozlabs.org>; Wed, 7 Dec 2022 19:55:15 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EEDEF85442; Wed, 7 Dec 2022 09:54:12 +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="iNeKiV/O"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 967E485442; Wed, 7 Dec 2022 09:54:11 +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-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) (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 963F58556A for <u-boot@lists.denx.de>; Wed, 7 Dec 2022 09:54:07 +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-pg1-x52e.google.com with SMTP id v3so15690166pgh.4 for <u-boot@lists.denx.de>; Wed, 07 Dec 2022 00:54:07 -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=o5VFG3nkPILUiX0sGrQFCPBzVuOQ44EsqKz12Eyzhj4=; b=iNeKiV/OyAUdYZqZZjiNrLk5sOpReXtqHVtvcm/Qlfg31D/hLTsHgixHWKhJslOPNM VZUOT9FOlx/1SDz5NxEcQtx5/LZxUe3HYrpBqnWB8/E4Dm0w/gcVS3jbuiq57FR7TnvS fyTSIkjDSp1eS1HJIINhFqGYxo4qOzDjwzVuI= 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=o5VFG3nkPILUiX0sGrQFCPBzVuOQ44EsqKz12Eyzhj4=; b=TwBWLU7tGAhKFTr6FV0jwF5YFkz2iurLLJlz51kX8qkM3Gtlt+EVTaGpX0GOtcZvfp if4XlZv2rVjBXAfDgTXw7iCR5iVsJ4yBY5xnwAraPqTWQ7P9ennVnlzzdp7AQAzunzbr yfGcK5mDKUs2kGv9tmhPNw+fdQTuspK9v4I/Z5gRTaFcMSTx1D3Ycvp74xYdIzJIu4fe C0yBTT9lPqx0WQIOraD1Zx7mAct4uy1Q1mgXeY/1Uvg538ZPlSE7KfnGQABjAaSF/kLd 2J/xk0V/IfIezf52xMfZon0ZbLbaqwWDxVakAMKqeUun0MHBiaLxEhXLMqNdrf6/+juw 6p8g== X-Gm-Message-State: ANoB5pnqJmnI8l5YzV90JwIqGouI5M+3CKkdrhJDftL7qgwMi7BBy0hy mUdWk2zA9PbsYgR0tK3ESp6f5H0m6dbBiIa6 X-Google-Smtp-Source: AA0mqf7GyEAa230DqO/7Fx/F9efqjhPaprh6ERNfuT0acsT+bTeeU8p+hEyAxYUeTBY+flnkvovy1g== X-Received: by 2002:aa7:9911:0:b0:576:796e:8128 with SMTP id z17-20020aa79911000000b00576796e8128mr22115583pff.68.1670403245683; Wed, 07 Dec 2022 00:54:05 -0800 (PST) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id l16-20020a170903121000b0018157b415dbsm14145514plh.63.2022.12.07.00.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 00:54:05 -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> Subject: [PATCH 06/71] bootstd: Simplify locating existing bootdevs Date: Wed, 7 Dec 2022 21:50:32 +1300 Message-Id: <20221207085137.445249-7-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/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index 696efb4b19e..cffa01824c0 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -544,8 +544,8 @@ static int build_order(struct udevice *bootstd, struct udevice **order, int bootdev_setup_iter_order(struct bootflow_iter *iter, struct udevice **devp) { struct udevice *bootstd, *dev = *devp, **order; - int upto, i; - int count; + struct uclass *uc; + int count, upto; int ret; ret = uclass_first_device_err(UCLASS_BOOTSTD, &bootstd); @@ -568,15 +568,9 @@ int bootdev_setup_iter_order(struct bootflow_iter *iter, struct udevice **devp) if (!order) return log_msg_ret("order", -ENOMEM); - /* - * Get a list of bootdevs, in seq order (i.e. using aliases). There may - * be gaps so try to count up high enough to find them all. - */ - for (i = 0, upto = 0; upto < count && i < 20 + count * 2; i++) { - ret = uclass_find_device_by_seq(UCLASS_BOOTDEV, i, &dev); - if (!ret) - order[upto++] = dev; - } + /* Get the list of bootdevs */ + uclass_id_foreach_dev(UCLASS_BOOTDEV, dev, uc) + order[upto++] = dev; log_debug("Found %d bootdevs\n", count); if (upto != count) log_debug("Expected %d bootdevs, found %d using aliases\n",
There is no point in trying to match the alias order for bootdevs, since build_order() either sorts them by priority, uses the boot_targets environment variable or the bootdev-order property. Just use the iterator instead, to simplify the code. Signed-off-by: Simon Glass <sjg@chromium.org> --- boot/bootdev-uclass.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)