uhci: change dependency for debug parameter
authorOliver Neukum <oneukum@suse.de>
Mon, 18 Nov 2013 12:23:09 +0000 (13:23 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Dec 2013 18:31:20 +0000 (10:31 -0800)
To allow a full switch to dynamic debugging make the
debug parameter conditional on defined(DEBUF) || defined(CONFIG_DYNAMIC_DEBUG)

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/uhci-hcd.c

index 4a86b63745b8723de5fccd06f1c9aac2218c5241..d9d3c5a98d8325833f08df4ca3c2da6a4cfe65d7 100644 (file)
@@ -69,18 +69,21 @@ MODULE_PARM_DESC(ignore_oc, "ignore hardware overcurrent indications");
  *            show all queues in /sys/kernel/debug/uhci/[pci_addr]
  * debug = 3, show all TDs in URBs when dumping
  */
-#ifdef DEBUG
-#define DEBUG_CONFIGURED       1
+#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
+
 static int debug = 1;
 module_param(debug, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Debug level");
+static char *errbuf;
 
 #else
-#define DEBUG_CONFIGURED       0
-#define debug                  0
+
+#define debug 0
+#define errbuf NULL
+
 #endif
 
-static char *errbuf;
+
 #define ERRBUF_LEN    (32 * 1024)
 
 static struct kmem_cache *uhci_up_cachep;      /* urb_priv */
@@ -516,13 +519,12 @@ static void release_uhci(struct uhci_hcd *uhci)
 {
        int i;
 
-       if (DEBUG_CONFIGURED) {
-               spin_lock_irq(&uhci->lock);
-               uhci->is_initialized = 0;
-               spin_unlock_irq(&uhci->lock);
 
-               debugfs_remove(uhci->dentry);
-       }
+       spin_lock_irq(&uhci->lock);
+       uhci->is_initialized = 0;
+       spin_unlock_irq(&uhci->lock);
+
+       debugfs_remove(uhci->dentry);
 
        for (i = 0; i < UHCI_NUM_SKELQH; i++)
                uhci_free_qh(uhci, uhci->skelqh[i]);
@@ -868,14 +870,14 @@ static int __init uhci_hcd_init(void)
                        ignore_oc ? ", overcurrent ignored" : "");
        set_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
 
-       if (DEBUG_CONFIGURED) {
-               errbuf = kmalloc(ERRBUF_LEN, GFP_KERNEL);
-               if (!errbuf)
-                       goto errbuf_failed;
-               uhci_debugfs_root = debugfs_create_dir("uhci", usb_debug_root);
-               if (!uhci_debugfs_root)
-                       goto debug_failed;
-       }
+#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
+       errbuf = kmalloc(ERRBUF_LEN, GFP_KERNEL);
+       if (!errbuf)
+               goto errbuf_failed;
+       uhci_debugfs_root = debugfs_create_dir("uhci", usb_debug_root);
+       if (!uhci_debugfs_root)
+               goto debug_failed;
+#endif
 
        uhci_up_cachep = kmem_cache_create("uhci_urb_priv",
                sizeof(struct urb_priv), 0, 0, NULL);
@@ -906,12 +908,14 @@ clean0:
        kmem_cache_destroy(uhci_up_cachep);
 
 up_failed:
+#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
        debugfs_remove(uhci_debugfs_root);
 
 debug_failed:
        kfree(errbuf);
 
 errbuf_failed:
+#endif
 
        clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
        return retval;
@@ -927,7 +931,9 @@ static void __exit uhci_hcd_cleanup(void)
 #endif
        kmem_cache_destroy(uhci_up_cachep);
        debugfs_remove(uhci_debugfs_root);
+#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
        kfree(errbuf);
+#endif
        clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
 }