Re: [PATCH v3 3/3] PCI: ultrarisc: allow DP1000 driver to build as module

From: Jia Wang

Date: Thu Jul 30 2026 - 04:25:26 EST


On 2026-07-30 09:46 +0200, Manivannan Sadhasivam wrote:
> On Thu, Jul 30, 2026 at 02:55:36PM +0800, Jia Wang wrote:
> > On 2026-07-29 15:49 +0200, Manivannan Sadhasivam wrote:
> > > On Tue, Jul 14, 2026 at 09:11:04AM +0800, Jia Wang via B4 Relay wrote:
> > > > From: Jia Wang <wangjia@xxxxxxxxxxxxx>
> > > >
> > > > CONFIG_PCIE_ULTRARISC is a tristate option, so the driver can be selected
> > > > as a module when COMPILE_TEST or platform configuration allows it. Using
> > > > builtin_platform_driver() leaves the module build without the module
> > > > init/exit plumbing and causes modpost failures for the generated .ko.
> > > >
> > > > Use module_platform_driver() so the driver works for both module and
> > > > built-in builds while keeping the existing tristate Kconfig entry.
> > > >
> > > > Add a remove callback and call dw_pcie_host_deinit() during removal so the
> > > > root bus is torn down before devres releases the controller data.
> > > >
> > > > Fixes: 5fc35740c3b3 ("PCI: ultrarisc: Add UltraRISC DP1000 PCIe Root Complex driver")
> > > > Signed-off-by: Jia Wang <wangjia@xxxxxxxxxxxxx>
> > > > ---
> > > > drivers/pci/controller/dwc/pcie-ultrarisc.c | 10 +++++++++-
> > > > 1 file changed, 9 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/pci/controller/dwc/pcie-ultrarisc.c b/drivers/pci/controller/dwc/pcie-ultrarisc.c
> > > > index 72ba5840b62d..9bee522a20e9 100644
> > > > --- a/drivers/pci/controller/dwc/pcie-ultrarisc.c
> > > > +++ b/drivers/pci/controller/dwc/pcie-ultrarisc.c
> > > > @@ -193,6 +193,13 @@ static int ultrarisc_pcie_probe(struct platform_device *pdev)
> > > > return 0;
> > > > }
> > > >
> > > > +static void ultrarisc_pcie_remove(struct platform_device *pdev)
> > > > +{
> > > > + struct ultrarisc_pcie *ultra = platform_get_drvdata(pdev);
> > > > +
> > > > + dw_pcie_host_deinit(&ultra->pci.pp);
> > > > +}
> > >
> > > Since this driver registers an internal MSI controller, it is not safe to
> > > remove it due to irq disposal concern. But you can build this driver as a
> > > module though.
> > >
> >
> > Right, I missed that this was intentionally changed to
> > builtin_platform_driver() to prevent irqchip removal. I will drop this
> > patch entirely in the next revision. Thanks!
> >
>
> No, you can still load the driver as a module, that is fine, but just do not
> allow removing it. So your module_platform_driver() change is fine.
>

Understood. I will keep module_platform_driver() and drop only the remove
callback in v4. Thanks for the clarification.

> - Mani
>
> --
> மணிவண்ணன் சதாசிவம்
>

Best regards,
Jia Wang