[PATCH] dm: core: introduce uclass_get_device_by_of_path()

Simon Glass sjg at chromium.org
Wed Apr 19 03:46:34 CEST 2023


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

Regards,
Simon


More information about the U-Boot mailing list