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

From: Manivannan Sadhasivam

Date: Wed Jul 29 2026 - 10:14:03 EST


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.

- Mani

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