[PATCH] dm: core: introduce uclass_get_device_by_of_path()

Simon Glass sjg at chromium.org
Fri Apr 28 21:21:44 CEST 2023


Hi Rasmus,

On Fri, 28 Apr 2023 at 13:20, Simon Glass <sjg at chromium.org> wrote:
>
> Hi Rasmus,
>
> On Thu, 13 Apr 2023 at 09:17, Rasmus Villemoes
> <rasmus.villemoes at prevas.dk> wrote:
> >
> > There's quite a few instances of board-specific code doing
> >
> >   off = fdt_path_offset(gd->fdt_blob, ...);
> >   ...
> >   ret = uclass_get_device_by_of_offset(..., off, &dev);
> >
> > looking for an eeprom or a pmic via some alias. Such code can be
> > simplified a little if we have a helper for directly getting a device
> > via device tree path (including being given as an alias).
> >
> > Implement it in terms of ofnode rather than raw offsets so that this
> > will work whether live tree is enabled or not.
> >
> > Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> > ---
> >  drivers/core/uclass.c |  6 ++++++
> >  include/dm/uclass.h   | 17 +++++++++++++++++
> >  2 files changed, 23 insertions(+)
>
> Looks fine but please add a test to ofnode.c

Did you send a patch with a test? If so I missed it.

Also please check my tweak to this (OF_REAL)

Regards,
Simon


More information about the U-Boot mailing list