diff options
Diffstat (limited to 'drivers/usb/host/uhci-hcd.c')
-rw-r--r-- | drivers/usb/host/uhci-hcd.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 4a86b63745b8..27f35e8f161b 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -69,18 +69,21 @@ MODULE_PARM_DESC(ignore_oc, "ignore hardware overcurrent indications"); | |||
69 | * show all queues in /sys/kernel/debug/uhci/[pci_addr] | 69 | * show all queues in /sys/kernel/debug/uhci/[pci_addr] |
70 | * debug = 3, show all TDs in URBs when dumping | 70 | * debug = 3, show all TDs in URBs when dumping |
71 | */ | 71 | */ |
72 | #ifdef DEBUG | 72 | #ifdef CONFIG_DYNAMIC_DEBUG |
73 | #define DEBUG_CONFIGURED 1 | 73 | |
74 | static int debug = 1; | 74 | static int debug = 1; |
75 | module_param(debug, int, S_IRUGO | S_IWUSR); | 75 | module_param(debug, int, S_IRUGO | S_IWUSR); |
76 | MODULE_PARM_DESC(debug, "Debug level"); | 76 | MODULE_PARM_DESC(debug, "Debug level"); |
77 | static char *errbuf; | ||
77 | 78 | ||
78 | #else | 79 | #else |
79 | #define DEBUG_CONFIGURED 0 | 80 | |
80 | #define debug 0 | 81 | #define debug 0 |
82 | #define errbuf NULL | ||
83 | |||
81 | #endif | 84 | #endif |
82 | 85 | ||
83 | static char *errbuf; | 86 | |
84 | #define ERRBUF_LEN (32 * 1024) | 87 | #define ERRBUF_LEN (32 * 1024) |
85 | 88 | ||
86 | static struct kmem_cache *uhci_up_cachep; /* urb_priv */ | 89 | static struct kmem_cache *uhci_up_cachep; /* urb_priv */ |
@@ -516,13 +519,12 @@ static void release_uhci(struct uhci_hcd *uhci) | |||
516 | { | 519 | { |
517 | int i; | 520 | int i; |
518 | 521 | ||
519 | if (DEBUG_CONFIGURED) { | ||
520 | spin_lock_irq(&uhci->lock); | ||
521 | uhci->is_initialized = 0; | ||
522 | spin_unlock_irq(&uhci->lock); | ||
523 | 522 | ||
524 | debugfs_remove(uhci->dentry); | 523 | spin_lock_irq(&uhci->lock); |
525 | } | 524 | uhci->is_initialized = 0; |
525 | spin_unlock_irq(&uhci->lock); | ||
526 | |||
527 | debugfs_remove(uhci->dentry); | ||
526 | 528 | ||
527 | for (i = 0; i < UHCI_NUM_SKELQH; i++) | 529 | for (i = 0; i < UHCI_NUM_SKELQH; i++) |
528 | uhci_free_qh(uhci, uhci->skelqh[i]); | 530 | uhci_free_qh(uhci, uhci->skelqh[i]); |
@@ -868,14 +870,14 @@ static int __init uhci_hcd_init(void) | |||
868 | ignore_oc ? ", overcurrent ignored" : ""); | 870 | ignore_oc ? ", overcurrent ignored" : ""); |
869 | set_bit(USB_UHCI_LOADED, &usb_hcds_loaded); | 871 | set_bit(USB_UHCI_LOADED, &usb_hcds_loaded); |
870 | 872 | ||
871 | if (DEBUG_CONFIGURED) { | 873 | #ifdef CONFIG_DYNAMIC_DEBUG |
872 | errbuf = kmalloc(ERRBUF_LEN, GFP_KERNEL); | 874 | errbuf = kmalloc(ERRBUF_LEN, GFP_KERNEL); |
873 | if (!errbuf) | 875 | if (!errbuf) |
874 | goto errbuf_failed; | 876 | goto errbuf_failed; |
875 | uhci_debugfs_root = debugfs_create_dir("uhci", usb_debug_root); | 877 | uhci_debugfs_root = debugfs_create_dir("uhci", usb_debug_root); |
876 | if (!uhci_debugfs_root) | 878 | if (!uhci_debugfs_root) |
877 | goto debug_failed; | 879 | goto debug_failed; |
878 | } | 880 | #endif |
879 | 881 | ||
880 | uhci_up_cachep = kmem_cache_create("uhci_urb_priv", | 882 | uhci_up_cachep = kmem_cache_create("uhci_urb_priv", |
881 | sizeof(struct urb_priv), 0, 0, NULL); | 883 | sizeof(struct urb_priv), 0, 0, NULL); |
@@ -906,12 +908,14 @@ clean0: | |||
906 | kmem_cache_destroy(uhci_up_cachep); | 908 | kmem_cache_destroy(uhci_up_cachep); |
907 | 909 | ||
908 | up_failed: | 910 | up_failed: |
911 | #if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG) | ||
909 | debugfs_remove(uhci_debugfs_root); | 912 | debugfs_remove(uhci_debugfs_root); |
910 | 913 | ||
911 | debug_failed: | 914 | debug_failed: |
912 | kfree(errbuf); | 915 | kfree(errbuf); |
913 | 916 | ||
914 | errbuf_failed: | 917 | errbuf_failed: |
918 | #endif | ||
915 | 919 | ||
916 | clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded); | 920 | clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded); |
917 | return retval; | 921 | return retval; |
@@ -927,7 +931,9 @@ static void __exit uhci_hcd_cleanup(void) | |||
927 | #endif | 931 | #endif |
928 | kmem_cache_destroy(uhci_up_cachep); | 932 | kmem_cache_destroy(uhci_up_cachep); |
929 | debugfs_remove(uhci_debugfs_root); | 933 | debugfs_remove(uhci_debugfs_root); |
934 | #ifdef CONFIG_DYNAMIC_DEBUG | ||
930 | kfree(errbuf); | 935 | kfree(errbuf); |
936 | #endif | ||
931 | clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded); | 937 | clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded); |
932 | } | 938 | } |
933 | 939 | ||