Re: [PATCH v15 6/6] PCI: cadence: Use cdns_pcie_find_*capability() to avoid hardcoding offsets

From: Hans Zhang
Date: Thu Oct 09 2025 - 11:47:58 EST




On 2025/10/9 22:54, Sasha Levin wrote:
On Wed, Aug 13, 2025 at 10:45:29PM +0800, Hans Zhang wrote:
@@ -249,9 +252,10 @@ static int cdns_pcie_ep_get_msi(struct pci_epc *epc, u8 fn, u8 vfn)
{
    struct cdns_pcie_ep *ep = epc_get_drvdata(epc);
    struct cdns_pcie *pcie = &ep->pcie;
-    u32 cap = CDNS_PCIE_EP_FUNC_MSI_CAP_OFFSET;
    u16 flags, mme;
+    u8 cap;

+    cap = cdns_pcie_find_capability(pcie, PCI_CAP_ID_MSIX);

We should be passing PCI_CAP_ID_MSI, not PCI_CAP_ID_MSIX here, right?


Hi Sasha,

Yes, thank you very much for pointing it out. Sorry, it's my fault. I will submit a patch to fix it.

Best regards,
Hans