Skip to contentSkip to conversation

pinctrl: fix PINCTRL_SPPCTL=m

PATCH In review Julian Braha 2 participants 2 messages Sep 4 – Sep 16

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: fix PINCTRL_SPPCTL=m

The PINCTRL_SPPCTL option is defined as a tristate in Kconfig, and the help text suggests that the user can build it as a module by setting to 'm'.

However, it cannot currently be set to 'm', because SOC_SP7021, the only platform that supports it, is a bool option that uses 'select' on it.

To allow users to actually set PINCTRL_SPPCTL=m, let's remove the select from the SOC_SP7021 option, and instead have PINCTRL_SPPCTL default to y when SOC_SP7021=y, then users can configure PINCTRL_SPPCTL=m in the kconfig frontend if desired.

Note that I have only compile-tested this change, since I do not have the hardware to runtime-test it. Please advise if it would be better to change PINCTRL_SPPCTL to 'bool' and remove the help text suggesting that it can be set to 'm'.

This impossible tristate was detected by kconfirm, a static analysis tool for Kconfig.

Fixes aa74c44be19c ("pinctrl: Add driver for Sunplus SP7021")
---
 arch/arm/Kconfig.platforms       | 1 -
 drivers/pinctrl/sunplus/Kconfig  | 3 ++-
 drivers/pinctrl/sunplus/sppctl.c | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)
arch/arm/Kconfig.platforms +0 -1
index 2e118b65f93b..dc880addadc5 100644
@@ -177,7 +177,6 @@ config SOC_SP7021
 	select ARM_GIC
 	select ARM_PSCI
 	select PINCTRL
-	select PINCTRL_SPPCTL
 	select SERIAL_SUNPLUS if TTY
 	select SERIAL_SUNPLUS_CONSOLE if TTY
 	help
drivers/pinctrl/sunplus/Kconfig +2 -1
index 69f82590f6d2..7719838b39b6 100644
@@ -5,7 +5,8 @@
 
 config PINCTRL_SPPCTL
 	tristate "Sunplus SP7021 PinMux and GPIO driver"
-	depends on SOC_SP7021
+	default SOC_SP7021
+	depends on SOC_SP7021 || COMPILE_TEST
 	depends on OF && HAS_IOMEM
 	select GENERIC_PINCTRL_GROUPS
 	select GENERIC_PINMUX_FUNCTIONS
drivers/pinctrl/sunplus/sppctl.c +2 -1
index 67e036d66245..89c6e2e92f07 100644
@@ -1113,6 +1113,7 @@ static const struct of_device_id sppctl_match_table[] = {
 	{ .compatible = "sunplus,sp7021-pctl" },
 	{ /* sentinel */ }
 };
+MODULE_DEVICE_TABLE(of, sppctl_match_table);
 
 static struct platform_driver sppctl_pinctrl_driver = {
 	.driver = {
@@ -1121,7 +1122,7 @@ static struct platform_driver sppctl_pinctrl_driver = {
 	},
 	.probe  = sppctl_probe,
 };
-builtin_platform_driver(sppctl_pinctrl_driver)
+module_platform_driver(sppctl_pinctrl_driver);
 
 MODULE_AUTHOR("Dvorkin Dmitry <[email protected]>");
 MODULE_AUTHOR("Wells Lu <[email protected]>");
Signature · 1 line
2.55.0
#1 lore raw
Quoted 3 lines · Julian Braha

The PINCTRL_SPPCTL option is defined as a tristate in Kconfig, and the help text suggests that the user can build it as a module by setting to 'm'.

[...]

Quoted 4 lines

Note that I have only compile-tested this change, since I do not have the hardware to runtime-test it. Please advise if it would be better to change PINCTRL_SPPCTL to 'bool' and remove the help text suggesting that it can be set to 'm'.

Hi Julian,

I've tested this on real hardware, and it fails to boot. I don't think it makes sense for this to be a module, since most of the devices in this SoC are pin-mappable and need muxing to be configured before they can be probed.

Let's rather fix this by making it a bool. I'll send a patch shortly.

Signature · 1 line
Andrew