[RFC 04/17] usb/ehci: compile ppc-of as a separate unit

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

 



Signed-off-by: Sebastian Andrzej Siewior <sebastian@xxxxxxxxxxxxx>
---
 drivers/usb/host/Makefile      |    1 +
 drivers/usb/host/ehci-ppc-of.c |   19 ++++++++++++++++---
 drivers/usb/host/ehci.c        |   19 ++++---------------
 drivers/usb/host/ehci.h        |    8 ++++++++
 4 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 866b9f8..18da948 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_PCI)		+= pci-quirks.o
 ehci-hcd-y	:= ehci.o
 ehci-hcd-$(CONFIG_PCI)	+= ehci-pci.o
 ehci-hcd-$(CONFIG_PPC_PS3)	+= ehci-ps3.o
+ehci-hcd-$(CONFIG_USB_EHCI_HCD_PPC_OF)	+= ehci-ppc-of.o
 obj-$(CONFIG_USB_EHCI_HCD)	+= ehci-hcd.o
 obj-$(CONFIG_USB_OXU210HP_HCD)	+= oxu210hp-hcd.o
 obj-$(CONFIG_USB_ISP116X_HCD)	+= isp116x-hcd.o
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c
index 41d11fe..0fb7a89 100644
--- a/drivers/usb/host/ehci-ppc-of.c
+++ b/drivers/usb/host/ehci-ppc-of.c
@@ -12,10 +12,13 @@
  * This file is licenced under the GPL.
  */
 
+#include <linux/usb/hcd.h>
+#include <linux/dma-mapping.h>
 #include <linux/signal.h>
 
 #include <linux/of.h>
 #include <linux/of_platform.h>
+#include "ehci.h"
 
 /* called during probe() after chip reset completes */
 static int ehci_ppc_of_setup(struct usb_hcd *hcd)
@@ -37,7 +40,7 @@ static int ehci_ppc_of_setup(struct usb_hcd *hcd)
 
 
 static const struct hc_driver ehci_ppc_of_hc_driver = {
-	.description		= hcd_name,
+	.description		= "ehci_hcd",
 	.product_desc		= "OF EHCI",
 	.hcd_priv_size		= sizeof(struct ehci_hcd),
 
@@ -132,7 +135,7 @@ static int __devinit ehci_hcd_ppc_of_probe(struct platform_device *op)
 	hcd->rsrc_start = res.start;
 	hcd->rsrc_len = resource_size(&res);
 
-	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
+	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, "ehci_hcd")) {
 		printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__);
 		rv = -EBUSY;
 		goto err_rmr;
@@ -237,7 +240,7 @@ static int ehci_hcd_ppc_of_remove(struct platform_device *op)
 		if (np != NULL) {
 			if (!of_address_to_resource(np, 0, &res))
 				if (!request_mem_region(res.start,
-							    0x4, hcd_name))
+							    0x4, "ehci_hcd"))
 					set_ohci_hcfs(ehci, 1);
 				else
 					release_mem_region(res.start, 0x4);
@@ -282,3 +285,13 @@ static struct platform_driver ehci_hcd_ppc_of_driver = {
 		.of_match_table = ehci_hcd_ppc_of_match,
 	},
 };
+
+__init int ehci_ppc_of_register(void)
+{
+	return platform_driver_register(&ehci_hcd_ppc_of_driver);
+}
+
+void ehci_ppc_of_unregister(void)
+{
+	platform_driver_unregister(&ehci_hcd_ppc_of_driver);
+}
diff --git a/drivers/usb/host/ehci.c b/drivers/usb/host/ehci.c
index 8f52ee5..dbe6afd 100644
--- a/drivers/usb/host/ehci.c
+++ b/drivers/usb/host/ehci.c
@@ -1191,11 +1191,6 @@ MODULE_LICENSE ("GPL");
 #define        PLATFORM_DRIVER         ehci_hcd_omap_driver
 #endif
 
-#ifdef CONFIG_USB_EHCI_HCD_PPC_OF
-#include "ehci-ppc-of.c"
-#define OF_PLATFORM_DRIVER	ehci_hcd_ppc_of_driver
-#endif
-
 #ifdef CONFIG_XPS_USB_HCD_XILINX
 #include "ehci-xilinx-of.c"
 #define XILINX_OF_PLATFORM_DRIVER	ehci_hcd_xilinx_of_driver
@@ -1282,7 +1277,7 @@ MODULE_LICENSE ("GPL");
 #endif
 
 #if !defined(CONFIG_PCI) && !defined(PLATFORM_DRIVER) && \
-    !defined(CONFIG_PPC_PS3) && !defined(OF_PLATFORM_DRIVER) && \
+    !defined(CONFIG_PPC_PS3) && !defined(CONFIG_USB_EHCI_HCD_PPC_OF) && \
     !defined(XILINX_OF_PLATFORM_DRIVER)
 #error "missing bus glue for ehci-hcd"
 #endif
@@ -1328,11 +1323,9 @@ static int __init ehci_hcd_init(void)
 	if (retval < 0)
 		goto clean2;
 
-#ifdef OF_PLATFORM_DRIVER
-	retval = platform_driver_register(&OF_PLATFORM_DRIVER);
+	retval = ehci_ppc_of_register();
 	if (retval < 0)
 		goto clean3;
-#endif
 
 #ifdef XILINX_OF_PLATFORM_DRIVER
 	retval = platform_driver_register(&XILINX_OF_PLATFORM_DRIVER);
@@ -1345,10 +1338,8 @@ static int __init ehci_hcd_init(void)
 	/* platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); */
 clean4:
 #endif
-#ifdef OF_PLATFORM_DRIVER
-	platform_driver_unregister(&OF_PLATFORM_DRIVER);
+	ehci_ppc_of_unregister();
 clean3:
-#endif
 	ehci_ps3_unregister();
 clean2:
 	ehci_unregister_pci();
@@ -1372,9 +1363,7 @@ static void __exit ehci_hcd_cleanup(void)
 #ifdef XILINX_OF_PLATFORM_DRIVER
 	platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER);
 #endif
-#ifdef OF_PLATFORM_DRIVER
-	platform_driver_unregister(&OF_PLATFORM_DRIVER);
-#endif
+	ehci_ppc_of_unregister();
 #ifdef PLATFORM_DRIVER
 	platform_driver_unregister(&PLATFORM_DRIVER);
 #endif
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 48a3b73..0f57718 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -805,6 +805,14 @@ static inline int ehci_ps3_register(void) { return 0; }
 static inline void ehci_ps3_unregister(void) {};
 #endif
 
+#ifdef CONFIG_USB_EHCI_HCD_PPC_OF
+int ehci_ppc_of_register(void);
+void ehci_ppc_of_unregister(void);
+#else
+static inline int ehci_ppc_of_register(void) { return 0; }
+static inline void ehci_ppc_of_unregister(void) {};
+#endif
+
 /*-------------------------------------------------------------------------*/
 
 #ifndef DEBUG
-- 
1.7.5.4

--
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