Re: [RFC/PATCH v2 00/11] Decouple PCI from XHCI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Felipe Balbi | 2011-07-27 01:22:59 [+0300]:

>Hi Sarah,
Hi Felip,

you also need something like that to make it compile without PCI
support.

Subject: [PATCH] usb/xhci: make it compile without PCI

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
---
 drivers/usb/host/xhci.c |   27 +++++++++++++++++++++++++++
 drivers/usb/host/xhci.h |    4 ++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 315ad6e..6930dd5 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -176,6 +176,7 @@ int xhci_reset(struct xhci_hcd *xhci)
 	return handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000);
 }
 
+#ifdef CONFIG_PCI
 /*
  * Free IRQs
  * free all IRQs request
@@ -303,6 +304,30 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci)
 	return;
 }
 
+#else
+
+static inline int xhci_setup_msi(struct xhci_hcd *xhci)
+{
+	int ret;
+	struct pci_dev  *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller);
+
+	ret = request_irq(pdev->irq, (irq_handler_t)xhci_msi_irq,
+				0, "xhci_hcd", xhci_to_hcd(xhci));
+	if (ret)
+		xhci_err(xhci, "disable MSI interrupt\n");
+	return ret;
+}
+
+static inline int xhci_setup_msix(struct xhci_hcd *xhci) { return -EINVAL; }
+static inline 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);
+
+	free_irq(pdev->irq, xhci_to_hcd(xhci));
+}
+#endif
+
 /*
  * Initialize memory for HCD and xHC (one-time init).
  *
@@ -730,10 +755,12 @@ int xhci_suspend(struct xhci_hcd *xhci)
 
 	/* step 5: remove core well power */
 	/* synchronize irq when using MSI-X */
+#ifdef CONFIG_PCI
 	if (xhci->msix_entries) {
 		for (i = 0; i < xhci->msix_count; i++)
 			synchronize_irq(xhci->msix_entries[i].vector);
 	}
+#endif
 
 	return rc;
 }
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 76ca974..4576f00 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1414,7 +1414,11 @@ static inline int xhci_link_trb_quirk(struct xhci_hcd *xhci)
 			(xhci->quirks & XHCI_LINK_TRB_QUIRK));
 }
 
+#ifdef CONFIG_PCI
 extern int xhci_reinit(struct xhci_hcd *xhci, struct device *dev);
+#else
+static inline int xhci_reinit(struct xhci_hcd *xhci, struct device *dev) { return 0; }
+#endif
 
 /* xHCI debugging */
 void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num);
-- 
1.7.4.4

ideally I would prefer to move the CONFIG_PCI into xhci-pci. We should
also get rid of pci_dev in hcd->self.controller and comeup with
something generic. The msi entries are hidden behind CONFIG_PCI. I guess
we can ignore it for now and worry about it later.


Sebastian

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux