diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2008-10-02 11:48:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-10-17 17:41:03 -0400 |
commit | 9beeee6584b9aa4f9192055512411484a2a624df (patch) | |
tree | 6eec55264d86791a1d4f61bdb9158cf9c720f7ce /drivers/usb | |
parent | 2b70f07343389cb474235def00b021a645ede916 (diff) |
USB: EHCI: log a warning if ehci-hcd is not loaded first
This patch (as1139) adds a warning to the system log whenever ehci-hcd
is loaded after ohci-hcd or uhci-hcd. Nowadays most distributions are
pretty good about not doing this; maybe the warning will help convince
anyone still doing it wrong.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org> [2.6.27]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/hcd.c | 4 | ||||
-rw-r--r-- | drivers/usb/core/hcd.h | 6 | ||||
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 15 | ||||
-rw-r--r-- | drivers/usb/host/ohci-hcd.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/uhci-hcd.c | 3 |
5 files changed, 29 insertions, 2 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index c8035a8216bd..fc9018e72a09 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -81,6 +81,10 @@ | |||
81 | 81 | ||
82 | /*-------------------------------------------------------------------------*/ | 82 | /*-------------------------------------------------------------------------*/ |
83 | 83 | ||
84 | /* Keep track of which host controller drivers are loaded */ | ||
85 | unsigned long usb_hcds_loaded; | ||
86 | EXPORT_SYMBOL_GPL(usb_hcds_loaded); | ||
87 | |||
84 | /* host controllers we manage */ | 88 | /* host controllers we manage */ |
85 | LIST_HEAD (usb_bus_list); | 89 | LIST_HEAD (usb_bus_list); |
86 | EXPORT_SYMBOL_GPL (usb_bus_list); | 90 | EXPORT_SYMBOL_GPL (usb_bus_list); |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index e710ce04e228..2dcde61c465e 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -482,4 +482,10 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb, | |||
482 | */ | 482 | */ |
483 | extern struct rw_semaphore ehci_cf_port_reset_rwsem; | 483 | extern struct rw_semaphore ehci_cf_port_reset_rwsem; |
484 | 484 | ||
485 | /* Keep track of which host controller drivers are loaded */ | ||
486 | #define USB_UHCI_LOADED 0 | ||
487 | #define USB_OHCI_LOADED 1 | ||
488 | #define USB_EHCI_LOADED 2 | ||
489 | extern unsigned long usb_hcds_loaded; | ||
490 | |||
485 | #endif /* __KERNEL__ */ | 491 | #endif /* __KERNEL__ */ |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index fcbc1f2b2377..358df2a6c396 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -1046,6 +1046,12 @@ static int __init ehci_hcd_init(void) | |||
1046 | return -ENODEV; | 1046 | return -ENODEV; |
1047 | 1047 | ||
1048 | printk(KERN_INFO "%s: " DRIVER_DESC "\n", hcd_name); | 1048 | printk(KERN_INFO "%s: " DRIVER_DESC "\n", hcd_name); |
1049 | set_bit(USB_EHCI_LOADED, &usb_hcds_loaded); | ||
1050 | if (test_bit(USB_UHCI_LOADED, &usb_hcds_loaded) || | ||
1051 | test_bit(USB_OHCI_LOADED, &usb_hcds_loaded)) | ||
1052 | printk(KERN_WARNING "Warning! ehci_hcd should always be loaded" | ||
1053 | " before uhci_hcd and ohci_hcd, not after\n"); | ||
1054 | |||
1049 | pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", | 1055 | pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", |
1050 | hcd_name, | 1056 | hcd_name, |
1051 | sizeof(struct ehci_qh), sizeof(struct ehci_qtd), | 1057 | sizeof(struct ehci_qh), sizeof(struct ehci_qtd), |
@@ -1053,8 +1059,10 @@ static int __init ehci_hcd_init(void) | |||
1053 | 1059 | ||
1054 | #ifdef DEBUG | 1060 | #ifdef DEBUG |
1055 | ehci_debug_root = debugfs_create_dir("ehci", NULL); | 1061 | ehci_debug_root = debugfs_create_dir("ehci", NULL); |
1056 | if (!ehci_debug_root) | 1062 | if (!ehci_debug_root) { |
1057 | return -ENOENT; | 1063 | retval = -ENOENT; |
1064 | goto err_debug; | ||
1065 | } | ||
1058 | #endif | 1066 | #endif |
1059 | 1067 | ||
1060 | #ifdef PLATFORM_DRIVER | 1068 | #ifdef PLATFORM_DRIVER |
@@ -1102,6 +1110,8 @@ clean0: | |||
1102 | debugfs_remove(ehci_debug_root); | 1110 | debugfs_remove(ehci_debug_root); |
1103 | ehci_debug_root = NULL; | 1111 | ehci_debug_root = NULL; |
1104 | #endif | 1112 | #endif |
1113 | err_debug: | ||
1114 | clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded); | ||
1105 | return retval; | 1115 | return retval; |
1106 | } | 1116 | } |
1107 | module_init(ehci_hcd_init); | 1117 | module_init(ehci_hcd_init); |
@@ -1123,6 +1133,7 @@ static void __exit ehci_hcd_cleanup(void) | |||
1123 | #ifdef DEBUG | 1133 | #ifdef DEBUG |
1124 | debugfs_remove(ehci_debug_root); | 1134 | debugfs_remove(ehci_debug_root); |
1125 | #endif | 1135 | #endif |
1136 | clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded); | ||
1126 | } | 1137 | } |
1127 | module_exit(ehci_hcd_cleanup); | 1138 | module_exit(ehci_hcd_cleanup); |
1128 | 1139 | ||
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 0afeda836df3..8647dab0d7f9 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -1095,6 +1095,7 @@ static int __init ohci_hcd_mod_init(void) | |||
1095 | printk(KERN_INFO "%s: " DRIVER_DESC "\n", hcd_name); | 1095 | printk(KERN_INFO "%s: " DRIVER_DESC "\n", hcd_name); |
1096 | pr_debug ("%s: block sizes: ed %Zd td %Zd\n", hcd_name, | 1096 | pr_debug ("%s: block sizes: ed %Zd td %Zd\n", hcd_name, |
1097 | sizeof (struct ed), sizeof (struct td)); | 1097 | sizeof (struct ed), sizeof (struct td)); |
1098 | set_bit(USB_OHCI_LOADED, &usb_hcds_loaded); | ||
1098 | 1099 | ||
1099 | #ifdef DEBUG | 1100 | #ifdef DEBUG |
1100 | ohci_debug_root = debugfs_create_dir("ohci", NULL); | 1101 | ohci_debug_root = debugfs_create_dir("ohci", NULL); |
@@ -1181,6 +1182,7 @@ static int __init ohci_hcd_mod_init(void) | |||
1181 | error_debug: | 1182 | error_debug: |
1182 | #endif | 1183 | #endif |
1183 | 1184 | ||
1185 | clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded); | ||
1184 | return retval; | 1186 | return retval; |
1185 | } | 1187 | } |
1186 | module_init(ohci_hcd_mod_init); | 1188 | module_init(ohci_hcd_mod_init); |
@@ -1211,6 +1213,7 @@ static void __exit ohci_hcd_mod_exit(void) | |||
1211 | #ifdef DEBUG | 1213 | #ifdef DEBUG |
1212 | debugfs_remove(ohci_debug_root); | 1214 | debugfs_remove(ohci_debug_root); |
1213 | #endif | 1215 | #endif |
1216 | clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded); | ||
1214 | } | 1217 | } |
1215 | module_exit(ohci_hcd_mod_exit); | 1218 | module_exit(ohci_hcd_mod_exit); |
1216 | 1219 | ||
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 2dddb258b0db..cf5e4cf7ea42 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -955,6 +955,7 @@ static int __init uhci_hcd_init(void) | |||
955 | 955 | ||
956 | printk(KERN_INFO "uhci_hcd: " DRIVER_DESC "%s\n", | 956 | printk(KERN_INFO "uhci_hcd: " DRIVER_DESC "%s\n", |
957 | ignore_oc ? ", overcurrent ignored" : ""); | 957 | ignore_oc ? ", overcurrent ignored" : ""); |
958 | set_bit(USB_UHCI_LOADED, &usb_hcds_loaded); | ||
958 | 959 | ||
959 | if (DEBUG_CONFIGURED) { | 960 | if (DEBUG_CONFIGURED) { |
960 | errbuf = kmalloc(ERRBUF_LEN, GFP_KERNEL); | 961 | errbuf = kmalloc(ERRBUF_LEN, GFP_KERNEL); |
@@ -987,6 +988,7 @@ debug_failed: | |||
987 | 988 | ||
988 | errbuf_failed: | 989 | errbuf_failed: |
989 | 990 | ||
991 | clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded); | ||
990 | return retval; | 992 | return retval; |
991 | } | 993 | } |
992 | 994 | ||
@@ -996,6 +998,7 @@ static void __exit uhci_hcd_cleanup(void) | |||
996 | kmem_cache_destroy(uhci_up_cachep); | 998 | kmem_cache_destroy(uhci_up_cachep); |
997 | debugfs_remove(uhci_debugfs_root); | 999 | debugfs_remove(uhci_debugfs_root); |
998 | kfree(errbuf); | 1000 | kfree(errbuf); |
1001 | clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded); | ||
999 | } | 1002 | } |
1000 | 1003 | ||
1001 | module_init(uhci_hcd_init); | 1004 | module_init(uhci_hcd_init); |