diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2006-04-11 11:07:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 18:04:09 -0400 |
commit | 01cced250722d22d99c2342979490f93ca886521 (patch) | |
tree | b29b395305836a0f3690a69173e1df2a2f0ecf4f /drivers | |
parent | df47e5330b0f5decb0a5736e9a81fff49d46d151 (diff) |
[PATCH] USB: allow multiple types of EHCI controllers to be built as modules
In some systems we may have both a platform EHCI controller and PCI EHCI
controller. Previously we couldn't build the EHCI support as a module due
to conflicting module_init() calls in the code.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/ehci-au1xxx.c | 17 | ||||
-rw-r--r-- | drivers/usb/host/ehci-fsl.c | 37 | ||||
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 48 | ||||
-rw-r--r-- | drivers/usb/host/ehci-pci.c | 20 |
4 files changed, 49 insertions, 73 deletions
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index 63eadeec1324..0e444ab1930d 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -272,6 +272,8 @@ static int ehci_hcd_au1xxx_drv_resume(struct device *dev) | |||
272 | return 0; | 272 | return 0; |
273 | } | 273 | } |
274 | */ | 274 | */ |
275 | MODULE_ALIAS("au1xxx-ehci"); | ||
276 | /* FIXME use "struct platform_driver" */ | ||
275 | static struct device_driver ehci_hcd_au1xxx_driver = { | 277 | static struct device_driver ehci_hcd_au1xxx_driver = { |
276 | .name = "au1xxx-ehci", | 278 | .name = "au1xxx-ehci", |
277 | .bus = &platform_bus_type, | 279 | .bus = &platform_bus_type, |
@@ -280,18 +282,3 @@ static struct device_driver ehci_hcd_au1xxx_driver = { | |||
280 | /*.suspend = ehci_hcd_au1xxx_drv_suspend, */ | 282 | /*.suspend = ehci_hcd_au1xxx_drv_suspend, */ |
281 | /*.resume = ehci_hcd_au1xxx_drv_resume, */ | 283 | /*.resume = ehci_hcd_au1xxx_drv_resume, */ |
282 | }; | 284 | }; |
283 | |||
284 | static int __init ehci_hcd_au1xxx_init(void) | ||
285 | { | ||
286 | pr_debug(DRIVER_INFO " (Au1xxx)\n"); | ||
287 | |||
288 | return driver_register(&ehci_hcd_au1xxx_driver); | ||
289 | } | ||
290 | |||
291 | static void __exit ehci_hcd_au1xxx_cleanup(void) | ||
292 | { | ||
293 | driver_unregister(&ehci_hcd_au1xxx_driver); | ||
294 | } | ||
295 | |||
296 | module_init(ehci_hcd_au1xxx_init); | ||
297 | module_exit(ehci_hcd_au1xxx_cleanup); | ||
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index f985f121a245..a49a689bf423 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -324,43 +324,12 @@ static int ehci_fsl_drv_remove(struct platform_device *pdev) | |||
324 | return 0; | 324 | return 0; |
325 | } | 325 | } |
326 | 326 | ||
327 | static struct platform_driver ehci_fsl_dr_driver = { | 327 | MODULE_ALIAS("fsl-ehci"); |
328 | .probe = ehci_fsl_drv_probe, | ||
329 | .remove = ehci_fsl_drv_remove, | ||
330 | .driver = { | ||
331 | .name = "fsl-usb2-dr", | ||
332 | }, | ||
333 | }; | ||
334 | 328 | ||
335 | static struct platform_driver ehci_fsl_mph_driver = { | 329 | static struct platform_driver ehci_fsl_driver = { |
336 | .probe = ehci_fsl_drv_probe, | 330 | .probe = ehci_fsl_drv_probe, |
337 | .remove = ehci_fsl_drv_remove, | 331 | .remove = ehci_fsl_drv_remove, |
338 | .driver = { | 332 | .driver = { |
339 | .name = "fsl-usb2-mph", | 333 | .name = "fsl-ehci", |
340 | }, | 334 | }, |
341 | }; | 335 | }; |
342 | |||
343 | static int __init ehci_fsl_init(void) | ||
344 | { | ||
345 | int retval; | ||
346 | |||
347 | pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", | ||
348 | hcd_name, | ||
349 | sizeof(struct ehci_qh), sizeof(struct ehci_qtd), | ||
350 | sizeof(struct ehci_itd), sizeof(struct ehci_sitd)); | ||
351 | |||
352 | retval = platform_driver_register(&ehci_fsl_dr_driver); | ||
353 | if (retval) | ||
354 | return retval; | ||
355 | |||
356 | return platform_driver_register(&ehci_fsl_mph_driver); | ||
357 | } | ||
358 | |||
359 | static void __exit ehci_fsl_cleanup(void) | ||
360 | { | ||
361 | platform_driver_unregister(&ehci_fsl_mph_driver); | ||
362 | platform_driver_unregister(&ehci_fsl_dr_driver); | ||
363 | } | ||
364 | |||
365 | module_init(ehci_fsl_init); | ||
366 | module_exit(ehci_fsl_cleanup); | ||
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 79f2d8b9bfb6..7d7c97cf9b2f 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -889,19 +889,59 @@ MODULE_LICENSE ("GPL"); | |||
889 | 889 | ||
890 | #ifdef CONFIG_PCI | 890 | #ifdef CONFIG_PCI |
891 | #include "ehci-pci.c" | 891 | #include "ehci-pci.c" |
892 | #define EHCI_BUS_GLUED | 892 | #define PCI_DRIVER ehci_pci_driver |
893 | #endif | 893 | #endif |
894 | 894 | ||
895 | #ifdef CONFIG_PPC_83xx | 895 | #ifdef CONFIG_PPC_83xx |
896 | #include "ehci-fsl.c" | 896 | #include "ehci-fsl.c" |
897 | #define EHCI_BUS_GLUED | 897 | #define PLATFORM_DRIVER ehci_fsl_driver |
898 | #endif | 898 | #endif |
899 | 899 | ||
900 | #ifdef CONFIG_SOC_AU1X00 | 900 | #ifdef CONFIG_SOC_AU1X00 |
901 | #include "ehci-au1xxx.c" | 901 | #include "ehci-au1xxx.c" |
902 | #define EHCI_BUS_GLUED | 902 | #define PLATFORM_DRIVER ehci_hcd_au1xxx_driver |
903 | #endif | 903 | #endif |
904 | 904 | ||
905 | #ifndef EHCI_BUS_GLUED | 905 | #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) |
906 | #error "missing bus glue for ehci-hcd" | 906 | #error "missing bus glue for ehci-hcd" |
907 | #endif | 907 | #endif |
908 | |||
909 | static int __init ehci_hcd_init(void) | ||
910 | { | ||
911 | int retval = 0; | ||
912 | |||
913 | pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", | ||
914 | hcd_name, | ||
915 | sizeof(struct ehci_qh), sizeof(struct ehci_qtd), | ||
916 | sizeof(struct ehci_itd), sizeof(struct ehci_sitd)); | ||
917 | |||
918 | #ifdef PLATFORM_DRIVER | ||
919 | retval = platform_driver_register(&PLATFORM_DRIVER); | ||
920 | if (retval < 0) | ||
921 | return retval; | ||
922 | #endif | ||
923 | |||
924 | #ifdef PCI_DRIVER | ||
925 | retval = pci_register_driver(&PCI_DRIVER); | ||
926 | if (retval < 0) { | ||
927 | #ifdef PLATFORM_DRIVER | ||
928 | platform_driver_unregister(&PLATFORM_DRIVER); | ||
929 | #endif | ||
930 | } | ||
931 | #endif | ||
932 | |||
933 | return retval; | ||
934 | } | ||
935 | module_init(ehci_hcd_init); | ||
936 | |||
937 | static void __exit ehci_hcd_cleanup(void) | ||
938 | { | ||
939 | #ifdef PLATFORM_DRIVER | ||
940 | platform_driver_unregister(&PLATFORM_DRIVER); | ||
941 | #endif | ||
942 | #ifdef PCI_DRIVER | ||
943 | pci_unregister_driver(&PCI_DRIVER); | ||
944 | #endif | ||
945 | } | ||
946 | module_exit(ehci_hcd_cleanup); | ||
947 | |||
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 648ddb52d579..cadffacd945b 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -379,23 +379,3 @@ static struct pci_driver ehci_pci_driver = { | |||
379 | .resume = usb_hcd_pci_resume, | 379 | .resume = usb_hcd_pci_resume, |
380 | #endif | 380 | #endif |
381 | }; | 381 | }; |
382 | |||
383 | static int __init ehci_hcd_pci_init(void) | ||
384 | { | ||
385 | if (usb_disabled()) | ||
386 | return -ENODEV; | ||
387 | |||
388 | pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", | ||
389 | hcd_name, | ||
390 | sizeof(struct ehci_qh), sizeof(struct ehci_qtd), | ||
391 | sizeof(struct ehci_itd), sizeof(struct ehci_sitd)); | ||
392 | |||
393 | return pci_register_driver(&ehci_pci_driver); | ||
394 | } | ||
395 | module_init(ehci_hcd_pci_init); | ||
396 | |||
397 | static void __exit ehci_hcd_pci_cleanup(void) | ||
398 | { | ||
399 | pci_unregister_driver(&ehci_pci_driver); | ||
400 | } | ||
401 | module_exit(ehci_hcd_pci_cleanup); | ||