Re: [PATCH v6 3/5] pinctrl: mediatek: allow common drivers to be built as modules
Chen-Yu Tsai <[email protected]>
| Newsgroups | org.infradead.lists.linux-mediatek,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-gpio,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAGb2v64Sus+p1qPqhAgrc_gYYKvVGkV2CnGHYN70i0zv+BuOkg@mail.gmail.com> |
On Wed, Jul 22, 2026 at 4:36 PM AngeloGioacchino Del Regno <[email protected]> wrote: > > On 7/13/26 10:37, Justin Yeh wrote: > > The MediaTek SoC pinctrl drivers link against the shared implementations > > in pinctrl-mtk-common.c (v1), pinctrl-moore.c and pinctrl-mtmips.c. These > > were built-in only: their Kconfig symbols were bool, they did not export > > their entry points and they carried no MODULE_LICENSE(). > > > > To let the individual SoC drivers be built as loadable modules (required > > for Android GKI + vendor_dlkm, where vendor drivers must live outside the > > GKI vmlinux), the shared code they depend on has to be modular too. > > Otherwise selecting a SoC driver as =m forces the common symbol to =y and > > the resulting module fails to link against the unexported common entry > > points. > > > > Convert PINCTRL_MTK, PINCTRL_MTK_MOORE and PINCTRL_MTK_MTMIPS to > > tristate, export the entry points used by the SoC drivers, and add > > MODULE_DESCRIPTION()/MODULE_LICENSE() to the three common files. > > > > The v2 common code (PINCTRL_MTK_V2) is already modular, but mtk_rmw() was > > never exported. It is called directly by SoC drivers such as mt7623, so > > export it as well to keep those drivers linking once they are modular. > > > > Rather than exporting these shared symbols into the global namespace, > > export them in the "MTK_PINCTRL" symbol namespace with > > EXPORT_SYMBOL_NS_GPL() so they are only visible to drivers that opt in. > > Each SoC driver that uses them therefore declares > > MODULE_IMPORT_NS("MTK_PINCTRL"). > > > > Signed-off-by: Justin Yeh <[email protected]> > > Some of the pinctrl drivers are missing > MODULE_DEVICE_TABLE(of, [match_array]) > > ...therefore module build will fail. Would it fail though? IIRC this statement is optional. It will still build without it, but the module won't be loaded automatically when a matching device is found. This is a different kind of failure. We probably still want to add them right now while we are modifying all the drivers though. ChenYu > Have you tested compiling the kernel with *all of the MediaTek pinctrl drivers* > set as module??? :-) > > Cheers, > Angelo > > > --- >