Hello, If CONFIG_DM_GPIO is not enabled, compilation of drivers/power/regulator/regulator_common.c fails with the following errors:
aarch64-none-linux-gnu-ld: drivers/power/regulator/regulator_common.o: in function `regulator_common_of_to_plat': <...>/u-boot/drivers/power/regulator/regulator_common.c:30: undefined reference to `gpio_request_by_name' aarch64-none-linux-gnu-ld: drivers/power/regulator/regulator_common.o: in function `regulator_common_get_enable': <...>/u-boot/drivers/power/regulator/regulator_common.c:57: undefined reference to `dm_gpio_get_value' aarch64-none-linux-gnu-ld: drivers/power/regulator/regulator_common.o: in function `regulator_common_set_enable': <...>/u-boot/drivers/power/regulator/regulator_common.c:92: undefined reference to `dm_gpio_set_value' make: *** [Makefile:2029: u-boot] Error 139 Since the enable gpio is optional we can conditionally skip these calls. While at it, use dm_gpio_is_valid() helper function in regulator_common_get_enable, and remove a debug message that checkpatch --strict complains about: WARNING: Unnecessary ftrace-like logging - prefer using ftrace The 2 fixes are done before the compilation issue fix in order to easily cherry-pick them if needed Signed-off-by: Julien Stephan <[email protected]> --- Changes in v3: - Picked up review tag - add back dm_gpio_is_valid lost during v2 - Link to v2: https://lore.kernel.org/r/20260108-power-regulator-fix-compilation-v2-0-b00cb3268...@baylibre.com Changes in v2: - Picked up review tag - Use CONFIG_IS_ENABLED instead of IS_ENABLED - Link to v1: https://lore.kernel.org/r/20251210-power-regulator-fix-compilation-v1-0-c58f01e0a...@baylibre.com --- Julien Stephan (3): power: regulator: common: remove unnecessary debug trace power: regulator: common: use dm_gpio_is_valid helper power: regulator: common: fix compilation issue drivers/power/regulator/regulator_common.c | 89 +++++++++++++++--------------- 1 file changed, 45 insertions(+), 44 deletions(-) --- base-commit: 141be72e2a9d43aa4e3d1a6a6e0ab8f9eb8784c6 change-id: 20251209-power-regulator-fix-compilation-5232b0365c7b Best regards, -- Julien Stephan <[email protected]>

