From ae7b75fb0df5b3206a452d65c1bf5cd1565814fa Mon Sep 17 00:00:00 2001 From: Nicholas Chin Date: Fri, 2 Jan 2026 07:23:08 -0700 Subject: [PATCH] mb/lenovo/sklkbl_thinkpad/cfr.c: Fix X280 build error As there is no model of the X280 with a dGPU, its devicetree does not declare a device with a dgpu alias like the other Skylake/Kaby Lake Thinkpad ports. This breaks the DEV_PTR(dgpu) reference in cfr.c, causing the following build error if CONFIG_DRIVERS_OPTION_CFR is set: In file included from src/mainboard/lenovo/sklkbl_thinkpad/cfr.c:9: src/mainboard/lenovo/sklkbl_thinkpad/cfr.c: In function 'update_dgpu': build/static.h:11:33: error: '_dev_dgpu_ptr' undeclared (first use in this function); did you mean '_dev_igpu_ptr'? 11 | #define DEV_PTR(_alias) _dev_##_alias##_ptr | ^~~~~ src/mainboard/lenovo/sklkbl_thinkpad/cfr.c:14:31: note: in expansion of macro 'DEV_PTR' 14 | struct device *dgpu = DEV_PTR(dgpu); | ^~~~~~~ build/static.h:11:33: note: each undeclared identifier is reported only once for each function it appears in 11 | #define DEV_PTR(_alias) _dev_##_alias##_ptr | ^~~~~ src/mainboard/lenovo/sklkbl_thinkpad/cfr.c:14:31: note: in expansion of macro 'DEV_PTR' 14 | struct device *dgpu = DEV_PTR(dgpu); | ^~~~~~~ make: *** [Makefile:431: build/ramstage/mainboard/lenovo/sklkbl_thinkpad/cfr.o] Error 1 Fix this by declaring a WEAK_DEV_PTR for the dgpu device, which will be overridden by the compiled devicetree if the board variant declares a dgpu device in its overridetree. TEST=X280 builds successfully with the following defconfig: CONFIG_VENDOR_LENOVO=y CONFIG_BOARD_LENOVO_X280=y CONFIG_DRIVERS_OPTION_CFR=y Change-Id: I18cc18a88851bb943de8ab6d2d1fdcbf0f4aea86 Signed-off-by: Nicholas Chin Reviewed-on: https://review.coreboot.org/c/coreboot/+/90674 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel --- src/mainboard/lenovo/sklkbl_thinkpad/cfr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mainboard/lenovo/sklkbl_thinkpad/cfr.c b/src/mainboard/lenovo/sklkbl_thinkpad/cfr.c index 8f282facdd..b5d979806d 100644 --- a/src/mainboard/lenovo/sklkbl_thinkpad/cfr.c +++ b/src/mainboard/lenovo/sklkbl_thinkpad/cfr.c @@ -8,6 +8,8 @@ #include #include +WEAK_DEV_PTR(dgpu); + /* Hide the dGPU CFR entry if dGPU not present */ static void update_dgpu(struct sm_object *new) {