aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2013-04-25 13:29:04 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-25 13:58:00 -0400
commit8097804eab55d2dcfadfc821bceeb0faad978ab3 (patch)
tree18c95d6f486749a23d905442802a61e2f28830d4 /drivers/usb/host
parentc3c683ead3c53c0eb67b72c54e130baf45ac25d2 (diff)
USB: OHCI: avoid conflicting platform drivers
Like the EHCI driver, OHCI supports a large number of different platform glue drivers by directly including them, which causes problems with conflicting macro definitions in some cases. As more ARM architecture specific back-ends are required to coexist in a single build, we should split those out into separate drivers. Unfortunately, the infrastructure for that is still under development, so to give us more time, this uses a separate *_PLATFORM_DRIVER macro for each ARM specific OHCI backend, just like we already do on PowerPC and some of the other ARM platforms. In linux-3.10, only the SPEAr and CNS3xxx back-ends would actually conflict without this patch, but over time we would get more of them, so this is a way to avoid having to patch the driver every time it breaks. We should still split out all back-ends into separate loadable modules, but that work is only needed to improve code size and cleanliness after this patch, not for correctness. While we're here, this fixes the incorrectly sorted error path for the OMAP1 and OMAP3 backends to ensure we always unregister the exact set of drivers that were registered before erroring out. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ohci-hcd.c136
1 files changed, 118 insertions, 18 deletions
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 180a2b01db56..9e6de9586ae4 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1102,12 +1102,12 @@ MODULE_LICENSE ("GPL");
1102 1102
1103#if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S3C64XX) 1103#if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S3C64XX)
1104#include "ohci-s3c2410.c" 1104#include "ohci-s3c2410.c"
1105#define PLATFORM_DRIVER ohci_hcd_s3c2410_driver 1105#define S3C2410_PLATFORM_DRIVER ohci_hcd_s3c2410_driver
1106#endif 1106#endif
1107 1107
1108#ifdef CONFIG_USB_OHCI_EXYNOS 1108#ifdef CONFIG_USB_OHCI_EXYNOS
1109#include "ohci-exynos.c" 1109#include "ohci-exynos.c"
1110#define PLATFORM_DRIVER exynos_ohci_driver 1110#define EXYNOS_PLATFORM_DRIVER exynos_ohci_driver
1111#endif 1111#endif
1112 1112
1113#ifdef CONFIG_USB_OHCI_HCD_OMAP1 1113#ifdef CONFIG_USB_OHCI_HCD_OMAP1
@@ -1127,25 +1127,24 @@ MODULE_LICENSE ("GPL");
1127 1127
1128#ifdef CONFIG_ARCH_EP93XX 1128#ifdef CONFIG_ARCH_EP93XX
1129#include "ohci-ep93xx.c" 1129#include "ohci-ep93xx.c"
1130#define PLATFORM_DRIVER ohci_hcd_ep93xx_driver 1130#define EP93XX_PLATFORM_DRIVER ohci_hcd_ep93xx_driver
1131#endif 1131#endif
1132 1132
1133#ifdef CONFIG_ARCH_AT91 1133#ifdef CONFIG_ARCH_AT91
1134#include "ohci-at91.c" 1134#include "ohci-at91.c"
1135#define PLATFORM_DRIVER ohci_hcd_at91_driver 1135#define AT91_PLATFORM_DRIVER ohci_hcd_at91_driver
1136#endif 1136#endif
1137 1137
1138#ifdef CONFIG_ARCH_LPC32XX 1138#ifdef CONFIG_ARCH_LPC32XX
1139#include "ohci-nxp.c" 1139#include "ohci-nxp.c"
1140#define PLATFORM_DRIVER usb_hcd_nxp_driver 1140#define NXP_PLATFORM_DRIVER usb_hcd_nxp_driver
1141#endif 1141#endif
1142 1142
1143#ifdef CONFIG_ARCH_DAVINCI_DA8XX 1143#ifdef CONFIG_ARCH_DAVINCI_DA8XX
1144#include "ohci-da8xx.c" 1144#include "ohci-da8xx.c"
1145#define PLATFORM_DRIVER ohci_hcd_da8xx_driver 1145#define DAVINCI_PLATFORM_DRIVER ohci_hcd_da8xx_driver
1146#endif 1146#endif
1147 1147
1148
1149#ifdef CONFIG_USB_OHCI_HCD_PPC_OF 1148#ifdef CONFIG_USB_OHCI_HCD_PPC_OF
1150#include "ohci-ppc-of.c" 1149#include "ohci-ppc-of.c"
1151#define OF_PLATFORM_DRIVER ohci_hcd_ppc_of_driver 1150#define OF_PLATFORM_DRIVER ohci_hcd_ppc_of_driver
@@ -1153,7 +1152,7 @@ MODULE_LICENSE ("GPL");
1153 1152
1154#ifdef CONFIG_PLAT_SPEAR 1153#ifdef CONFIG_PLAT_SPEAR
1155#include "ohci-spear.c" 1154#include "ohci-spear.c"
1156#define PLATFORM_DRIVER spear_ohci_hcd_driver 1155#define SPEAR_PLATFORM_DRIVER spear_ohci_hcd_driver
1157#endif 1156#endif
1158 1157
1159#ifdef CONFIG_PPC_PS3 1158#ifdef CONFIG_PPC_PS3
@@ -1199,7 +1198,14 @@ MODULE_LICENSE ("GPL");
1199 !defined(SA1111_DRIVER) && \ 1198 !defined(SA1111_DRIVER) && \
1200 !defined(PS3_SYSTEM_BUS_DRIVER) && \ 1199 !defined(PS3_SYSTEM_BUS_DRIVER) && \
1201 !defined(SM501_OHCI_DRIVER) && \ 1200 !defined(SM501_OHCI_DRIVER) && \
1202 !defined(TMIO_OHCI_DRIVER) 1201 !defined(TMIO_OHCI_DRIVER) && \
1202 !defined(S3C2410_PLATFORM_DRIVER) && \
1203 !defined(EXYNOS_PLATFORM_DRIVER) && \
1204 !defined(EP93XX_PLATFORM_DRIVER) && \
1205 !defined(AT91_PLATFORM_DRIVER) && \
1206 !defined(NXP_PLATFORM_DRIVER) && \
1207 !defined(DAVINCI_PLATFORM_DRIVER) && \
1208 !defined(SPEAR_PLATFORM_DRIVER)
1203#error "missing bus glue for ohci-hcd" 1209#error "missing bus glue for ohci-hcd"
1204#endif 1210#endif
1205 1211
@@ -1277,9 +1283,79 @@ static int __init ohci_hcd_mod_init(void)
1277 goto error_tmio; 1283 goto error_tmio;
1278#endif 1284#endif
1279 1285
1286#ifdef S3C2410_PLATFORM_DRIVER
1287 retval = platform_driver_register(&S3C2410_PLATFORM_DRIVER);
1288 if (retval < 0)
1289 goto error_s3c2410;
1290#endif
1291
1292#ifdef EXYNOS_PLATFORM_DRIVER
1293 retval = platform_driver_register(&EXYNOS_PLATFORM_DRIVER);
1294 if (retval < 0)
1295 goto error_exynos;
1296#endif
1297
1298#ifdef EP93XX_PLATFORM_DRIVER
1299 retval = platform_driver_register(&EP93XX_PLATFORM_DRIVER);
1300 if (retval < 0)
1301 goto error_ep93xx;
1302#endif
1303
1304#ifdef AT91_PLATFORM_DRIVER
1305 retval = platform_driver_register(&AT91_PLATFORM_DRIVER);
1306 if (retval < 0)
1307 goto error_at91;
1308#endif
1309
1310#ifdef NXP_PLATFORM_DRIVER
1311 retval = platform_driver_register(&NXP_PLATFORM_DRIVER);
1312 if (retval < 0)
1313 goto error_nxp;
1314#endif
1315
1316#ifdef DAVINCI_PLATFORM_DRIVER
1317 retval = platform_driver_register(&DAVINCI_PLATFORM_DRIVER);
1318 if (retval < 0)
1319 goto error_davinci;
1320#endif
1321
1322#ifdef SPEAR_PLATFORM_DRIVER
1323 retval = platform_driver_register(&SPEAR_PLATFORM_DRIVER);
1324 if (retval < 0)
1325 goto error_spear;
1326#endif
1327
1280 return retval; 1328 return retval;
1281 1329
1282 /* Error path */ 1330 /* Error path */
1331#ifdef SPEAR_PLATFORM_DRIVER
1332 platform_driver_unregister(&SPEAR_PLATFORM_DRIVER);
1333 error_spear:
1334#endif
1335#ifdef DAVINCI_PLATFORM_DRIVER
1336 platform_driver_unregister(&DAVINCI_PLATFORM_DRIVER);
1337 error_davinci:
1338#endif
1339#ifdef NXP_PLATFORM_DRIVER
1340 platform_driver_unregister(&NXP_PLATFORM_DRIVER);
1341 error_nxp:
1342#endif
1343#ifdef AT91_PLATFORM_DRIVER
1344 platform_driver_unregister(&AT91_PLATFORM_DRIVER);
1345 error_at91:
1346#endif
1347#ifdef EP93XX_PLATFORM_DRIVER
1348 platform_driver_unregister(&EP93XX_PLATFORM_DRIVER);
1349 error_ep93xx:
1350#endif
1351#ifdef EXYNOS_PLATFORM_DRIVER
1352 platform_driver_unregister(&EXYNOS_PLATFORM_DRIVER);
1353 error_exynos:
1354#endif
1355#ifdef S3C2410_PLATFORM_DRIVER
1356 platform_driver_unregister(&S3C2410_PLATFORM_DRIVER);
1357 error_s3c2410:
1358#endif
1283#ifdef TMIO_OHCI_DRIVER 1359#ifdef TMIO_OHCI_DRIVER
1284 platform_driver_unregister(&TMIO_OHCI_DRIVER); 1360 platform_driver_unregister(&TMIO_OHCI_DRIVER);
1285 error_tmio: 1361 error_tmio:
@@ -1300,17 +1376,17 @@ static int __init ohci_hcd_mod_init(void)
1300 platform_driver_unregister(&OF_PLATFORM_DRIVER); 1376 platform_driver_unregister(&OF_PLATFORM_DRIVER);
1301 error_of_platform: 1377 error_of_platform:
1302#endif 1378#endif
1303#ifdef PLATFORM_DRIVER 1379#ifdef OMAP3_PLATFORM_DRIVER
1304 platform_driver_unregister(&PLATFORM_DRIVER); 1380 platform_driver_unregister(&OMAP3_PLATFORM_DRIVER);
1305 error_platform: 1381 error_omap3_platform:
1306#endif 1382#endif
1307#ifdef OMAP1_PLATFORM_DRIVER 1383#ifdef OMAP1_PLATFORM_DRIVER
1308 platform_driver_unregister(&OMAP1_PLATFORM_DRIVER); 1384 platform_driver_unregister(&OMAP1_PLATFORM_DRIVER);
1309 error_omap1_platform: 1385 error_omap1_platform:
1310#endif 1386#endif
1311#ifdef OMAP3_PLATFORM_DRIVER 1387#ifdef PLATFORM_DRIVER
1312 platform_driver_unregister(&OMAP3_PLATFORM_DRIVER); 1388 platform_driver_unregister(&PLATFORM_DRIVER);
1313 error_omap3_platform: 1389 error_platform:
1314#endif 1390#endif
1315#ifdef PS3_SYSTEM_BUS_DRIVER 1391#ifdef PS3_SYSTEM_BUS_DRIVER
1316 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); 1392 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
@@ -1329,6 +1405,27 @@ module_init(ohci_hcd_mod_init);
1329 1405
1330static void __exit ohci_hcd_mod_exit(void) 1406static void __exit ohci_hcd_mod_exit(void)
1331{ 1407{
1408#ifdef SPEAR_PLATFORM_DRIVER
1409 platform_driver_unregister(&SPEAR_PLATFORM_DRIVER);
1410#endif
1411#ifdef DAVINCI_PLATFORM_DRIVER
1412 platform_driver_unregister(&DAVINCI_PLATFORM_DRIVER);
1413#endif
1414#ifdef NXP_PLATFORM_DRIVER
1415 platform_driver_unregister(&NXP_PLATFORM_DRIVER);
1416#endif
1417#ifdef AT91_PLATFORM_DRIVER
1418 platform_driver_unregister(&AT91_PLATFORM_DRIVER);
1419#endif
1420#ifdef EP93XX_PLATFORM_DRIVER
1421 platform_driver_unregister(&EP93XX_PLATFORM_DRIVER);
1422#endif
1423#ifdef EXYNOS_PLATFORM_DRIVER
1424 platform_driver_unregister(&EXYNOS_PLATFORM_DRIVER);
1425#endif
1426#ifdef S3C2410_PLATFORM_DRIVER
1427 platform_driver_unregister(&S3C2410_PLATFORM_DRIVER);
1428#endif
1332#ifdef TMIO_OHCI_DRIVER 1429#ifdef TMIO_OHCI_DRIVER
1333 platform_driver_unregister(&TMIO_OHCI_DRIVER); 1430 platform_driver_unregister(&TMIO_OHCI_DRIVER);
1334#endif 1431#endif
@@ -1344,12 +1441,15 @@ static void __exit ohci_hcd_mod_exit(void)
1344#ifdef OF_PLATFORM_DRIVER 1441#ifdef OF_PLATFORM_DRIVER
1345 platform_driver_unregister(&OF_PLATFORM_DRIVER); 1442 platform_driver_unregister(&OF_PLATFORM_DRIVER);
1346#endif 1443#endif
1347#ifdef PLATFORM_DRIVER
1348 platform_driver_unregister(&PLATFORM_DRIVER);
1349#endif
1350#ifdef OMAP3_PLATFORM_DRIVER 1444#ifdef OMAP3_PLATFORM_DRIVER
1351 platform_driver_unregister(&OMAP3_PLATFORM_DRIVER); 1445 platform_driver_unregister(&OMAP3_PLATFORM_DRIVER);
1352#endif 1446#endif
1447#ifdef OMAP1_PLATFORM_DRIVER
1448 platform_driver_unregister(&OMAP1_PLATFORM_DRIVER);
1449#endif
1450#ifdef PLATFORM_DRIVER
1451 platform_driver_unregister(&PLATFORM_DRIVER);
1452#endif
1353#ifdef PS3_SYSTEM_BUS_DRIVER 1453#ifdef PS3_SYSTEM_BUS_DRIVER
1354 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); 1454 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
1355#endif 1455#endif