[RFC 03/17] usb/ehci: compile ehci-ps3 as a separate compile 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-ps3.c |   17 +++++++++++++++--
 drivers/usb/host/ehci.c     |   19 ++++---------------
 drivers/usb/host/ehci.h     |    8 ++++++++
 4 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 23fb76c..866b9f8 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -20,6 +20,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
 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-ps3.c b/drivers/usb/host/ehci-ps3.c
index 64626a7..f0093c5 100644
--- a/drivers/usb/host/ehci-ps3.c
+++ b/drivers/usb/host/ehci-ps3.c
@@ -17,6 +17,9 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+#include <linux/dma-mapping.h>
+#include <linux/usb/hcd.h>
+#include "ehci.h"
 
 #include <asm/firmware.h>
 #include <asm/ps3.h>
@@ -53,7 +56,7 @@ static int ps3_ehci_hc_reset(struct usb_hcd *hcd)
 }
 
 static const struct hc_driver ps3_ehci_hc_driver = {
-	.description		= hcd_name,
+	.description		= "ehci_hcd",
 	.product_desc		= "PS3 EHCI Host Controller",
 	.hcd_priv_size		= sizeof(struct ehci_hcd),
 	.irq			= ehci_irq,
@@ -143,7 +146,7 @@ static int __devinit ps3_ehci_probe(struct ps3_system_bus_device *dev)
 	hcd->rsrc_start = dev->m_region->lpar_addr;
 	hcd->rsrc_len = dev->m_region->len;
 
-	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name))
+	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, "ehci_hcd"))
 		dev_dbg(&dev->core, "%s:%d: request_mem_region failed\n",
 			__func__, __LINE__);
 
@@ -250,3 +253,13 @@ static struct ps3_system_bus_driver ps3_ehci_driver = {
 	.remove = ps3_ehci_remove,
 	.shutdown = ps3_ehci_remove,
 };
+
+__init int ehci_ps3_register(void)
+{
+	return ps3_ehci_driver_register(&ps3_ehci_driver);
+}
+
+void ehci_ps3_unregister(void)
+{
+	ps3_ehci_driver_unregister(&ps3_ehci_driver);
+}
diff --git a/drivers/usb/host/ehci.c b/drivers/usb/host/ehci.c
index 9a857be..8f52ee5 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_PPC_PS3
-#include "ehci-ps3.c"
-#define	PS3_SYSTEM_BUS_DRIVER	ps3_ehci_driver
-#endif
-
 #ifdef CONFIG_USB_EHCI_HCD_PPC_OF
 #include "ehci-ppc-of.c"
 #define OF_PLATFORM_DRIVER	ehci_hcd_ppc_of_driver
@@ -1287,7 +1282,7 @@ MODULE_LICENSE ("GPL");
 #endif
 
 #if !defined(CONFIG_PCI) && !defined(PLATFORM_DRIVER) && \
-    !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \
+    !defined(CONFIG_PPC_PS3) && !defined(OF_PLATFORM_DRIVER) && \
     !defined(XILINX_OF_PLATFORM_DRIVER)
 #error "missing bus glue for ehci-hcd"
 #endif
@@ -1329,11 +1324,9 @@ static int __init ehci_hcd_init(void)
 	if (retval < 0)
 		goto clean1;
 
-#ifdef PS3_SYSTEM_BUS_DRIVER
-	retval = ps3_ehci_driver_register(&PS3_SYSTEM_BUS_DRIVER);
+	retval = ehci_ps3_register();
 	if (retval < 0)
 		goto clean2;
-#endif
 
 #ifdef OF_PLATFORM_DRIVER
 	retval = platform_driver_register(&OF_PLATFORM_DRIVER);
@@ -1356,10 +1349,8 @@ clean4:
 	platform_driver_unregister(&OF_PLATFORM_DRIVER);
 clean3:
 #endif
-#ifdef PS3_SYSTEM_BUS_DRIVER
-	ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
+	ehci_ps3_unregister();
 clean2:
-#endif
 	ehci_unregister_pci();
 clean1:
 #ifdef PLATFORM_DRIVER
@@ -1388,9 +1379,7 @@ static void __exit ehci_hcd_cleanup(void)
 	platform_driver_unregister(&PLATFORM_DRIVER);
 #endif
 	ehci_unregister_pci();
-#ifdef PS3_SYSTEM_BUS_DRIVER
-	ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
-#endif
+	ehci_ps3_unregister();
 #ifdef DEBUG
 	debugfs_remove(ehci_debug_root);
 #endif
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 3d53c53..48a3b73 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -797,6 +797,14 @@ static inline int ehci_register_pci(void) { return 0; }
 static inline void ehci_unregister_pci(void) {};
 #endif
 
+#ifdef CONFIG_PPC_PS3
+int ehci_ps3_register(void);
+void ehci_ps3_unregister(void);
+#else
+static inline int ehci_ps3_register(void) { return 0; }
+static inline void ehci_ps3_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