Commit dfbf4441 authored by Niklas Neronin's avatar Niklas Neronin Committed by Greg Kroah-Hartman

xhci: change 'msix_count' to encompass MSI or MSI-X vectors

Instead of variable 'msix_count' containing the number of MSI-X vectors,
now it can contains MSI or MSI-X vector amount. Because both interrupt
methods allow several vectors. Thus, 'msix_count' is renamed to 'nvecs'.

Additionally, instead of storing the maximum possible vector amount,
now it stores the amount of successfully allocated vectors, or negative
integer on allocation failure.
Signed-off-by: default avatarNiklas Neronin <niklas.neronin@linux.intel.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20231201150647.1307406-16-mathias.nyman@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a795f708
...@@ -142,12 +142,12 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) ...@@ -142,12 +142,12 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
* - num_online_cpus: maximum MSI-X vectors per CPUs core. * - num_online_cpus: maximum MSI-X vectors per CPUs core.
* Add additional 1 vector to ensure always available interrupt. * Add additional 1 vector to ensure always available interrupt.
*/ */
xhci->msix_count = min(num_online_cpus() + 1, xhci->nvecs = min(num_online_cpus() + 1,
HCS_MAX_INTRS(xhci->hcs_params1)); HCS_MAX_INTRS(xhci->hcs_params1));
ret = pci_alloc_irq_vectors(pdev, xhci->msix_count, xhci->msix_count, xhci->nvecs = pci_alloc_irq_vectors(pdev, xhci->nvecs, xhci->nvecs,
PCI_IRQ_MSIX); PCI_IRQ_MSIX);
if (ret < 0) { if (xhci->nvecs < 0) {
xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Failed to enable MSI-X"); xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Failed to enable MSI-X");
goto setup_msi; goto setup_msi;
} }
...@@ -166,8 +166,8 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) ...@@ -166,8 +166,8 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
setup_msi: setup_msi:
/* TODO: Check with MSI Soc for sysdev */ /* TODO: Check with MSI Soc for sysdev */
ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI); xhci->nvecs = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSI);
if (ret < 0) { if (xhci->nvecs < 0) {
xhci_dbg_trace(xhci, trace_xhci_dbg_init, "failed to allocate MSI entry"); xhci_dbg_trace(xhci, trace_xhci_dbg_init, "failed to allocate MSI entry");
goto legacy_irq; goto legacy_irq;
} }
......
...@@ -1765,8 +1765,8 @@ struct xhci_hcd { ...@@ -1765,8 +1765,8 @@ struct xhci_hcd {
int page_size; int page_size;
/* Valid values are 12 to 20, inclusive */ /* Valid values are 12 to 20, inclusive */
int page_shift; int page_shift;
/* msi-x vectors */ /* MSI-X/MSI vectors */
int msix_count; int nvecs;
/* optional clocks */ /* optional clocks */
struct clk *clk; struct clk *clk;
struct clk *reg_clk; struct clk *reg_clk;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment