Felix Singer has submitted this change. ( https://review.coreboot.org/c/coreboot/+/84676?usp=email )
Change subject: sconfig: Move (WEAK_)DEV_PTR from device.h to static.h ......................................................................
sconfig: Move (WEAK_)DEV_PTR from device.h to static.h
Similar to commit 865173153760 ("sconfig: Move config_of_soc from device.h to static.h"), move these macros to static.h to separate dependencies on device.h and static.h. These macros resolve to device alises that are declared in the generated static_devices.h header, so move them to static.h which includes static_devices.h.
Since static.h remains included in device.h, any source that uses these macros should still compile correctly. Subsequent commits will add static.h to files that need them, after which static.h can be dropped from device.h.
Change-Id: I1c76ad749769591da9c102b11eb618e93b68bd7c Signed-off-by: Nicholas Chin nic.c3.14@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/84676 Reviewed-by: Angel Pons th3fanbus@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Felix Singer service+coreboot-gerrit@felixsinger.de --- M src/include/device/device.h M util/sconfig/main.c 2 files changed, 9 insertions(+), 9 deletions(-)
Approvals: Felix Singer: Looks good to me, approved Angel Pons: Looks good to me, but someone else must approve build bot (Jenkins): Verified
diff --git a/src/include/device/device.h b/src/include/device/device.h index b52be54..6b4f64c 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -502,12 +502,4 @@ 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 */ diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 677b9d2..fc2aa73 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -1906,7 +1906,15 @@ fprintf(f, "#include <%s>\n\n", device_header);
fprintf(f, "/* Returns pointer to config structure of root device (B:D:F = 0:00:0) */\n"); - fprintf(f, "#define config_of_soc() __pci_0_00_0_config\n"); + fprintf(f, "#define config_of_soc() __pci_0_00_0_config\n\n"); + + fprintf(f, "/* Macro to generate `struct device *` name that points to a device with the given alias. */\n"); + fprintf(f, "#define DEV_PTR(_alias) \t_dev_##_alias##_ptr\n\n"); + + fprintf(f, "/* Macro to generate weak `struct device *` definition that points to a device with the given\n"); + fprintf(f, " alias. */\n"); + fprintf(f, "#define WEAK_DEV_PTR(_alias)\t\t\t\\n"); + fprintf(f, "\t__weak DEVTREE_CONST struct device *const DEV_PTR(_alias)\n");
fprintf(f, "\n#endif /* __STATIC_DEVICE_TREE_H */\n"); }