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/usb/host/ehci-hcd.c | |
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/usb/host/ehci-hcd.c')
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 48 |
1 files changed, 44 insertions, 4 deletions
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 | |||