xhci: rework 'xhci_try_enable_msi()' MSI and MSI-X setup code
authorNiklas Neronin <niklas.neronin@linux.intel.com>
Fri, 1 Dec 2023 15:06:44 +0000 (17:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Dec 2023 06:50:40 +0000 (07:50 +0100)
commit9831960df237855ea3333e08c26cc9405a7ed440
treeb4342cb8da2916f9f029b95dc1c1eb122979c495
parentdfbf4441f2d31d21e0a98c5fcff6dae8b57b79dd
xhci: rework 'xhci_try_enable_msi()' MSI and MSI-X setup code

Simplify 'xhci_try_enable_msi()' and reduce unnecessary function calls.

xHCI driver first tries to allocate 'num_online_cpu()' number of MSI-X
vectors, if that fails it falls back to a single MSI vector. There is no
good reason for this, we currently only support a primary interrupter.
However, we are still interested in knowing if there are more vectors
available, which will be utilized once we get secondary interrupter
support.

Call 'pci_alloc_irq_vectors()' once (with MSI-X and MSI flag), instead
of separately for MSI-X and MSI. And accept any number of MSI-X or MSI
vectors between 1 and 'num_online_cpu()'.

Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20231201150647.1307406-17-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-pci.c