Commit 9beeee65 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

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: default avatarAlan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org>  [2.6.27]
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2b70f073
...@@ -81,6 +81,10 @@ ...@@ -81,6 +81,10 @@
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* Keep track of which host controller drivers are loaded */
unsigned long usb_hcds_loaded;
EXPORT_SYMBOL_GPL(usb_hcds_loaded);
/* host controllers we manage */ /* host controllers we manage */
LIST_HEAD (usb_bus_list); LIST_HEAD (usb_bus_list);
EXPORT_SYMBOL_GPL (usb_bus_list); EXPORT_SYMBOL_GPL (usb_bus_list);
......
...@@ -482,4 +482,10 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb, ...@@ -482,4 +482,10 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
*/ */
extern struct rw_semaphore ehci_cf_port_reset_rwsem; extern struct rw_semaphore ehci_cf_port_reset_rwsem;
/* Keep track of which host controller drivers are loaded */
#define USB_UHCI_LOADED 0
#define USB_OHCI_LOADED 1
#define USB_EHCI_LOADED 2
extern unsigned long usb_hcds_loaded;
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
...@@ -1046,6 +1046,12 @@ static int __init ehci_hcd_init(void) ...@@ -1046,6 +1046,12 @@ static int __init ehci_hcd_init(void)
return -ENODEV; return -ENODEV;
printk(KERN_INFO "%s: " DRIVER_DESC "\n", hcd_name); printk(KERN_INFO "%s: " DRIVER_DESC "\n", hcd_name);
set_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
if (test_bit(USB_UHCI_LOADED, &usb_hcds_loaded) ||
test_bit(USB_OHCI_LOADED, &usb_hcds_loaded))
printk(KERN_WARNING "Warning! ehci_hcd should always be loaded"
" before uhci_hcd and ohci_hcd, not after\n");
pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n",
hcd_name, hcd_name,
sizeof(struct ehci_qh), sizeof(struct ehci_qtd), sizeof(struct ehci_qh), sizeof(struct ehci_qtd),
...@@ -1053,8 +1059,10 @@ static int __init ehci_hcd_init(void) ...@@ -1053,8 +1059,10 @@ static int __init ehci_hcd_init(void)
#ifdef DEBUG #ifdef DEBUG
ehci_debug_root = debugfs_create_dir("ehci", NULL); ehci_debug_root = debugfs_create_dir("ehci", NULL);
if (!ehci_debug_root) if (!ehci_debug_root) {
return -ENOENT; retval = -ENOENT;
goto err_debug;
}
#endif #endif
#ifdef PLATFORM_DRIVER #ifdef PLATFORM_DRIVER
...@@ -1102,6 +1110,8 @@ clean0: ...@@ -1102,6 +1110,8 @@ clean0:
debugfs_remove(ehci_debug_root); debugfs_remove(ehci_debug_root);
ehci_debug_root = NULL; ehci_debug_root = NULL;
#endif #endif
err_debug:
clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
return retval; return retval;
} }
module_init(ehci_hcd_init); module_init(ehci_hcd_init);
...@@ -1123,6 +1133,7 @@ static void __exit ehci_hcd_cleanup(void) ...@@ -1123,6 +1133,7 @@ static void __exit ehci_hcd_cleanup(void)
#ifdef DEBUG #ifdef DEBUG
debugfs_remove(ehci_debug_root); debugfs_remove(ehci_debug_root);
#endif #endif
clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
} }
module_exit(ehci_hcd_cleanup); module_exit(ehci_hcd_cleanup);
...@@ -1095,6 +1095,7 @@ static int __init ohci_hcd_mod_init(void) ...@@ -1095,6 +1095,7 @@ static int __init ohci_hcd_mod_init(void)
printk(KERN_INFO "%s: " DRIVER_DESC "\n", hcd_name); printk(KERN_INFO "%s: " DRIVER_DESC "\n", hcd_name);
pr_debug ("%s: block sizes: ed %Zd td %Zd\n", hcd_name, pr_debug ("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
sizeof (struct ed), sizeof (struct td)); sizeof (struct ed), sizeof (struct td));
set_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
#ifdef DEBUG #ifdef DEBUG
ohci_debug_root = debugfs_create_dir("ohci", NULL); ohci_debug_root = debugfs_create_dir("ohci", NULL);
...@@ -1181,6 +1182,7 @@ static int __init ohci_hcd_mod_init(void) ...@@ -1181,6 +1182,7 @@ static int __init ohci_hcd_mod_init(void)
error_debug: error_debug:
#endif #endif
clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
return retval; return retval;
} }
module_init(ohci_hcd_mod_init); module_init(ohci_hcd_mod_init);
...@@ -1211,6 +1213,7 @@ static void __exit ohci_hcd_mod_exit(void) ...@@ -1211,6 +1213,7 @@ static void __exit ohci_hcd_mod_exit(void)
#ifdef DEBUG #ifdef DEBUG
debugfs_remove(ohci_debug_root); debugfs_remove(ohci_debug_root);
#endif #endif
clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
} }
module_exit(ohci_hcd_mod_exit); module_exit(ohci_hcd_mod_exit);
...@@ -955,6 +955,7 @@ static int __init uhci_hcd_init(void) ...@@ -955,6 +955,7 @@ static int __init uhci_hcd_init(void)
printk(KERN_INFO "uhci_hcd: " DRIVER_DESC "%s\n", printk(KERN_INFO "uhci_hcd: " DRIVER_DESC "%s\n",
ignore_oc ? ", overcurrent ignored" : ""); ignore_oc ? ", overcurrent ignored" : "");
set_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
if (DEBUG_CONFIGURED) { if (DEBUG_CONFIGURED) {
errbuf = kmalloc(ERRBUF_LEN, GFP_KERNEL); errbuf = kmalloc(ERRBUF_LEN, GFP_KERNEL);
...@@ -987,6 +988,7 @@ debug_failed: ...@@ -987,6 +988,7 @@ debug_failed:
errbuf_failed: errbuf_failed:
clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
return retval; return retval;
} }
...@@ -996,6 +998,7 @@ static void __exit uhci_hcd_cleanup(void) ...@@ -996,6 +998,7 @@ static void __exit uhci_hcd_cleanup(void)
kmem_cache_destroy(uhci_up_cachep); kmem_cache_destroy(uhci_up_cachep);
debugfs_remove(uhci_debugfs_root); debugfs_remove(uhci_debugfs_root);
kfree(errbuf); kfree(errbuf);
clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
} }
module_init(uhci_hcd_init); module_init(uhci_hcd_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment