1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-10-07 03:05:19 +02:00

dm: core: Add a function to see if a device exists

All the uclass functions for finding a device end up creating a uclass
if it doesn't exist. Add a function which instead returns NULL in this
case.

This is useful when in the 'unbind' path, since we don't want to undo
any unbinding which has already happened.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2024-10-19 09:21:49 -06:00
committed by Tom Rini
parent 2ca32cbb83
commit 79b3e9d25b
3 changed files with 44 additions and 0 deletions

View File

@@ -435,6 +435,17 @@ int uclass_next_device_check(struct udevice **devp);
int uclass_first_device_drvdata(enum uclass_id id, ulong driver_data,
struct udevice **devp);
/**
* uclass_try_first_device()- See if there is a device for a uclass
*
* If the uclass exists, this returns the first device on that uclass, without
* probing it. If the uclass does not exist, it gives up
*
* @id: Uclass ID to check
* Return: Pointer to device, if found, else NULL
*/
struct udevice *uclass_try_first_device(enum uclass_id id);
/**
* uclass_probe_all() - Probe all devices based on an uclass ID
*