[U-Boot] [PATCH v3 06/15] cmd: cpu: ensure udevice is probed before calling cpu ops

Simon Glass
2017-04-19T00:13:03Z

On 18 April 2017 at 14:38, Álvaro Fernández Rojas <noltari@gmail.com> wrote:
> This causes exceptions for drivers that aren't probed when cpu ops are
> requested.
>
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> ---
> v3: add new patch to ensure that device is probed.
>
> cmd/cpu.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/cmd/cpu.c b/cmd/cpu.c
> index adfd54a..91f60c2 100644
> --- a/cmd/cpu.c
> +++ b/cmd/cpu.c
> @@ -9,6 +9,7 @@
> #include <command.h>
> #include <cpu.h>
> #include <dm.h>
> +#include <dm/device-internal.h>
> #include <errno.h>
>
> static const char *cpu_feature_name[CPU_FEAT_COUNT] = {
> @@ -36,6 +37,9 @@ static int print_cpu_list(bool detail)
> bool first;
> int i;
>
> + if (!device_active(dev) && device_probe(dev))
> + continue;
> +

In that case can you please restructure this to use uclass_first/next_device()?

> ret = cpu_get_desc(dev, buf, sizeof(buf));
> printf("%3d: %-10s %s\n", dev->seq, dev->name,
> ret ? "<no description>" : buf);
> --
> 2.1.4
>

Regards,
Simon