[PATCH] USB: move CONFIG_USB_DEBUG checks into the Makefile
authorGreg Kroah-Hartman <gregkh@suse.de>
Thu, 17 Nov 2005 17:48:09 +0000 (09:48 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 17 Nov 2005 19:29:55 +0000 (11:29 -0800)
This lets us remove a lot of code in the drivers that were all checking
the same thing.  It also found some bugs in a few of the drivers, which
has been fixed up.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
38 files changed:
drivers/usb/atm/Makefile
drivers/usb/atm/usbatm.h
drivers/usb/core/Makefile
drivers/usb/core/buffer.c
drivers/usb/core/config.c
drivers/usb/core/file.c
drivers/usb/core/hcd-pci.c
drivers/usb/core/hcd.c
drivers/usb/core/hub.c
drivers/usb/core/message.c
drivers/usb/core/notify.c
drivers/usb/core/sysfs.c
drivers/usb/core/urb.c
drivers/usb/core/usb.c
drivers/usb/input/Makefile
drivers/usb/input/itmtouch.c
drivers/usb/input/keyspan_remote.c
drivers/usb/input/mtouchusb.c
drivers/usb/input/pid.c
drivers/usb/input/touchkitusb.c
drivers/usb/misc/Makefile
drivers/usb/misc/auerswald.c
drivers/usb/misc/phidgetservo.c
drivers/usb/misc/rio500.c
drivers/usb/misc/usbled.c
drivers/usb/misc/usbtest.c
drivers/usb/misc/uss720.c
drivers/usb/net/Makefile
drivers/usb/net/asix.c
drivers/usb/net/cdc_ether.c
drivers/usb/net/cdc_subset.c
drivers/usb/net/gl620a.c
drivers/usb/net/net1080.c
drivers/usb/net/pegasus.c
drivers/usb/net/plusb.c
drivers/usb/net/rndis_host.c
drivers/usb/net/usbnet.c
drivers/usb/net/zaurus.c

index 751f297..8509971 100644 (file)
@@ -6,3 +6,7 @@ obj-$(CONFIG_USB_CXACRU)        += cxacru.o
 obj-$(CONFIG_USB_SPEEDTOUCH)   += speedtch.o
 obj-$(CONFIG_USB_ATM)          += usbatm.o
 obj-$(CONFIG_USB_XUSBATM)      += xusbatm.o
+
+ifeq ($(CONFIG_USB_DEBUG),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
index 9366464..1adacd6 100644 (file)
 #include <linux/config.h>
 
 /*
-#define DEBUG
 #define VERBOSE_DEBUG
 */
 
-#if !defined (DEBUG) && defined (CONFIG_USB_DEBUG)
-#      define DEBUG
-#endif
-
 #include <asm/semaphore.h>
 #include <linux/atm.h>
 #include <linux/atmdev.h>
index dd1c4d2..86d5c38 100644 (file)
@@ -14,3 +14,7 @@ ifeq ($(CONFIG_USB_DEVICEFS),y)
 endif
 
 obj-$(CONFIG_USB)      += usbcore.o
+
+ifeq ($(CONFIG_USB_DEBUG),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
index 57e800a..419c994 100644 (file)
 #include <asm/scatterlist.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmapool.h>
-
-
-#ifdef CONFIG_USB_DEBUG
-       #define DEBUG
-#else
-       #undef DEBUG
-#endif
-
 #include <linux/usb.h>
 #include "hcd.h"
 
index 9930195..a9d89c7 100644 (file)
@@ -1,9 +1,4 @@
 #include <linux/config.h>
-
-#ifdef CONFIG_USB_DEBUG
-#define DEBUG
-#endif
-
 #include <linux/usb.h>
 #include <linux/module.h>
 #include <linux/init.h>
index e695308..37b1336 100644 (file)
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <linux/errno.h>
-
-#ifdef CONFIG_USB_DEBUG
-       #define DEBUG
-#else
-       #undef DEBUG
-#endif
 #include <linux/usb.h>
 
 #include "usb.h"
index 84d9e69..7feb829 100644 (file)
  */
 
 #include <linux/config.h>
-
-#ifdef CONFIG_USB_DEBUG
-       #define DEBUG
-#else
-       #undef DEBUG
-#endif
-
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
index 6c7ca5b..5e5f65a 100644 (file)
  */
 
 #include <linux/config.h>
-
-#ifdef CONFIG_USB_DEBUG
-#define DEBUG
-#endif
-
 #include <linux/module.h>
 #include <linux/version.h>
 #include <linux/kernel.h>
index 256d9f6..8407279 100644 (file)
@@ -9,11 +9,6 @@
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_USB_DEBUG
-       #define DEBUG
-#else
-       #undef DEBUG
-#endif
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/module.h>
index 208c6bd..fe74f99 100644 (file)
@@ -3,13 +3,6 @@
  */
 
 #include <linux/config.h>
-
-#ifdef CONFIG_USB_DEBUG
-       #define DEBUG
-#else
-       #undef DEBUG
-#endif
-
 #include <linux/pci.h> /* for scatterlist macros */
 #include <linux/usb.h>
 #include <linux/module.h>
index 37da059..fbbebab 100644 (file)
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/notifier.h>
-#ifdef CONFIG_USB_DEBUG
-       #define DEBUG
-#else
-       #undef DEBUG
-#endif
 #include <linux/usb.h>
-
 #include "usb.h"
 
 
index edd83e0..71d8813 100644 (file)
 
 #include <linux/config.h>
 #include <linux/kernel.h>
-
-#ifdef CONFIG_USB_DEBUG
-       #define DEBUG
-#else
-       #undef DEBUG
-#endif
 #include <linux/usb.h>
-
 #include "usb.h"
 
 /* endpoint stuff */
index f2a1fed..0817967 100644 (file)
@@ -4,12 +4,6 @@
 #include <linux/bitops.h>
 #include <linux/slab.h>
 #include <linux/init.h>
-
-#ifdef CONFIG_USB_DEBUG
-       #define DEBUG
-#else
-       #undef DEBUG
-#endif
 #include <linux/usb.h>
 #include "hcd.h"
 
index 0eefff7..e197ce9 100644 (file)
  */
 
 #include <linux/config.h>
-
-#ifdef CONFIG_USB_DEBUG
-       #define DEBUG
-#else
-       #undef DEBUG
-#endif
-
 #include <linux/module.h>
 #include <linux/string.h>
 #include <linux/bitops.h>
index 5e03b93..07cb17d 100644 (file)
@@ -42,3 +42,7 @@ obj-$(CONFIG_USB_ACECAD)      += acecad.o
 obj-$(CONFIG_USB_YEALINK)      += yealink.o
 obj-$(CONFIG_USB_XPAD)         += xpad.o
 obj-$(CONFIG_USB_APPLETOUCH)   += appletouch.o
+
+ifeq ($(CONFIG_USB_DEBUG),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
index 3b58185..4a50acb 100644 (file)
  *****************************************************************************/
 
 #include <linux/config.h>
-
-#ifdef CONFIG_USB_DEBUG
-       #define DEBUG
-#else
-       #undef DEBUG
-#endif
-
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/input.h>
index 5b8d65f..a32cfe5 100644 (file)
@@ -160,7 +160,8 @@ static int keyspan_load_tester(struct usb_keyspan* dev, int bits_needed)
         * though so it's not too big a deal
         */
        if (dev->data.pos >= dev->data.len) {
-               dev_dbg(&dev->udev, "%s - Error ran out of data. pos: %d, len: %d\n",
+               dev_dbg(&dev->udev->dev,
+                       "%s - Error ran out of data. pos: %d, len: %d\n",
                        __FUNCTION__, dev->data.pos, dev->data.len);
                return -1;
        }
@@ -306,7 +307,7 @@ static void keyspan_check_data(struct usb_keyspan *remote, struct pt_regs *regs)
                        err("Bad message recieved, no stop bit found.\n");
                }
 
-               dev_dbg(&remote->udev,
+               dev_dbg(&remote->udev->dev,
                        "%s found valid message: system: %d, button: %d, toggle: %d\n",
                        __FUNCTION__, message.system, message.button, message.toggle);
 
index 7fce526..52cc18c 100644 (file)
  *****************************************************************************/
 
 #include <linux/config.h>
-
-#ifdef CONFIG_USB_DEBUG
-       #define DEBUG
-#else
-       #undef DEBUG
-#endif
-
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/input.h>
index dca5ee9..19e015d 100644 (file)
@@ -37,8 +37,6 @@
 #include "hid.h"
 #include "pid.h"
 
-#define DEBUG
-
 #define CHECK_OWNERSHIP(i, hid_pid)    \
        ((i) < FF_EFFECTS_MAX && i >= 0 && \
        test_bit(FF_PID_FLAGS_USED, &hid_pid->effects[(i)].flags) && \
index 0043e6e..7420c6b 100644 (file)
 #include <linux/input.h>
 #include <linux/module.h>
 #include <linux/init.h>
-
-#if !defined(DEBUG) && defined(CONFIG_USB_DEBUG)
-#define DEBUG
-#endif
 #include <linux/usb.h>
 #include <linux/usb_input.h>
 
index 862e40a..6c693bc 100644 (file)
@@ -18,4 +18,8 @@ obj-$(CONFIG_USB_RIO500)      += rio500.o
 obj-$(CONFIG_USB_TEST)         += usbtest.o
 obj-$(CONFIG_USB_USS720)       += uss720.o
 
-obj-$(CONFIG_USB_SISUSBVGA)    += sisusbvga/
\ No newline at end of file
+obj-$(CONFIG_USB_SISUSBVGA)    += sisusbvga/
+
+ifeq ($(CONFIG_USB_DEBUG),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
index 5f33f7c..2a28cee 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/wait.h>
-#undef DEBUG                   /* include debug macros until it's done */
 #include <linux/usb.h>
 
 /*-------------------------------------------------------------------*/
index b84eda6..a30d4a6 100644 (file)
@@ -26,9 +26,6 @@
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_USB_DEBUG
-#define DEBUG  1
-#endif
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/init.h>
index 7d02d8e..9590dba 100644 (file)
@@ -393,7 +393,7 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos)
                                      ibuf, this_read, &partial,
                                      8000);
 
-               dbg(KERN_DEBUG "read stats: result:%d this_read:%u partial:%u",
+               dbg("read stats: result:%d this_read:%u partial:%u",
                       result, this_read, partial);
 
                if (partial) {
index f6ba4c7..3c93921 100644 (file)
@@ -10,9 +10,6 @@
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_USB_DEBUG
-       #define DEBUG   1
-#endif
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/init.h>
index 2997f55..605a2af 100644 (file)
@@ -1,7 +1,4 @@
 #include <linux/config.h>
-#if !defined (DEBUG) && defined (CONFIG_USB_DEBUG)
-#   define DEBUG
-#endif
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/init.h>
index 0592cb5..1cabe7e 100644 (file)
@@ -41,8 +41,6 @@
 
 /*****************************************************************************/
 
-#define DEBUG
-
 #include <linux/module.h>
 #include <linux/socket.h>
 #include <linux/parport.h>
index 222c049..a21e6ea 100644 (file)
@@ -16,3 +16,7 @@ obj-$(CONFIG_USB_NET_CDC_SUBSET)      += cdc_subset.o
 obj-$(CONFIG_USB_NET_ZAURUS)   += zaurus.o
 obj-$(CONFIG_USB_USBNET)       += usbnet.o
 obj-$(CONFIG_USB_ZD1201)       += zd1201.o
+
+ifeq ($(CONFIG_USB_DEBUG),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
index 252a34f..542120e 100644 (file)
@@ -23,9 +23,6 @@
 // #define     VERBOSE                 // more; success messages
 
 #include <linux/config.h>
-#ifdef CONFIG_USB_DEBUG
-#   define DEBUG
-#endif
 #include <linux/module.h>
 #include <linux/kmod.h>
 #include <linux/sched.h>
index 652b04b..c008c98 100644 (file)
@@ -21,9 +21,6 @@
 // #define     VERBOSE                 // more; success messages
 
 #include <linux/config.h>
-#ifdef CONFIG_USB_DEBUG
-#   define DEBUG
-#endif
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init.h>
index f1730b6..f05cfb8 100644 (file)
@@ -18,9 +18,6 @@
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_USB_DEBUG
-#   define DEBUG
-#endif
 #include <linux/module.h>
 #include <linux/kmod.h>
 #include <linux/sched.h>
index c0f263b..2455e9a 100644 (file)
@@ -22,9 +22,6 @@
 // #define     VERBOSE                 // more; success messages
 
 #include <linux/config.h>
-#ifdef CONFIG_USB_DEBUG
-#   define DEBUG
-#endif
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init.h>
index cee55f8..b3799b1 100644 (file)
@@ -21,9 +21,6 @@
 // #define     VERBOSE                 // more; success messages
 
 #include <linux/config.h>
-#ifdef CONFIG_USB_DEBUG
-#   define DEBUG
-#endif
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init.h>
index 537eb18..683e3df 100644 (file)
@@ -28,8 +28,6 @@
  *                     is out of the interrupt routine.
  */
 
-#undef DEBUG
-
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/init.h>
index 74c2b35..89856aa 100644 (file)
@@ -21,9 +21,6 @@
 // #define     VERBOSE                 // more; success messages
 
 #include <linux/config.h>
-#ifdef CONFIG_USB_DEBUG
-#   define DEBUG
-#endif
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init.h>
index b5a925d..c0ecbab 100644 (file)
@@ -21,9 +21,6 @@
 // #define     VERBOSE                 // more; success messages
 
 #include <linux/config.h>
-#ifdef CONFIG_USB_DEBUG
-#   define DEBUG
-#endif
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init.h>
index 74f05c9..362d690 100644 (file)
@@ -34,9 +34,6 @@
 // #define     VERBOSE                 // more; success messages
 
 #include <linux/config.h>
-#ifdef CONFIG_USB_DEBUG
-#   define DEBUG
-#endif
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init.h>
index 5d4b7d5..680d139 100644 (file)
@@ -21,9 +21,6 @@
 // #define     VERBOSE                 // more; success messages
 
 #include <linux/config.h>
-#ifdef CONFIG_USB_DEBUG
-#   define DEBUG
-#endif
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init.h>