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>
This commit is contained in:
committed by
Simon Glass
parent
6ebb357a6a
commit
ca031c0827
@@ -545,6 +545,12 @@ int uclass_get_device_by_ofnode(enum uclass_id id, ofnode node,
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
int uclass_get_device_by_of_path(enum uclass_id id, const char *path,
|
||||
struct udevice **devp)
|
||||
{
|
||||
return uclass_get_device_by_ofnode(id, ofnode_path(path), devp);
|
||||
}
|
||||
|
||||
int uclass_get_device_by_phandle_id(enum uclass_id id, uint phandle_id,
|
||||
struct udevice **devp)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user