summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/device/device.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 5a9b9e5b4e..0fadc0cd1e 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -391,4 +391,12 @@ void scan_smbus(struct device *bus);
void scan_generic_bus(struct device *bus);
void scan_static_bus(struct device *bus);
+/* Macro to generate `struct device *` name that points to a device with the given alias. */
+#define DEV_PTR(_alias) _dev_##_alias##_ptr
+
+/* Macro to generate weak `struct device *` definition that points to a device with the given
+ alias. */
+#define WEAK_DEV_PTR(_alias) \
+ __weak DEVTREE_CONST struct device *const DEV_PTR(_alias)
+
#endif /* DEVICE_H */