dm: core: Export uclass_find_device_by_of_offset()
authorSimon Glass <sjg@chromium.org>
Fri, 22 Jan 2016 02:43:57 +0000 (19:43 -0700)
committerSimon Glass <sjg@chromium.org>
Fri, 22 Jan 2016 03:42:35 +0000 (20:42 -0700)
It is sometimes useful to be able to find a device before probing it,
perhaps to set up some platform data for it. Allow finding by of_offset
also.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/core/uclass.c
include/dm/uclass-internal.h

index e1acefe7279e443075681a585e41d9c2cc7a7b61..12095e75a41ef2c303115ea0c107a0ca234821dd 100644 (file)
@@ -254,8 +254,8 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
        return -ENODEV;
 }
 
-static int uclass_find_device_by_of_offset(enum uclass_id id, int node,
-                                          struct udevice **devp)
+int uclass_find_device_by_of_offset(enum uclass_id id, int node,
+                                   struct udevice **devp)
 {
        struct uclass *uc;
        struct udevice *dev;
index b51e1da5c14a02d9e07ec7b4335632f4480a6be6..ad284b8445ac411c65f6778f643a82e77d02d098 100644 (file)
@@ -98,6 +98,22 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name,
 int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
                              bool find_req_seq, struct udevice **devp);
 
+/**
+ * uclass_find_device_by_of_offset() - Find a uclass device by device tree node
+ *
+ * This searches the devices in the uclass for one attached to the given
+ * device tree node.
+ *
+ * The device is NOT probed, it is merely returned.
+ *
+ * @id: ID to look up
+ * @node: Device tree offset to search for (if -ve then -ENODEV is returned)
+ * @devp: Returns pointer to device (there is only one for each node)
+ * @return 0 if OK, -ve on error
+ */
+int uclass_find_device_by_of_offset(enum uclass_id id, int node,
+                                   struct udevice **devp);
+
 /**
  * uclass_bind_device() - Associate device with a uclass
  *