]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - include/dm/device.h
arm: pxa: colibri_pxa270: add optional i2c support
[karo-tx-uboot.git] / include / dm / device.h
index 53773a8f9d9c9b1e7f83e03e9ee5b2ea96fa6c4b..a239be64691ad774ce380782a08eea6e73e10ad4 100644 (file)
@@ -122,11 +122,11 @@ struct udevice_id {
        ulong data;
 };
 
-#ifdef CONFIG_OF_CONTROL
+#if CONFIG_IS_ENABLED(OF_CONTROL)
 #define of_match_ptr(_ptr)     (_ptr)
 #else
 #define of_match_ptr(_ptr)     NULL
-#endif /* CONFIG_OF_CONTROL */
+#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
 
 /**
  * struct driver - A driver for a feature or peripheral
@@ -470,6 +470,21 @@ bool device_has_active_children(struct udevice *dev);
  */
 bool device_is_last_sibling(struct udevice *dev);
 
+/**
+ * device_set_name() - set the name of a device
+ *
+ * This must be called in the device's bind() method and no later. Normally
+ * this is unnecessary but for probed devices which don't get a useful name
+ * this function can be helpful.
+ *
+ * @dev:       Device to update
+ * @name:      New name (this string is allocated new memory and attached to
+ *             the device)
+ * @return 0 if OK, -ENOMEM if there is not enough memory to allocate the
+ * string
+ */
+int device_set_name(struct udevice *dev, const char *name);
+
 /* device resource management */
 typedef void (*dr_release_t)(struct udevice *dev, void *res);
 typedef int (*dr_match_t)(struct udevice *dev, void *res, void *match_data);