]> git.sur5r.net Git - u-boot/blobdiff - include/dm/uclass.h
dm: core: Add uclass_first_device_err() to return a valid device
[u-boot] / include / dm / uclass.h
index bfbd27afd6baa398d19267767480d8e3b94da434..fd368b6bd0ead819db389afb776d287d22cd081c 100644 (file)
@@ -200,10 +200,21 @@ int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent,
  *
  * @id: Uclass ID to look up
  * @devp: Returns pointer to the first device in that uclass, or NULL if none
- * @return 0 if OK (found or not found), -1 on error
+ * @return 0 if OK (found or not found), other -ve on error
  */
 int uclass_first_device(enum uclass_id id, struct udevice **devp);
 
+/**
+ * uclass_first_device_err() - Get the first device in a uclass
+ *
+ * The device returned is probed if necessary, and ready for use
+ *
+ * @id: Uclass ID to look up
+ * @devp: Returns pointer to the first device in that uclass, or NULL if none
+ * @return 0 if found, -ENODEV if not found, other -ve on error
+ */
+int uclass_first_device_err(enum uclass_id id, struct udevice **devp);
+
 /**
  * uclass_next_device() - Get the next device in a uclass
  *
@@ -211,7 +222,7 @@ int uclass_first_device(enum uclass_id id, struct udevice **devp);
  *
  * @devp: On entry, pointer to device to lookup. On exit, returns pointer
  * to the next device in the same uclass, or NULL if none
- * @return 0 if OK (found or not found), -1 on error
+ * @return 0 if OK (found or not found), other -ve on error
  */
 int uclass_next_device(struct udevice **devp);