mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 22:22:08 +02:00
PCI: endpoint: Align pci_epc_get_msi(), pci_epc_ops::get_msi() return value encoding
The kdoc for API pci_epc_get_msi() says: "Invoke to get the number of MSI interrupts allocated by the RC" The kdoc for the callback pci_epc_ops::get_msi() says: "ops to get the number of MSI interrupts allocated by the RC from the MSI capability register" pci_epc_ops::get_msi() does however return the number of interrupts in the encoding as defined by the Multiple Message Enable (MME) field of the MSI Capability structure. Nowhere in the kdoc does it say that the returned number of interrupts is in MME encoding. It is very confusing that the API pci_epc_get_msi() and the callback function pci_epc_ops::get_msi() 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 <cassel@kernel.org> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Cc: stable+noautosel@kernel.org # this is simply a cleanup Link: https://patch.msgid.link/20250514074313.283156-11-cassel@kernel.org
This commit is contained in:
parent
c8bcb01352
commit
f7f15fc532
|
|
@ -262,7 +262,7 @@ static int cdns_pcie_ep_get_msi(struct pci_epc *epc, u8 fn, u8 vfn)
|
|||
*/
|
||||
mme = FIELD_GET(PCI_MSI_FLAGS_QSIZE, flags);
|
||||
|
||||
return mme;
|
||||
return 1 << mme;
|
||||
}
|
||||
|
||||
static int cdns_pcie_ep_get_msix(struct pci_epc *epc, u8 func_no, u8 vfunc_no)
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ static int dw_pcie_ep_get_msi(struct pci_epc *epc, u8 func_no, u8 vfunc_no)
|
|||
|
||||
val = FIELD_GET(PCI_MSI_FLAGS_QSIZE, val);
|
||||
|
||||
return val;
|
||||
return 1 << val;
|
||||
}
|
||||
|
||||
static int dw_pcie_ep_set_msi(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ static int rcar_pcie_ep_get_msi(struct pci_epc *epc, u8 fn, u8 vfn)
|
|||
if (!(flags & MSICAP0_MSIE))
|
||||
return -EINVAL;
|
||||
|
||||
return ((flags & MSICAP0_MMESE_MASK) >> MSICAP0_MMESE_OFFSET);
|
||||
return 1 << ((flags & MSICAP0_MMESE_MASK) >> MSICAP0_MMESE_OFFSET);
|
||||
}
|
||||
|
||||
static int rcar_pcie_ep_map_addr(struct pci_epc *epc, u8 fn, u8 vfn,
|
||||
|
|
|
|||
|
|
@ -340,8 +340,8 @@ static int rockchip_pcie_ep_get_msi(struct pci_epc *epc, u8 fn, u8 vfn)
|
|||
if (!(flags & ROCKCHIP_PCIE_EP_MSI_CTRL_ME))
|
||||
return -EINVAL;
|
||||
|
||||
return ((flags & ROCKCHIP_PCIE_EP_MSI_CTRL_MME_MASK) >>
|
||||
ROCKCHIP_PCIE_EP_MSI_CTRL_MME_OFFSET);
|
||||
return 1 << ((flags & ROCKCHIP_PCIE_EP_MSI_CTRL_MME_MASK) >>
|
||||
ROCKCHIP_PCIE_EP_MSI_CTRL_MME_OFFSET);
|
||||
}
|
||||
|
||||
static void rockchip_pcie_ep_assert_intx(struct rockchip_pcie_ep *ep, u8 fn,
|
||||
|
|
|
|||
|
|
@ -293,8 +293,6 @@ int pci_epc_get_msi(struct pci_epc *epc, u8 func_no, u8 vfunc_no)
|
|||
if (interrupt < 0)
|
||||
return 0;
|
||||
|
||||
interrupt = 1 << interrupt;
|
||||
|
||||
return interrupt;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pci_epc_get_msi);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user