Update this header file to use const devices where possible, to permit
callers to also use const.
Change-Id: I9c0bcba75fee845672234a29dfa7723b61f6bc39
Signed-off-by: Simon Glass <sjg@chromium.org>
return -ENODEV;
}
+int device_get_child_count(const struct udevice *parent)
+{
+ struct udevice *dev;
+ int count = 0;
+
+ list_for_each_entry(dev, &parent->child_head, sibling_node)
+ count++;
+
+ return count;
+}
+
int device_find_child_by_seq(const struct udevice *parent, int seq_or_req_seq,
bool find_req_seq, struct udevice **devp)
{
int device_get_child(const struct udevice *parent, int index,
struct udevice **devp);
+/**
+ * device_get_child_count() - Get the available child count of a device
+ *
+ * Returns the number of children to a device.
+ *
+ * @parent: Parent device to check
+ */
+int device_get_child_count(const struct udevice *parent);
+
/**
* device_find_child_by_seq() - Find a child device based on a sequence
*