summaryrefslogtreecommitdiff
path: root/drivers/usb/host/xhci.c
diff options
context:
space:
mode:
authorJosue David Hernandez Gutierrez <josue.d.hernandez.gutierrez@intel.com>2023-03-17 17:47:12 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-23 17:25:22 +0100
commited526ba2ecdfb77bcdbcf4331b8380b646252c20 (patch)
tree40462ab813b6921a1800f61bf42e06d66ce11618 /drivers/usb/host/xhci.c
parentfabbd95cc47cc412e68d03476367046f4cdbd838 (diff)
xhci: move PCI specific MSI/MSIX cleanup away from generic xhci functions
Call the PCI specific MSI/MSIX interrupt freeing code from the xhci-pci callbacks instead of generic xhci code, decoupling PCI parts from generic xhci functions. Adds xhci_pci_stop() that overrides xhci_stop() for PCI xHC controllers. This will free MSIX interrupts a bit later in the hc_driver stop callback, but is still earlier than usb core frees "legacy" interrupts, or interrupts for other hosts. Signed-off-by: Josue David Hernandez Gutierrez <josue.d.hernandez.gutierrez@intel.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20230317154715.535523-12-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/xhci.c')
-rw-r--r--drivers/usb/host/xhci.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 9be84e635e1b..cf90751125ed 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -321,7 +321,7 @@ static int xhci_disable_interrupter(struct xhci_interrupter *ir)
#ifdef CONFIG_USB_PCI
/* Free any IRQs and disable MSI-X */
-static void xhci_cleanup_msix(struct xhci_hcd *xhci)
+void xhci_cleanup_msix(struct xhci_hcd *xhci)
{
struct usb_hcd *hcd = xhci_to_hcd(xhci);
struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
@@ -345,6 +345,7 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci)
pci_free_irq_vectors(pdev);
hcd->msix_enabled = 0;
}
+EXPORT_SYMBOL_GPL(xhci_cleanup_msix);
static void __maybe_unused xhci_msix_sync_irqs(struct xhci_hcd *xhci)
{
@@ -617,7 +618,7 @@ EXPORT_SYMBOL_GPL(xhci_run);
* Disable device contexts, disable IRQs, and quiesce the HC.
* Reset the HC, finish any completed transactions, and cleanup memory.
*/
-static void xhci_stop(struct usb_hcd *hcd)
+void xhci_stop(struct usb_hcd *hcd)
{
u32 temp;
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
@@ -640,8 +641,6 @@ static void xhci_stop(struct usb_hcd *hcd)
xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
spin_unlock_irq(&xhci->lock);
- xhci_cleanup_msix(xhci);
-
/* Deleting Compliance Mode Recovery Timer */
if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
(!(xhci_all_ports_seen_u0(xhci)))) {
@@ -668,6 +667,7 @@ static void xhci_stop(struct usb_hcd *hcd)
readl(&xhci->op_regs->status));
mutex_unlock(&xhci->mutex);
}
+EXPORT_SYMBOL_GPL(xhci_stop);
/*
* Shutdown HC (not bus-specific)
@@ -709,8 +709,6 @@ void xhci_shutdown(struct usb_hcd *hcd)
spin_unlock_irq(&xhci->lock);
- xhci_cleanup_msix(xhci);
-
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"xhci_shutdown completed - status = %x",
readl(&xhci->op_regs->status));