Skip to contentSkip to conversation

mmc: renesas_sdhi: add regulator dependency

PATCH In review Arnd Bergmann 4 participants 4 messages Mar 29, 2025 – Apr 7, 2025 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mmc: renesas_sdhi: add regulator dependency

From: Arnd Bergmann <[email protected]>

The driver started using the regulator subsystem and fails to build without a dependeny on CONFIG_REGULATOR:

ERROR: modpost: "rdev_get_drvdata" [drivers/mmc/host/renesas_sdhi_core.ko] undefined!
ERROR: modpost: "devm_regulator_register" [drivers/mmc/host/renesas_sdhi_core.ko] undefined!

The 'select RESET_CONTROLLER' needs to either go away or get changed to a dependency in order to avoid Kconfig dependency loops here. It also turns out the the superh version needs neither RESET_CONTROLLER nor REGULATOR, and this works because CONFIG_OF is not set there.

Change both to a 'depends on', but add '|| OF' for the superh case.

Fixes fae80a99dc03 ("mmc: renesas_sdhi: Add support for RZ/G3E SoC")
---
 drivers/mmc/host/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/Kconfig +1 -1
index c3a9e856053b..c9e067b5ba94 100644
@@ -694,8 +694,8 @@ config MMC_TMIO_CORE
 config MMC_SDHI
 	tristate "Renesas SDHI SD/SDIO controller support"
 	depends on SUPERH || ARCH_RENESAS || COMPILE_TEST
+	depends on (RESET_CONTROLLER && REGULATOR) || !OF
 	select MMC_TMIO_CORE
-	select RESET_CONTROLLER if ARCH_RENESAS
 	help
 	  This provides support for the SDHI SD/SDIO controller found in
 	  Renesas SuperH, ARM and ARM64 based SoCs
Signature · 1 line
2.39.5
Reviewed-by on v2 1/1
#1 lore raw
Quoted 8 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The driver started using the regulator subsystem and fails to build without a dependeny on CONFIG_REGULATOR:

ERROR: modpost: "rdev_get_drvdata" [drivers/mmc/host/renesas_sdhi_core.ko] undefined!
ERROR: modpost: "devm_regulator_register" [drivers/mmc/host/renesas_sdhi_core.ko] undefined!

Quoted 6 lines

The 'select RESET_CONTROLLER' needs to either go away or get changed to a dependency in order to avoid Kconfig dependency loops here. It also turns out the the superh version needs neither RESET_CONTROLLER nor REGULATOR, and this works because CONFIG_OF is not set there.

Change both to a 'depends on', but add '|| OF' for the superh case.

!OF

Quoted 3 lines
Fixes fae80a99dc03 ("mmc: renesas_sdhi: Add support for RZ/G3E SoC")

Other than that:

Thank you!

Reviewed-by on v2 1/1
#2 lore raw
In reply to Arnd Bergmann

Hi Arnd,

Quoted 5 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The driver started using the regulator subsystem and fails to build without a dependeny on CONFIG_REGULATOR:

Quoted 7 lines

ERROR: modpost: "rdev_get_drvdata" [drivers/mmc/host/renesas_sdhi_core.ko] undefined!
ERROR: modpost: "devm_regulator_register" [drivers/mmc/host/renesas_sdhi_core.ko] undefined!

The 'select RESET_CONTROLLER' needs to either go away or get changed to a dependency in order to avoid Kconfig dependency loops here. It also turns out the the superh version needs neither RESET_CONTROLLER nor REGULATOR, and this works because CONFIG_OF is not set there.

Both the reset controller and regulator are needed only on a subset of the supported SoCs. However, unlike the reset subsystem, the regulator subsystem does not provide dummies when disabled.

Fortunately most regulator code in the SDHI driver is optimized away by the compiler when CONFIG_OF is not enabled, and the remaining call to mmc_regulator_set_vqmmc() is harmless, as the MMC core does provide a dummy in case regulator support is disabled.

So e.g. an sh7724_generic_defconfig + CONFIG_MMC + CONFIG_MMC_SDHI + CONFIG_OF build indeed failed because of missing regulator symbols.

Note that it is a bit strange sh7724_generic_defconfig and ecovec24_defconfig do not enable regulator support, as arch/sh/boards/mach-ecovec24/setup.c does contain regulators.

Quoted 5 lines

Change both to a 'depends on', but add '|| OF' for the superh case.

Fixes fae80a99dc03 ("mmc: renesas_sdhi: Add support for RZ/G3E SoC")

With the typo pointed out by Wolfram fixed:

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#3 lore raw
In reply to Arnd Bergmann
Quoted 14 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The driver started using the regulator subsystem and fails to build without a dependeny on CONFIG_REGULATOR:

ERROR: modpost: "rdev_get_drvdata" [drivers/mmc/host/renesas_sdhi_core.ko] undefined!
ERROR: modpost: "devm_regulator_register" [drivers/mmc/host/renesas_sdhi_core.ko] undefined!

The 'select RESET_CONTROLLER' needs to either go away or get changed to a dependency in order to avoid Kconfig dependency loops here. It also turns out the the superh version needs neither RESET_CONTROLLER nor REGULATOR, and this works because CONFIG_OF is not set there.

Quoted 5 lines

Change both to a 'depends on', but add '|| OF' for the superh case.

Fixes fae80a99dc03 ("mmc: renesas_sdhi: Add support for RZ/G3E SoC")

Applied for fixes and by fixing the typo pointed out by Geert, thanks!

Kind regards
Uffe

Quoted 21 lines
---
 drivers/mmc/host/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/Kconfig +1 -2
index c3a9e856053b..c9e067b5ba94 100644
@@ -694,8 +694,8 @@ config MMC_TMIO_CORE
 config MMC_SDHI
        tristate "Renesas SDHI SD/SDIO controller support"
        depends on SUPERH || ARCH_RENESAS || COMPILE_TEST
+       depends on (RESET_CONTROLLER && REGULATOR) || !OF
        select MMC_TMIO_CORE
-       select RESET_CONTROLLER if ARCH_RENESAS
        help
          This provides support for the SDHI SD/SDIO controller found in
          Renesas SuperH, ARM and ARM64 based SoCs
--

2.39.5