From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>,
Josue David Hernandez Gutierrez
<josue.d.hernandez.gutierrez@intel.com>,
Mathias Nyman <mathias.nyman@linux.intel.com>
Subject: [PATCH 12/14] xhci: Move functions to cleanup MSI to xhci-pci
Date: Fri, 17 Mar 2023 17:47:13 +0200 [thread overview]
Message-ID: <20230317154715.535523-13-mathias.nyman@linux.intel.com> (raw)
In-Reply-To: <20230317154715.535523-1-mathias.nyman@linux.intel.com>
From: Josue David Hernandez Gutierrez <josue.d.hernandez.gutierrez@intel.com>
Move function to cleanup MSI from xhci.c to xhci-pci.c
This is to decouple PCI specific code from generic xhci code.
No functional changes, function is an exact copy
Signed-off-by: Josue David Hernandez Gutierrez <josue.d.hernandez.gutierrez@intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
drivers/usb/host/xhci-pci.c | 26 ++++++++++++++++++++++++++
drivers/usb/host/xhci.c | 31 -------------------------------
drivers/usb/host/xhci.h | 1 -
3 files changed, 26 insertions(+), 32 deletions(-)
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index b6cfc028f8f7..1e84a842e2a9 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -88,6 +88,32 @@ static const struct xhci_driver_overrides xhci_pci_overrides __initconst = {
.update_hub_device = xhci_pci_update_hub_device,
};
+/* Free any IRQs and disable MSI-X */
+static 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);
+
+ if (xhci->quirks & XHCI_PLAT)
+ return;
+
+ /* return if using legacy interrupt */
+ if (hcd->irq > 0)
+ return;
+
+ if (hcd->msix_enabled) {
+ int i;
+
+ for (i = 0; i < xhci->msix_count; i++)
+ free_irq(pci_irq_vector(pdev, i), xhci_to_hcd(xhci));
+ } else {
+ free_irq(pci_irq_vector(pdev, 0), xhci_to_hcd(xhci));
+ }
+
+ pci_free_irq_vectors(pdev);
+ hcd->msix_enabled = 0;
+}
+
/*
* Set up MSI
*/
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index cf90751125ed..874dca6dec69 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -320,33 +320,6 @@ static int xhci_disable_interrupter(struct xhci_interrupter *ir)
#ifdef CONFIG_USB_PCI
-/* Free any IRQs and disable MSI-X */
-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);
-
- if (xhci->quirks & XHCI_PLAT)
- return;
-
- /* return if using legacy interrupt */
- if (hcd->irq > 0)
- return;
-
- if (hcd->msix_enabled) {
- int i;
-
- for (i = 0; i < xhci->msix_count; i++)
- free_irq(pci_irq_vector(pdev, i), xhci_to_hcd(xhci));
- } else {
- free_irq(pci_irq_vector(pdev, 0), xhci_to_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)
{
struct usb_hcd *hcd = xhci_to_hcd(xhci);
@@ -362,10 +335,6 @@ static void __maybe_unused xhci_msix_sync_irqs(struct xhci_hcd *xhci)
#else
-static inline void xhci_cleanup_msix(struct xhci_hcd *xhci)
-{
-}
-
static inline void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
{
}
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index a9111260632c..08d721921b7b 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -2144,7 +2144,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated);
irqreturn_t xhci_irq(struct usb_hcd *hcd);
irqreturn_t xhci_msi_irq(int irq, void *hcd);
-void xhci_cleanup_msix(struct xhci_hcd *xhci);
int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev);
int xhci_alloc_tt_info(struct xhci_hcd *xhci,
struct xhci_virt_device *virt_dev,
--
2.25.1
next prev parent reply other threads:[~2023-03-17 15:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-17 15:47 [PATCH 00/14] xhci features for usb-next Mathias Nyman
2023-03-17 15:47 ` [PATCH 01/14] xhci: mem: Carefully calculate size for memory allocations Mathias Nyman
2023-03-17 15:47 ` [PATCH 02/14] xhci: mem: Use dma_poll_zalloc() instead of explicit memset() Mathias Nyman
2023-03-17 15:47 ` [PATCH 03/14] xhci: mem: Get rid of redundant 'else' Mathias Nyman
2023-03-17 15:47 ` [PATCH 04/14] xhci: mem: Drop useless return:s Mathias Nyman
2023-03-17 15:47 ` [PATCH 05/14] xhci: mem: Use while (i--) pattern to clean up Mathias Nyman
2023-03-17 15:47 ` [PATCH 06/14] xhci: mem: Replace explicit castings with appropriate specifiers Mathias Nyman
2023-03-17 15:47 ` [PATCH 07/14] xhci: mem: Join string literals back Mathias Nyman
2023-03-17 15:47 ` [PATCH 08/14] xhci: dbc: Provide sysfs option to configure dbc descriptors Mathias Nyman
2023-03-17 15:47 ` [PATCH 09/14] xhci: Avoid PCI MSI/MSIX interrupt reinitialization at resume Mathias Nyman
2023-03-17 15:47 ` [PATCH 10/14] xhci: Move functions to setup msi to xhci-pci Mathias Nyman
2023-03-17 15:47 ` [PATCH 11/14] xhci: move PCI specific MSI/MSIX cleanup away from generic xhci functions Mathias Nyman
2023-03-17 15:47 ` Mathias Nyman [this message]
2023-03-17 15:47 ` [PATCH 13/14] xhci: Call MSI sync function from xhci-pci instead of generic xhci code Mathias Nyman
2023-03-17 15:47 ` [PATCH 14/14] xhci: Move xhci MSI sync function to to xhci-pci Mathias Nyman
2023-03-17 15:53 ` [PATCH 00/14] xhci features for usb-next Mathias Nyman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230317154715.535523-13-mathias.nyman@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=josue.d.hernandez.gutierrez@intel.com \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox