From 654f31189e550cd5924b786487a5d93d9feaada9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 17 Nov 2005 09:48:09 -0800 Subject: [PATCH] [PATCH] USB: move CONFIG_USB_DEBUG checks into the Makefile 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 Signed-off-by: Linus Torvalds --- drivers/usb/atm/Makefile | 4 ++++ drivers/usb/atm/usbatm.h | 5 ----- drivers/usb/core/Makefile | 4 ++++ drivers/usb/core/buffer.c | 8 -------- drivers/usb/core/config.c | 5 ----- drivers/usb/core/file.c | 6 ------ drivers/usb/core/hcd-pci.c | 7 ------- drivers/usb/core/hcd.c | 5 ----- drivers/usb/core/hub.c | 5 ----- drivers/usb/core/message.c | 7 ------- drivers/usb/core/notify.c | 6 ------ drivers/usb/core/sysfs.c | 7 ------- drivers/usb/core/urb.c | 6 ------ drivers/usb/core/usb.c | 7 ------- drivers/usb/input/Makefile | 4 ++++ drivers/usb/input/itmtouch.c | 7 ------- drivers/usb/input/keyspan_remote.c | 5 +++-- drivers/usb/input/mtouchusb.c | 7 ------- drivers/usb/input/pid.c | 2 -- drivers/usb/input/touchkitusb.c | 4 ---- drivers/usb/misc/Makefile | 6 +++++- drivers/usb/misc/auerswald.c | 1 - drivers/usb/misc/phidgetservo.c | 3 --- drivers/usb/misc/rio500.c | 2 +- drivers/usb/misc/usbled.c | 3 --- drivers/usb/misc/usbtest.c | 3 --- drivers/usb/misc/uss720.c | 2 -- drivers/usb/net/Makefile | 4 ++++ drivers/usb/net/asix.c | 3 --- drivers/usb/net/cdc_ether.c | 3 --- drivers/usb/net/cdc_subset.c | 3 --- drivers/usb/net/gl620a.c | 3 --- drivers/usb/net/net1080.c | 3 --- drivers/usb/net/pegasus.c | 2 -- drivers/usb/net/plusb.c | 3 --- drivers/usb/net/rndis_host.c | 3 --- drivers/usb/net/usbnet.c | 3 --- drivers/usb/net/zaurus.c | 3 --- 38 files changed, 25 insertions(+), 139 deletions(-) diff --git a/drivers/usb/atm/Makefile b/drivers/usb/atm/Makefile index 751f297be2..85099718c6 100644 --- a/drivers/usb/atm/Makefile +++ b/drivers/usb/atm/Makefile @@ -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 diff --git a/drivers/usb/atm/usbatm.h b/drivers/usb/atm/usbatm.h index 9366464579..1adacd60d7 100644 --- a/drivers/usb/atm/usbatm.h +++ b/drivers/usb/atm/usbatm.h @@ -27,14 +27,9 @@ #include /* -#define DEBUG #define VERBOSE_DEBUG */ -#if !defined (DEBUG) && defined (CONFIG_USB_DEBUG) -# define DEBUG -#endif - #include #include #include diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile index dd1c4d2a0c..86d5c38089 100644 --- a/drivers/usb/core/Makefile +++ b/drivers/usb/core/Makefile @@ -14,3 +14,7 @@ ifeq ($(CONFIG_USB_DEVICEFS),y) endif obj-$(CONFIG_USB) += usbcore.o + +ifeq ($(CONFIG_USB_DEBUG),y) +EXTRA_CFLAGS += -DDEBUG +endif diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index 57e800ac3c..419c9943a7 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c @@ -15,14 +15,6 @@ #include #include #include - - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif - #include #include "hcd.h" diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 993019500c..a9d89c78cc 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -1,9 +1,4 @@ #include - -#ifdef CONFIG_USB_DEBUG -#define DEBUG -#endif - #include #include #include diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index e695308095..37b13368c8 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c @@ -19,12 +19,6 @@ #include #include #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif #include #include "usb.h" diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 84d9e69329..7feb829362 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -17,13 +17,6 @@ */ #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif - #include #include #include diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 6c7ca5b08c..5e5f65a475 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -23,11 +23,6 @@ */ #include - -#ifdef CONFIG_USB_DEBUG -#define DEBUG -#endif - #include #include #include diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 256d9f6987..840727948d 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -9,11 +9,6 @@ */ #include -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif #include #include #include diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 208c6bd83a..fe74f99ca5 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -3,13 +3,6 @@ */ #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif - #include /* for scatterlist macros */ #include #include diff --git a/drivers/usb/core/notify.c b/drivers/usb/core/notify.c index 37da059ece..fbbebab52f 100644 --- a/drivers/usb/core/notify.c +++ b/drivers/usb/core/notify.c @@ -12,13 +12,7 @@ #include #include #include -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif #include - #include "usb.h" diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index edd83e0144..71d881327e 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -12,14 +12,7 @@ #include #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif #include - #include "usb.h" /* endpoint stuff */ diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index f2a1fed2a8..081796726b 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c @@ -4,12 +4,6 @@ #include #include #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif #include #include "hcd.h" diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 0eefff7bcb..e197ce9353 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -22,13 +22,6 @@ */ #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif - #include #include #include diff --git a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile index 5e03b93f29..07cb17db42 100644 --- a/drivers/usb/input/Makefile +++ b/drivers/usb/input/Makefile @@ -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 diff --git a/drivers/usb/input/itmtouch.c b/drivers/usb/input/itmtouch.c index 3b581853cf..4a50acb39d 100644 --- a/drivers/usb/input/itmtouch.c +++ b/drivers/usb/input/itmtouch.c @@ -40,13 +40,6 @@ *****************************************************************************/ #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif - #include #include #include diff --git a/drivers/usb/input/keyspan_remote.c b/drivers/usb/input/keyspan_remote.c index 5b8d65f62a..a32cfe51b7 100644 --- a/drivers/usb/input/keyspan_remote.c +++ b/drivers/usb/input/keyspan_remote.c @@ -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); diff --git a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c index 7fce526560..52cc18cd24 100644 --- a/drivers/usb/input/mtouchusb.c +++ b/drivers/usb/input/mtouchusb.c @@ -40,13 +40,6 @@ *****************************************************************************/ #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif - #include #include #include diff --git a/drivers/usb/input/pid.c b/drivers/usb/input/pid.c index dca5ee93a4..19e015d171 100644 --- a/drivers/usb/input/pid.c +++ b/drivers/usb/input/pid.c @@ -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) && \ diff --git a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c index 0043e6ebcd..7420c6b842 100644 --- a/drivers/usb/input/touchkitusb.c +++ b/drivers/usb/input/touchkitusb.c @@ -30,10 +30,6 @@ #include #include #include - -#if !defined(DEBUG) && defined(CONFIG_USB_DEBUG) -#define DEBUG -#endif #include #include diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile index 862e40a836..6c693bc68e 100644 --- a/drivers/usb/misc/Makefile +++ b/drivers/usb/misc/Makefile @@ -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 diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index 5f33f7c648..2a28ceeaa6 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c @@ -30,7 +30,6 @@ #include #include #include -#undef DEBUG /* include debug macros until it's done */ #include /*-------------------------------------------------------------------*/ diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c index b84eda631a..a30d4a6ee8 100644 --- a/drivers/usb/misc/phidgetservo.c +++ b/drivers/usb/misc/phidgetservo.c @@ -26,9 +26,6 @@ */ #include -#ifdef CONFIG_USB_DEBUG -#define DEBUG 1 -#endif #include #include #include diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c index 7d02d8ec6b..9590dbac5d 100644 --- a/drivers/usb/misc/rio500.c +++ b/drivers/usb/misc/rio500.c @@ -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) { diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index f6ba4c788d..3c93921cb6 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c @@ -10,9 +10,6 @@ */ #include -#ifdef CONFIG_USB_DEBUG - #define DEBUG 1 -#endif #include #include #include diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 2997f55815..605a2afe34 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -1,7 +1,4 @@ #include -#if !defined (DEBUG) && defined (CONFIG_USB_DEBUG) -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index 0592cb5e6c..1cabe7ed91 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c @@ -41,8 +41,6 @@ /*****************************************************************************/ -#define DEBUG - #include #include #include diff --git a/drivers/usb/net/Makefile b/drivers/usb/net/Makefile index 222c0495f7..a21e6eaaba 100644 --- a/drivers/usb/net/Makefile +++ b/drivers/usb/net/Makefile @@ -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 diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c index 252a34fbb4..542120ef1f 100644 --- a/drivers/usb/net/asix.c +++ b/drivers/usb/net/asix.c @@ -23,9 +23,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/cdc_ether.c b/drivers/usb/net/cdc_ether.c index 652b04bbf6..c008c98186 100644 --- a/drivers/usb/net/cdc_ether.c +++ b/drivers/usb/net/cdc_ether.c @@ -21,9 +21,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/cdc_subset.c b/drivers/usb/net/cdc_subset.c index f1730b685f..f05cfb83c8 100644 --- a/drivers/usb/net/cdc_subset.c +++ b/drivers/usb/net/cdc_subset.c @@ -18,9 +18,6 @@ */ #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/gl620a.c b/drivers/usb/net/gl620a.c index c0f263b202..2455e9a856 100644 --- a/drivers/usb/net/gl620a.c +++ b/drivers/usb/net/gl620a.c @@ -22,9 +22,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/net1080.c b/drivers/usb/net/net1080.c index cee55f8cf6..b3799b1a2b 100644 --- a/drivers/usb/net/net1080.c +++ b/drivers/usb/net/net1080.c @@ -21,9 +21,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index 537eb181d9..683e3df5d6 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c @@ -28,8 +28,6 @@ * is out of the interrupt routine. */ -#undef DEBUG - #include #include #include diff --git a/drivers/usb/net/plusb.c b/drivers/usb/net/plusb.c index 74c2b3581c..89856aa0e3 100644 --- a/drivers/usb/net/plusb.c +++ b/drivers/usb/net/plusb.c @@ -21,9 +21,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/rndis_host.c b/drivers/usb/net/rndis_host.c index b5a925dc1b..c0ecbab6f6 100644 --- a/drivers/usb/net/rndis_host.c +++ b/drivers/usb/net/rndis_host.c @@ -21,9 +21,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c index 74f05c9c84..362d6907c9 100644 --- a/drivers/usb/net/usbnet.c +++ b/drivers/usb/net/usbnet.c @@ -34,9 +34,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/zaurus.c b/drivers/usb/net/zaurus.c index 5d4b7d55b0..680d13957a 100644 --- a/drivers/usb/net/zaurus.c +++ b/drivers/usb/net/zaurus.c @@ -21,9 +21,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include -- 2.39.2