From d0b4f68d199c075f5d734cf184f7eaf1a642083d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 18 Nov 2018 08:14:30 -0700 Subject: dm: core: Export uclass_find_device_by_phandle() This function may be useful to code outside of the code driver-model implementation. Export it and add a test. Signed-off-by: Simon Glass --- include/dm/uclass-internal.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include') diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h index 30d5a4fb9bf..8a4839ee882 100644 --- a/include/dm/uclass-internal.h +++ b/include/dm/uclass-internal.h @@ -142,6 +142,23 @@ int uclass_find_device_by_of_offset(enum uclass_id id, int node, int uclass_find_device_by_ofnode(enum uclass_id id, ofnode node, struct udevice **devp); +/** + * uclass_find_device_by_phandle() - Find a uclass device by phandle + * + * This searches the devices in the uclass for one with the given phandle. + * + * The device is NOT probed, it is merely returned. + * + * @id: ID to look up + * @parent: Parent device containing the phandle pointer + * @name: Name of property in the parent device node + * @devp: Returns pointer to device (there is only one for each node) + * @return 0 if OK, -ENOENT if there is no @name present in the node, other + * -ve on error + */ +int uclass_find_device_by_phandle(enum uclass_id id, struct udevice *parent, + const char *name, struct udevice **devp); + /** * uclass_bind_device() - Associate device with a uclass * -- cgit v1.3.1