]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/dm/uclass-internal.h
usb: dwc2: Call board_usb_init() from usb_lowlevel_init()
[karo-tx-uboot.git] / include / dm / uclass-internal.h
index d0f1e22e58c0e4ef76f1b476c9c693dd24ca7a99..9b68508667123e0261691a1d4dbbf4ec7c91dffd 100644 (file)
 #ifndef _DM_UCLASS_INTERNAL_H
 #define _DM_UCLASS_INTERNAL_H
 
+/**
+ * uclass_get_device_tail() - handle the end of a get_device call
+ *
+ * This handles returning an error or probing a device as needed.
+ *
+ * @dev: Device that needs to be probed
+ * @ret: Error to return. If non-zero then the device is not probed
+ * @devp: Returns the value of 'dev' if there is no error
+ * @return ret, if non-zero, else the result of the device_probe() call
+ */
+int uclass_get_device_tail(struct udevice *dev, int ret, struct udevice **devp);
+
 /**
  * uclass_find_device() - Return n-th child of uclass
  * @id:                Id number of the uclass
  * @index:     Position of the child in uclass's list
  * #devp:      Returns pointer to device, or NULL on error
  *
- * The device is not prepared for use - this is an internal function
+ * The device is not prepared for use - this is an internal function.
+ * The function uclass_get_device_tail() can be used to probe the device.
  *
  * @return the uclass pointer of a child at the given index or
  * return NULL on error.
@@ -28,7 +41,8 @@ int uclass_find_device(enum uclass_id id, int index, struct udevice **devp);
  * @id:                Id number of the uclass
  * #devp:      Returns pointer to device, or NULL on error
  *
- * The device is not prepared for use - this is an internal function
+ * The device is not prepared for use - this is an internal function.
+ * The function uclass_get_device_tail() can be used to probe the device.
  *
  * @return 0 if OK (found or not found), -1 on error
  */
@@ -39,7 +53,8 @@ int uclass_find_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
  *
- * The device is not prepared for use - this is an internal function
+ * The device is not prepared for use - this is an internal function.
+ * The function uclass_get_device_tail() can be used to probe the device.
  *
  * @return 0 if OK (found or not found), -1 on error
  */
@@ -48,7 +63,7 @@ int uclass_find_next_device(struct udevice **devp);
 /**
  * uclass_find_device_by_name() - Find uclass device based on ID and name
  *
- * This searches for a device with the given name.
+ * This searches for a device with the exactly given name.
  *
  * The device is NOT probed, it is merely returned.
  *
@@ -101,7 +116,11 @@ int uclass_bind_device(struct udevice *dev);
  * @dev:       Pointer to the device
  * #return 0 on success, -ve on error
  */
+#ifdef CONFIG_DM_DEVICE_REMOVE
 int uclass_unbind_device(struct udevice *dev);
+#else
+static inline int uclass_unbind_device(struct udevice *dev) { return 0; }
+#endif
 
 /**
  * uclass_pre_probe_device() - Deal with a device that is about to be probed
@@ -134,7 +153,11 @@ int uclass_post_probe_device(struct udevice *dev);
  * @dev:       Pointer to the device
  * #return 0 on success, -ve on error
  */
+#ifdef CONFIG_DM_DEVICE_REMOVE
 int uclass_pre_remove_device(struct udevice *dev);
+#else
+static inline int uclass_pre_remove_device(struct udevice *dev) { return 0; }
+#endif
 
 /**
  * uclass_find() - Find uclass by its id