Skip to content

Commit 0917ed8

Browse files
floatiousbjorn-helgaas
authored andcommitted
PCI: endpoint: Align pci_epc_get_msix(), pci_epc_ops::get_msix() return value encoding
The kdoc for pci_epc_get_msix() says: "Invoke to get the number of MSI-X interrupts allocated by the RC" The kdoc for the callback pci_epc_ops->get_msix() says: "ops to get the number of MSI-X interrupts allocated by the RC from the MSI-X capability register" pci_epc_ops::get_msix() does however return the number of interrupts in the encoding as defined by the Table Size field. Nowhere in the kdoc does it say that the returned number of interrupts is in Table Size encoding. It is very confusing that the API pci_epc_get_msix() and the callback function pci_epc_ops::get_msix() don't return the same value. Clean up the API and the callback function to have the same semantics, i.e. return the number of interrupts, regardless of the internal encoding of that value. [bhelgaas: more specific subject] Signed-off-by: Niklas Cassel <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Cc: [email protected] # this is simply a cleanup Link: https://patch.msgid.link/[email protected]
1 parent f7f15fc commit 0917ed8

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

drivers/pci/controller/cadence/pcie-cadence-ep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static int cdns_pcie_ep_get_msix(struct pci_epc *epc, u8 func_no, u8 vfunc_no)
281281

282282
val &= PCI_MSIX_FLAGS_QSIZE;
283283

284-
return val;
284+
return val + 1;
285285
}
286286

287287
static int cdns_pcie_ep_set_msix(struct pci_epc *epc, u8 fn, u8 vfn,

drivers/pci/controller/dwc/pcie-designware-ep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ static int dw_pcie_ep_get_msix(struct pci_epc *epc, u8 func_no, u8 vfunc_no)
575575

576576
val &= PCI_MSIX_FLAGS_QSIZE;
577577

578-
return val;
578+
return val + 1;
579579
}
580580

581581
static int dw_pcie_ep_set_msix(struct pci_epc *epc, u8 func_no, u8 vfunc_no,

drivers/pci/endpoint/pci-epc-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ int pci_epc_get_msix(struct pci_epc *epc, u8 func_no, u8 vfunc_no)
355355
if (interrupt < 0)
356356
return 0;
357357

358-
return interrupt + 1;
358+
return interrupt;
359359
}
360360
EXPORT_SYMBOL_GPL(pci_epc_get_msix);
361361

0 commit comments

Comments
 (0)