summaryrefslogtreecommitdiff
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorJustin Yeh <justin.yeh@mediatek.com>2026-07-23 11:58:15 +0800
committerLinus Walleij <linusw@kernel.org>2026-07-25 14:57:45 +0200
commite3b4295e0d72186d8c929052fef8ce83ddb20aec (patch)
tree598ab62399d61db9e497c7db8a148c153fd0742a /drivers/pinctrl
parentdab3c7afde6c6572ea71d4ea7f9f6050b576cc53 (diff)
downloadlinux-next-e3b4295e0d72186d8c929052fef8ce83ddb20aec.tar.gz
linux-next-e3b4295e0d72186d8c929052fef8ce83ddb20aec.zip
pinctrl: mediatek: mt7986: register both platform drivers from a single initcall
The MT7986 driver registers two separate platform drivers (mt7986a and mt7986b) and used to call arch_initcall() twice, once for each. This is fine while the driver is built-in, but a single translation unit can only provide one module_init(). Since arch_initcall() expands to module_init() when built as a module, having two of them would break the module build with a redefinition of init_module()/__inittest(). Fold both platform drivers into a single driver array and register them from one initcall using platform_register_drivers(), matching the shape of the other MediaTek pinctrl SoC drivers. platform_register_drivers() also rolls back the first registration if the second one fails. No functional change for built-in builds; this is a preparatory cleanup for enabling module builds. Signed-off-by: Justin Yeh <justin.yeh@mediatek.com> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Linus Walleij <linusw@kernel.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/mediatek/pinctrl-mt7986.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7986.c b/drivers/pinctrl/mediatek/pinctrl-mt7986.c
index ca468115765b..d7c7591ed231 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt7986.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7986.c
@@ -997,17 +997,16 @@ static struct platform_driver mt7986b_pinctrl_driver = {
.probe = mt7986b_pinctrl_probe,
};
-static int __init mt7986a_pinctrl_init(void)
-{
- return platform_driver_register(&mt7986a_pinctrl_driver);
-}
+static struct platform_driver * const mt7986_pinctrl_drivers[] = {
+ &mt7986a_pinctrl_driver,
+ &mt7986b_pinctrl_driver,
+};
-static int __init mt7986b_pinctrl_init(void)
+static int __init mt7986_pinctrl_init(void)
{
- return platform_driver_register(&mt7986b_pinctrl_driver);
+ return platform_register_drivers(mt7986_pinctrl_drivers,
+ ARRAY_SIZE(mt7986_pinctrl_drivers));
}
-
-arch_initcall(mt7986a_pinctrl_init);
-arch_initcall(mt7986b_pinctrl_init);
+arch_initcall(mt7986_pinctrl_init);
MODULE_IMPORT_NS("MTK_PINCTRL");