Re: [PATCH] PCI: eswin: Publish the platform driver's OF alias
From: Manivannan Sadhasivam
Date: Mon Sep 07 2026 - 06:56:17 EST
On Mon, Sep 07, 2026 at 06:23:19PM +0800, Nick Huang wrote:
> Manivannan Sadhasivam <mani@xxxxxxxxxx> 於 2026年9月5日週六 下午11:55寫道:
> >
> > On Sat, Sep 05, 2026 at 02:46:41PM +0000, Nick Huang wrote:
> > > On Sat, Sep 05, 2026 at 09:42:51PM +0800, hpp.iscas wrote:
> > > > The ESWIN PCIe host controller is a platform driver matched through
> > > > eswin_pcie_of_match. PCIE_ESWIN is tristate, but the table is not
> > > > published for OF module autoloading.
> > > >
> > > > Publish this platform-device table. Do not change the RISC-V host
> > > > initialization sequence or PCI device matching.
> > > >
> > > > Fixes: b593c26d081a ("PCI: eswin: Add ESWIN PCIe Root Complex driver")
> > > > Signed-off-by: hpp.iscas <hppiscas@xxxxxxx>
> > > > ---
> > > > drivers/pci/controller/dwc/pcie-eswin.c | 1 +
> > > > 1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/drivers/pci/controller/dwc/pcie-eswin.c b/drivers/pci/controller/dwc/pcie-eswin.c
> > > > index ce8d64f..1bb4469 100644
> > > > --- a/drivers/pci/controller/dwc/pcie-eswin.c
> > > > +++ b/drivers/pci/controller/dwc/pcie-eswin.c
> > > > @@ -388,6 +388,7 @@ static const struct of_device_id eswin_pcie_of_match[] = {
> > > > { .compatible = "eswin,eic7700-pcie", .data = &eswin_eic7700_data },
> > > > {}
> > > > };
> > > > +MODULE_DEVICE_TABLE(of, eswin_pcie_of_match);
> > > >
> > > > static struct platform_driver eswin_pcie_driver = {
> > > > .probe = eswin_pcie_probe,
> > > >
> > > Hi hpp.iscas
> > >
> > > Since this driver uses `builtin_platform_driver(eswin_pcie_driver)`, it
> > > appears to be built-in only. In that case, `MODULE_DEVICE_TABLE()` seems
> > > unnecessary.
> > >
> >
> > Nope. builtin_platform_driver() only prevents removing the driver once loaded.
> > Since the driver is defined as 'tristate' in Kconfig, it can still be loaded
> > dynamically. So MODULE_DEVICE_TABLE() would still be necessary for udev to
> > autoload the module based on modalias.
> >
> > - Mani
> >
> > --
> > மணிவண்ணன் சதாசிவம்
> Hi Mani
>
> Thanks for the clarification. I see that builtin_platform_driver() does not
> prevent the driver from being built and loaded as a module, so
> MODULE_DEVICE_TABLE() is still needed for module autoloading.
>
> However, since builtin_platform_driver() does not provide an unregister
> path, the module cannot be unloaded with rmmod. Is that intentional for
> this driver?
>
Yes, that's intentional and only applicable for controller drivers implementing
irqchip. Refer this guide for more details:
https://docs.kernel.org/PCI/controller/pci-controller-drivers.html#remove
- Mani
--
மணிவண்ணன் சதாசிவம்