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

Jia Wang <[email protected]>
Newsgroups org.kernel.vger.linux-pci,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <178539939270.1582149.5148262134429405169.b4-reply@b4>
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 <[email protected]>
> > > > 
> > > > 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 <[email protected]>
> > > > ---
> > > >  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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.