RE: [PATCH] usb/core: skip unnecessary line IRQ request for USB3

From: Alex Shi
Date: Thu Mar 15 2012 - 02:38:30 EST



>
> You may also remove the unregister the legacy interrupt part in
> xhci_try_enable_msi().

Sure, thanks!

>From 6ae16651ae33ea1841984f3a5eb4a691ed730a19 Mon Sep 17 00:00:00 2001
From: Alex Shi <alex.shi@xxxxxxxxx>
Date: Thu, 15 Mar 2012 08:12:47 +0800
Subject: [PATCH] usb/core: skip unnecessary line IRQ request for USB3

USB3(only xhci driver) requests line IRQ here but will disable it
in later driver->start function and try MSI first:

xhci_hcd 0000:02:00.0: irq 18, io mem 0xfe500000
xhci_hcd 0000:02:00.0: irq 45 for MSI/MSI-X
xhci_hcd 0000:02:00.0: irq 46 for MSI/MSI-X

So it is better to remove the redundant request here.

Signed-off-by: Alex Shi <alex.shi@xxxxxxxxx>
---
drivers/usb/core/hcd.c | 3 ++-
drivers/usb/host/xhci.c | 3 ---
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index e128232..5b09825 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2450,7 +2450,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
/* enable irqs just before we start the controller,
* if the BIOS provides legacy PCI irqs.
*/
- if (usb_hcd_is_primary_hcd(hcd) && irqnum) {
+ if (usb_hcd_is_primary_hcd(hcd) && irqnum
+ && (hcd->driver->flags & HCD_MASK) != HCD_USB3) {
retval = usb_hcd_request_irqs(hcd, irqnum, irqflags);
if (retval)
goto err_request_irq;
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index c939f5f..64979c2 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -338,9 +338,6 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
if (xhci->quirks & XHCI_BROKEN_MSI)
return 0;

- /* unregister the legacy interrupt */
- if (hcd->irq)
- free_irq(hcd->irq, hcd);
hcd->irq = -1;

ret = xhci_setup_msix(xhci);
--
1.6.3.3


>
> In fact, I think all the MSI related codes should be moved to xhci-pci.c,
> Since MSI is PCI-only.

A patch moving MSI from xhci to USB core is in reviewing. That walks
far. :) https://lkml.org/lkml/2012/2/20/76


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/