Skip to contentSkip to conversation

reset: gpio: Fix missing gpiolib dependency for GPIO reset controller

PATCH Superseded Mark Brown 2 participants 6 messages Mar 20, 2024 – Mar 22, 2024 Reset controller framework

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 reset: gpio: Fix missing gpiolib dependency for GPIO reset controller

The GPIO reset controller uses gpiolib but there is no Kconfig dependency reflecting this fact, add one.

With the addition of the controller to the arm64 defconfig this is causing build breaks for arm64 virtconfig in -next:

aarch64-linux-gnu-ld: drivers/reset/core.o: in function `__reset_add_reset_gpio_lookup':
/build/stage/linux/drivers/reset/core.c:861:(.text+0xccc): undefined reference to `gpio_device_find_by_fwnode'

Fixes cee544a40e44 ("reset: gpio: Add GPIO-based reset controller")
---
 drivers/reset/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/reset/Kconfig +1 -0
index 85b27c42cf65..f426b4c39179 100644
@@ -68,6 +68,7 @@ config RESET_BRCMSTB_RESCAL
 
 config RESET_GPIO
 	tristate "GPIO reset controller"
+	depends on GPIOLIB
 	help
 	  This enables a generic reset controller for resets attached via
 	  GPIOs.  Typically for OF platforms this driver expects "reset-gpios"

---
base-commit: 72fb52fb0ac44b6a1edd9bc390e44bce3acccd26
change-id: 20240320-reset-gpiolib-deps-f76269197fc0

Best regards,

Signature · 1 line
Mark Brown <[email protected]>
#1 lore raw
Quoted 9 lines · Mark Brown

The GPIO reset controller uses gpiolib but there is no Kconfig dependency reflecting this fact, add one.

With the addition of the controller to the arm64 defconfig this is causing build breaks for arm64 virtconfig in -next:

aarch64-linux-gnu-ld: drivers/reset/core.o: in function `__reset_add_reset_gpio_lookup':
/build/stage/linux/drivers/reset/core.c:861:(.text+0xccc): undefined reference to `gpio_device_find_by_fwnode'

Lack of dependency was intentional: because there is no dependency. GPIOLIB is optional. Because of that I added few stubs for missing GPIOLIB functions, but I missed this stub here.

I propose to add gpio_device_find_by_fwnode() stub for !GPIOLIB case, instead of adding dependency.

Best regards,
Krzysztof

author
#2 lore raw
Quoted 11 lines · Krzysztof Kozlowski
Quoted 2 lines · Mark Brown

The GPIO reset controller uses gpiolib but there is no Kconfig dependency reflecting this fact, add one.

Lack of dependency was intentional: because there is no dependency. GPIOLIB is optional. Because of that I added few stubs for missing GPIOLIB functions, but I missed this stub here.

I propose to add gpio_device_find_by_fwnode() stub for !GPIOLIB case, instead of adding dependency.

In general the stubs do make sense however in this specific case given that the driver is specifically to control a GPIO rather than using a GPIO along with controlling some other thing a dependency does seem like it makes sense.

#3 lore raw
Quoted 10 lines · Mark Brown
Quoted 8 lines · Krzysztof Kozlowski
Quoted 2 lines · Mark Brown

The GPIO reset controller uses gpiolib but there is no Kconfig dependency reflecting this fact, add one.

Lack of dependency was intentional: because there is no dependency. GPIOLIB is optional. Because of that I added few stubs for missing GPIOLIB functions, but I missed this stub here.

Quoted 7 lines
Quoted 2 lines

I propose to add gpio_device_find_by_fwnode() stub for !GPIOLIB case, instead of adding dependency.

In general the stubs do make sense however in this specific case given that the driver is specifically to control a GPIO rather than using a GPIO along with controlling some other thing a dependency does seem like it makes sense.

Then you add dependency in wrong place. The warning you have is in:
drivers/reset/core.o

But the dependency you add is in RESET_GPIO, which is a separate driver. While the driver indeed wants GPIO, this won't solve the original problem. You still can have RESET_GPIO disabled and core still has the gpiolib call to missing stub.

Best regards,
Krzysztof

author
#4 lore raw
Quoted 9 lines · Krzysztof Kozlowski
Quoted 4 lines · Mark Brown

In general the stubs do make sense however in this specific case given that the driver is specifically to control a GPIO rather than using a GPIO along with controlling some other thing a dependency does seem like it makes sense.

Then you add dependency in wrong place. The warning you have is in:
drivers/reset/core.o

Note that this isn't a warning but rather a link failure.

Quoted 4 lines

But the dependency you add is in RESET_GPIO, which is a separate driver. While the driver indeed wants GPIO, this won't solve the original problem. You still can have RESET_GPIO disabled and core still has the gpiolib call to missing stub.

That's true, though it does happen to fix the immediate issue and seems to make sense anyway given that the driver does actually rely on gpiolib for functionality - it seems clear that there should be a dependency there independently of the build failure. Like I say I do agree that a stub is sensible and you're right that it will fix the underlying issue behind the build failure.

Reviewed-by on v1 1/1
#5 lore raw
In reply to Mark Brown
Quoted 9 lines · Mark Brown

The GPIO reset controller uses gpiolib but there is no Kconfig dependency reflecting this fact, add one.

With the addition of the controller to the arm64 defconfig this is causing build breaks for arm64 virtconfig in -next:

aarch64-linux-gnu-ld: drivers/reset/core.o: in function `__reset_add_reset_gpio_lookup':
/build/stage/linux/drivers/reset/core.c:861:(.text+0xccc): undefined reference to `gpio_device_find_by_fwnode'

Best regards,
Krzysztof