summaryrefslogtreecommitdiff
path: root/target/linux/generic/patches-3.9/800-usb-ohci-multiple-platform-driver-fix.patch
blob: d691c5156aa11fdd835b73c100fd4c71b3009dbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1188,7 +1188,7 @@ MODULE_LICENSE ("GPL");
 
 #ifdef CONFIG_USB_OHCI_HCD_PLATFORM
 #include "ohci-platform.c"
-#define PLATFORM_DRIVER		ohci_platform_driver
+#define OHCI_PLATFORM_DRIVER		ohci_platform_driver
 #endif
 
 #if	!defined(PCI_DRIVER) &&		\
@@ -1199,7 +1199,8 @@ MODULE_LICENSE ("GPL");
 	!defined(SA1111_DRIVER) &&	\
 	!defined(PS3_SYSTEM_BUS_DRIVER) && \
 	!defined(SM501_OHCI_DRIVER) && \
-	!defined(TMIO_OHCI_DRIVER)
+	!defined(TMIO_OHCI_DRIVER) && \
+	!defined(OHCI_PLATFORM_DRIVER)
 #error "missing bus glue for ohci-hcd"
 #endif
 
@@ -1277,9 +1278,19 @@ static int __init ohci_hcd_mod_init(void
 		goto error_tmio;
 #endif
 
+#ifdef OHCI_PLATFORM_DRIVER
+	retval = platform_driver_register(&OHCI_PLATFORM_DRIVER);
+	if (retval < 0)
+		goto error_ohci;
+#endif
+
 	return retval;
 
 	/* Error path */
+#ifdef OHCI_PLATFORM_DRIVER
+	platform_driver_unregister(&OHCI_PLATFORM_DRIVER);
+ error_ohci:
+#endif
 #ifdef TMIO_OHCI_DRIVER
 	platform_driver_unregister(&TMIO_OHCI_DRIVER);
  error_tmio:
@@ -1329,6 +1340,9 @@ module_init(ohci_hcd_mod_init);
 
 static void __exit ohci_hcd_mod_exit(void)
 {
+#ifdef OHCI_PLATFORM_DRIVER
+	platform_driver_unregister(&OHCI_PLATFORM_DRIVER);
+#endif
 #ifdef TMIO_OHCI_DRIVER
 	platform_driver_unregister(&TMIO_OHCI_DRIVER);
 #endif