device: Add helper macros for device pointers using alias names
This change provides helper macros for generating pointer name and weak pointer definition for devices using alias names. This will be helpful for developers to reference the device pointer with alias names used in the device tree. Change-Id: I3a5a3c7fdc2c521bac9ab3336f5a6ebecd621e04 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/57738 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
This commit is contained in:
parent
0df32c85ad
commit
26e2afdd77
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue