1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-29 22:41:17 +02:00

dm: core: Allow finding a uclass device by partial name

In some cases two devices are related and the only way to tell is to
check that the names partially patch. Add a way to check this without
needing to create a new string for the comparison.

Fix the comment for device_find_child_by_namelen() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2022-04-24 23:31:00 -06:00
committed by Tom Rini
parent 6aa4fe3912
commit 4e0710a2d0
4 changed files with 42 additions and 4 deletions

View File

@@ -154,6 +154,22 @@ int uclass_find_first_device(enum uclass_id id, struct udevice **devp);
*/
int uclass_find_next_device(struct udevice **devp);
/**
* uclass_find_device_by_namelen() - Find uclass device based on ID and name
*
* This searches for a device with the exactly given name.
*
* The device is NOT probed, it is merely returned.
*
* @id: ID to look up
* @name: name of a device to find
* @len: Length of @name (the uclass driver name must have the same length)
* @devp: Returns pointer to device (the first one with the name)
* Return: 0 if OK, -ve on error
*/
int uclass_find_device_by_namelen(enum uclass_id id, const char *name, int len,
struct udevice **devp);
/**
* uclass_find_device_by_name() - Find uclass device based on ID and name
*