From: "Álvaro Fernández Rojas" <noltari@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/1] core/uclass: iterate over all devices of a uclass
Date: Wed, 19 Apr 2017 18:22:38 +0200 [thread overview]
Message-ID: <93ea09ce-eb60-e6fa-4ce2-175493dad688@gmail.com> (raw)
In-Reply-To: <1492601184-9588-1-git-send-email-xypron.glpk@gmx.de>
In case you decide to apply this version (I see you're yet deciding which is the best way to go), I tested it and it solves my problem with sysreset not bein probed correctly.
So,
Tested-by: Álvaro Fernández Rojas <noltari@gmail.com>
El 19/04/2017 a las 13:26, Heinrich Schuchardt escribió:
> When iterating over the devices of an uclass the iteration stops
> at the first device that cannot be probed.
> When calling booefi this will result in no block device being
> passed to the EFI executable if the first device cannot be probed.
>
> The problem was reported by Andreas Färber in
> https://lists.denx.de/pipermail/u-boot/2017-April/287432.html
>
> For testing I used an odroid-c2 with a dts including
> &sd_emmc_a {
> status = "okay";
> }
> This device does not exist on the board and cannot be initialized.
>
> With the patch uclass_first_device and uclass_next_device
> iterate internally until they find the first device that can be
> probed or the end of the device list is reached.
>
> Debug output is provided for the two functions.
>
> Reported-by: Andreas Färber <afaerber@suse.de>
> Cc: Simon Glass <sjg@chromium.org>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> v2:
> As suggested by Simon Glass correct uclass_first_device() and
> uclass_next_device() instead of uclass_get_device_tail() to
> avoid side effects.
> v1:
> The original patch was posted as
> core/uclass: uclass_get_device_tail: always set devp
> https://lists.denx.de/pipermail/u-boot/2017-April/288068.html
> ---
> drivers/core/uclass.c | 44 +++++++++++++++++++++++++++++++++-----------
> 1 file changed, 33 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
> index 04fb45b..cff3a3f 100644
> --- a/drivers/core/uclass.c
> +++ b/drivers/core/uclass.c
> @@ -420,16 +420,30 @@ int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent,
> }
> #endif
>
> +/**
> + * uclass_first_device() - Finds first device of an uclass that can be probed
> + * @id: uclass id
> + * @devp: device found or NULL
> + * @return always 0
> + *
> + * For iterating over all devices of an uclass use
> + * for(uclass_first_device(id, &dev); dev; uclass_next_device(&dev)).
> + */
> int uclass_first_device(enum uclass_id id, struct udevice **devp)
> {
> struct udevice *dev;
> - int ret;
>
> *devp = NULL;
> - ret = uclass_find_first_device(id, &dev);
> - if (!dev)
> - return 0;
> - return uclass_get_device_tail(dev, ret, devp);
> + for (uclass_find_first_device(id, &dev); dev;
> + uclass_find_next_device(&dev)) {
> +
> + uclass_get_device_tail(dev, 0, devp);
> + if (*devp)
> + break;
> + }
> + debug("%s(%d): %s\n", __func__, id, dev ? dev->name : "(EOL)");
> +
> + return 0;
> }
>
> int uclass_first_device_err(enum uclass_id id, struct udevice **devp)
> @@ -445,16 +459,24 @@ int uclass_first_device_err(enum uclass_id id, struct udevice **devp)
> return 0;
> }
>
> +/**
> + * uclass_next_device() - Find next device of an uclass that can be probed
> + * @devp: device found or NULL
> + * @return always 0
> + */
> int uclass_next_device(struct udevice **devp)
> {
> struct udevice *dev = *devp;
> - int ret;
>
> - *devp = NULL;
> - ret = uclass_find_next_device(&dev);
> - if (!dev)
> - return 0;
> - return uclass_get_device_tail(dev, ret, devp);
> + for (*devp = NULL; !*devp; ) {
> + uclass_find_next_device(&dev);
> + if (!dev)
> + break;
> + uclass_get_device_tail(dev, 0, devp);
> + }
> + debug("%s: %s\n", __func__, dev ? dev->name : "(EOL)");
> +
> + return 0;
> }
>
> int uclass_bind_device(struct udevice *dev)
>
next prev parent reply other threads:[~2017-04-19 16:22 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170412182456epcas3p1e652ef3f772bf91ea3fbf7203fa00c71@epcas3p1.samsung.com>
2017-04-12 18:24 ` [U-Boot] [PATCH v7 0/3] mmc: meson: add MMC support for Meson GX (S905) Heiner Kallweit
2017-04-12 18:28 ` [U-Boot] [PATCH v7 1/3] arm: dts: update Meson GXBB / Odroid-C2 DT with recent Linux version Heiner Kallweit
2017-04-14 6:21 ` Jaehoon Chung
2017-04-12 18:30 ` [U-Boot] [PATCH v7 2/3] mmc: meson: add MMC driver for Meson GX (S905) Heiner Kallweit
2017-04-12 23:50 ` [U-Boot] [U-Boot, v7, " Vagrant Cascadian
2017-04-14 6:22 ` [U-Boot] [PATCH v7 " Jaehoon Chung
2017-04-15 15:05 ` Andreas Färber
2017-04-15 18:18 ` Heiner Kallweit
2017-04-15 18:27 ` Alexander Graf
2017-04-15 19:13 ` Heinrich Schuchardt
2017-04-15 20:21 ` Alexander Graf
2017-04-15 20:34 ` Andreas Färber
2017-04-15 20:52 ` Heinrich Schuchardt
2017-04-15 21:07 ` Andreas Färber
2017-04-15 21:04 ` Alexander Graf
2017-04-15 21:16 ` Andreas Färber
2017-04-15 21:51 ` Andreas Färber
2017-04-16 2:09 ` Heinrich Schuchardt
2017-04-16 10:08 ` Alexander Graf
2017-04-16 19:34 ` Simon Glass
2017-04-17 21:18 ` Heinrich Schuchardt
2017-04-17 22:39 ` Jaehoon Chung
2017-04-24 3:38 ` Simon Glass
2017-04-24 5:18 ` Jaehoon Chung
2017-04-29 0:25 ` Simon Glass
2017-04-18 18:44 ` [U-Boot] [PATCH 1/1] core/uclass: uclass_get_device_tail: always set devp Heinrich Schuchardt
2017-04-19 0:12 ` Simon Glass
2017-04-19 3:03 ` Andreas Färber
2017-04-19 3:37 ` Simon Glass
2017-04-19 4:48 ` Heinrich Schuchardt
2017-04-19 11:26 ` [U-Boot] [PATCH v2 1/1] core/uclass: iterate over all devices of a uclass Heinrich Schuchardt
2017-04-19 14:28 ` Simon Glass
2017-04-19 14:43 ` Andreas Färber
2017-04-19 15:14 ` Simon Glass
2017-04-19 15:52 ` Simon Glass
2017-04-19 16:37 ` Andreas Färber
2017-04-19 16:56 ` Simon Glass
2017-04-19 17:00 ` Andreas Färber
2017-04-19 17:10 ` Simon Glass
2017-04-19 18:08 ` Heinrich Schuchardt
2017-04-19 21:29 ` Simon Glass
2017-04-19 15:55 ` Heinrich Schuchardt
2017-04-19 16:02 ` Simon Glass
2017-04-19 16:22 ` Álvaro Fernández Rojas [this message]
2017-04-19 16:25 ` Andreas Färber
2017-04-19 16:31 ` Álvaro Fernández Rojas
2017-04-19 16:45 ` Andreas Färber
2017-04-19 21:06 ` Andreas Färber
2017-04-19 21:34 ` Simon Glass
2017-04-22 23:58 ` Simon Glass
2017-04-23 10:48 ` Andreas Färber
2017-04-24 2:11 ` Simon Glass
2017-04-23 10:55 ` Andreas Färber
2017-04-24 2:12 ` Simon Glass
2017-04-23 2:10 ` Simon Glass
2017-04-23 3:44 ` Heinrich Schuchardt
2017-04-12 18:32 ` [U-Boot] [PATCH v7 3/3] odroid-c2: enable new Meson GX MMC driver in board defconfig Heiner Kallweit
2017-04-14 6:22 ` Jaehoon Chung
2017-04-14 3:12 ` [U-Boot] [PATCH v7 0/3] mmc: meson: add MMC support for Meson GX (S905) Jaehoon Chung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=93ea09ce-eb60-e6fa-4ce2-175493dad688@gmail.com \
--to=noltari@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.