All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 3/9] dm: uclass: Add uclass_foreach_dev_probe
Date: Thu, 11 Oct 2018 17:06:03 +0800	[thread overview]
Message-ID: <CAEUhbmUuWzTCze3aELbAga7T=y5cruH1VGm8p_3Vw6gg8vkwSg@mail.gmail.com> (raw)
In-Reply-To: <1539091888-14648-4-git-send-email-patrice.chotard@st.com>

Hi Patrice,

On Tue, Oct 9, 2018 at 9:41 PM Patrice Chotard <patrice.chotard@st.com> wrote:
>
> Add uclass_foreach_dev_probe() which iterates through
> devices of a given uclass. Devices are probed if necessary
> and are ready to use.
>
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  include/dm/uclass.h | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/include/dm/uclass.h b/include/dm/uclass.h
> index 6e7c1cd3e8bc..10ccfdce951e 100644
> --- a/include/dm/uclass.h
> +++ b/include/dm/uclass.h
> @@ -376,4 +376,20 @@ int uclass_resolve_seq(struct udevice *dev);
>  #define uclass_foreach_dev_safe(pos, next, uc) \
>         list_for_each_entry_safe(pos, next, &uc->dev_head, uclass_node)
>
> +/**
> + * uclass_foreach_dev_probe() - Helper function to iteration through devices
> + * of given uclass
> + *
> + * This creates a for() loop which works through the available devices in
> + * a uclass in order from start to end. Devices are probed if necessary,
> + * and ready for use.
> + *
> + * @id: Uclass ID
> + * @dev: struct udevice * to hold the current device. Set to NULL when there
> + * are no more devices.
> + */
> +#define uclass_foreach_dev_probe(id, dev)      \
> +       for (uclass_first_device(id, &dev); dev; \
> +            uclass_next_device(&dev))

Shouldn't we check the return value of uclass_first_device() and
uclass_next_device()?

> +
>  #endif

Regards,
Bin

  reply	other threads:[~2018-10-11  9:06 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-09 13:31 [U-Boot] [PATCH v3 0/9] Add pinmux command Patrice Chotard
2018-10-09 13:31 ` [U-Boot] [PATCH v3 1/9] dm: pinctrl: Add get_pin_muxing() ops Patrice Chotard
2018-10-19  3:28   ` Simon Glass
2018-10-23  6:41     ` Patrice CHOTARD
2018-10-24 14:14       ` Simon Glass
2018-10-09 13:31 ` [U-Boot] [PATCH v3 2/9] dm: pinctrl: Add pinctrl_get_pin_name and pinctrl_get_pins_count Patrice Chotard
2018-10-19  3:28   ` Simon Glass
2018-10-09 13:31 ` [U-Boot] [PATCH v3 3/9] dm: uclass: Add uclass_foreach_dev_probe Patrice Chotard
2018-10-11  9:06   ` Bin Meng [this message]
2018-10-12  7:51     ` Patrice CHOTARD
2018-10-12 10:13       ` Bin Meng
2018-10-15  9:01         ` Patrice CHOTARD
2018-10-19  3:27           ` Simon Glass
2018-10-23  7:16             ` Patrice CHOTARD
2018-10-09 13:31 ` [U-Boot] [PATCH v3 4/9] cmd: pinmux: Add pinmux command Patrice Chotard
2018-10-19  3:28   ` Simon Glass
2018-10-09 13:31 ` [U-Boot] [PATCH v3 5/9] pinctrl: stm32: Add get_pins_count() ops Patrice Chotard
2018-10-19  3:25   ` Simon Glass
2018-10-09 13:31 ` [U-Boot] [PATCH v3 6/9] pinctrl: stm32: Add get_pin_name() ops Patrice Chotard
2018-10-19  3:25   ` Simon Glass
2018-10-09 13:31 ` [U-Boot] [PATCH v3 7/9] pinctrl: stm32: Add get_pin_muxing() ops Patrice Chotard
2018-10-19  3:25   ` Simon Glass
2018-10-23  6:41     ` Patrice CHOTARD
2018-10-09 13:31 ` [U-Boot] [PATCH v3 8/9] gpio: stm32f7: Add ops get_function Patrice Chotard
2018-10-09 13:31 ` [U-Boot] [PATCH v3 9/9] pinctrl: sandbox: Add get_pin_muxing ops support Patrice Chotard
2018-10-19  3:25   ` Simon Glass
2018-10-23  6:40     ` Patrice CHOTARD

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='CAEUhbmUuWzTCze3aELbAga7T=y5cruH1VGm8p_3Vw6gg8vkwSg@mail.gmail.com' \
    --to=bmeng.cn@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.