dm: core: introduce uclass_get_device_by_of_path()
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Thu, 13 Apr 2023 15:17:03 +0000 (17:17 +0200)
committerSimon Glass <sjg@chromium.org>
Fri, 28 Apr 2023 17:48:59 +0000 (11:48 -0600)
commitca031c082700631264d1e058f2f705438c2be8c2
treedae7ca73c20d0d4cc885d9bbc128224435f3a054
parent6ebb357a6a16fe4b61fae3866f80b967e8231f7e
dm: core: introduce uclass_get_device_by_of_path()

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@prevas.dk>
drivers/core/uclass.c
include/dm/uclass.h