summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2024-10-19 09:21:49 -0600
committerSimon Glass <[email protected]>2024-11-02 11:13:59 -0600
commitcedf9ccaa27828876bc29b1dfc721cea2e5e6dfc (patch)
treefcd57ae86314f216f73748dbf935d4ebf47cddb2 /include
parentb84c13f37d19a3605bb6e34d26c2396cc0fffd86 (diff)
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 <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/dm/uclass.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 456eef7f2f3..c2793040923 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -436,6 +436,17 @@ 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
*
* This function probes all devices associated with a uclass by