Browse Source

dm: core: Clarify uclass_first/next_device() comments

These are not as clear as they could be. Tidy them up a bit. Also fix a
tiny code-style nit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass 8 years ago
parent
commit
30a570a983
2 changed files with 12 additions and 4 deletions
  1. 1 2
      drivers/core/uclass.c
  2. 11 2
      include/dm/uclass.h

+ 1 - 2
drivers/core/uclass.c

@@ -366,8 +366,7 @@ int uclass_get_device_by_driver(enum uclass_id id,
 	return -ENODEV;
 	return -ENODEV;
 }
 }
 
 
-int uclass_get_device_tail(struct udevice *dev, int ret,
-				  struct udevice **devp)
+int uclass_get_device_tail(struct udevice *dev, int ret, struct udevice **devp)
 {
 {
 	if (ret)
 	if (ret)
 		return ret;
 		return ret;

+ 11 - 2
include/dm/uclass.h

@@ -241,8 +241,13 @@ int uclass_get_device_by_driver(enum uclass_id id, const struct driver *drv,
  *
  *
  * The device returned is probed if necessary, and ready for use
  * The device returned is probed if necessary, and ready for use
  *
  *
+ * This function is useful to start iterating through a list of devices which
+ * are functioning correctly and can be probed.
+ *
  * @id: Uclass ID to look up
  * @id: Uclass ID to look up
- * @devp: Returns pointer to the first device in that uclass, or NULL if none
+ * @devp: Returns pointer to the first device in that uclass if no error
+ * occurred, or NULL if there is no first device, or an error occurred with
+ * that device.
  * @return 0 if OK (found or not found), other -ve 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);
 int uclass_first_device(enum uclass_id id, struct udevice **devp);
@@ -263,8 +268,12 @@ int uclass_first_device_err(enum uclass_id id, struct udevice **devp);
  *
  *
  * The device returned is probed if necessary, and ready for use
  * The device returned is probed if necessary, and ready for use
  *
  *
+ * This function is useful to start iterating through a list of devices which
+ * are functioning correctly and can be probed.
+ *
  * @devp: On entry, pointer to device to lookup. On exit, returns pointer
  * @devp: On entry, pointer to device to lookup. On exit, returns pointer
- * to the next device in the same uclass, or NULL if none
+ * to the next device in the uclass if no error occurred, or NULL if there is
+ * no next device, or an error occurred with that next device.
  * @return 0 if OK (found or not found), other -ve on error
  * @return 0 if OK (found or not found), other -ve on error
  */
  */
 int uclass_next_device(struct udevice **devp);
 int uclass_next_device(struct udevice **devp);