summaryrefslogtreecommitdiff
path: root/include/dm/device.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-07-17 15:23:15 -0600
committerSimon Glass <sjg@chromium.org>2016-07-25 20:46:43 -0600
commitc57f806bf2e745c4273dc33c9827781cff46427c (patch)
treed0df31d54e5762a985d7c19768c2dfb37f693889 /include/dm/device.h
parentc3f03ffbe31ae886f0eb670edf47fc208d667c19 (diff)
dm: core: Add a way to find a device by its driver
Some SoCs have a single clock device. Provide a way to find it given its driver name. This is handled by the linker so will fail if the name is not found, avoiding strange errors when names change and do not match. It is also faster than a string comparison. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm/device.h')
-rw-r--r--include/dm/device.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/dm/device.h b/include/dm/device.h
index c825d47236..705849b228 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -207,6 +207,10 @@ struct driver {
#define U_BOOT_DRIVER(__name) \
ll_entry_declare(struct driver, __name, driver)
+/* Get a pointer to a given driver */
+#define DM_GET_DRIVER(__name) \
+ ll_entry_get(struct driver, __name, driver)
+
/**
* dev_get_platdata() - Get the platform data for a device
*