Re: [PATCH 1/3] PCI: dwc: ep: Add dw_pcie_ep_deinit_notify()

Niklas Cassel
2024-05-29T14:55:03Z

On Wed, May 29, 2024 at 07:46:14PM +0530, Manivannan Sadhasivam wrote:
>
> That's fine. Thanks a lot for stepping in to fix the build issue. I was on
> vacation, so couldn't act on your query/series promptly.

Welcome back ;)

>
> Let us conclude the fix here itself as we have more than 1 threads going on.
> I did consider adding the stubs to pci-epc.h, but only the deinit API requires
> that. So I thought it will look odd to add stub for only one function, that too
> for one of the two variants (init/deinit).
>
> So I went ahead with the ugly (yes) conditional for the deinit_notify API.
>
> Ideally, I would've expected both dwc and EP subsystem to provide stubs for the
> APIs used by the common driver (host and EP). But since the controller drivers
> were using the conditional check to differentiate between host and EP mode,
> compilers were smart enough to spot the dead functions and removes them. So
> there were no reports so far.
>
> But in this case, the pci_epc_deinit_notify() is called in a separate helper and
> hence the issue.
>
> So to conclude, I think it is best if we can add stub just for
> pci_epc_deinit_notify() in pci-epc.h and get rid of the dummy
> dw_pcie_ep_init_notify() wrapper to make the init/deinit API usage consistent.
>
> Also I do not want to remove the wrapper for dw_pcie_ep_linkup() since its
> conterpart dw_pcie_ep_linkdown() is required.

I see, sounds good.

However, if we add a stub for pci_epc_deinit_notify(), it makes sense to also
add a stub for pci_epc_init_notify(). (I'm quite sure tegra will fail to link
if you change it from dw_pcie_ep_init_notify() to pci_epc_init_notify()
otherwise.)

We should probably also address Bjorn comment:
"ls and qcom even use *both*: pci_epc_linkdown() but dw_pcie_ep_linkup()."

As far as I can tell, it is only ls (not sure why Bjorn also mentioned qcom):
drivers/pci/controller/dwc/pci-layerscape-ep.c: pci_epc_linkdown(pci->ep.epc);
But this should probably also be fixed to use dw_pcie_ep_linkdown().

Kind regards,
Niklas