ChangeSet 1.1757.66.28, 2004/07/14 15:01:49-07:00, greg@kroah.com

[PATCH] USB: remove CONFIG_USB_SERIAL_DEBUG

This involved reworking the usb_serial_debug_data() function too.
Based on a request from SuSE, and numerous user confusions with how
to enable this option.  Now that all usb-serial drivers are using
module_param() it can be set from the boot command line if the drivers
are built into the kernel.

Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/usb/serial/Kconfig           |    7 -------
 drivers/usb/serial/belkin_sa.c       |   11 +++--------
 drivers/usb/serial/bus.c             |    7 -------
 drivers/usb/serial/cyberjack.c       |   17 +++++------------
 drivers/usb/serial/digi_acceleport.c |   10 ++--------
 drivers/usb/serial/empeg.c           |   13 ++++---------
 drivers/usb/serial/ezusb.c           |   17 +++++------------
 drivers/usb/serial/ftdi_sio.c        |   12 ++++--------
 drivers/usb/serial/generic.c         |   17 ++++++-----------
 drivers/usb/serial/io_edgeport.c     |   33 +++++++++------------------------
 drivers/usb/serial/io_ti.c           |   28 +++++++++++-----------------
 drivers/usb/serial/ipaq.c            |   12 +++---------
 drivers/usb/serial/ir-usb.c          |   17 +++++++----------
 drivers/usb/serial/keyspan.c         |   12 ++----------
 drivers/usb/serial/keyspan_pda.c     |    7 +------
 drivers/usb/serial/kl5kusb105.c      |   15 +++++----------
 drivers/usb/serial/kobil_sct.c       |   14 +++-----------
 drivers/usb/serial/mct_u232.c        |   14 ++++----------
 drivers/usb/serial/omninet.c         |   10 ++--------
 drivers/usb/serial/pl2303.c          |   15 ++++-----------
 drivers/usb/serial/safe_serial.c     |   10 +++-------
 drivers/usb/serial/usb-serial.c      |   13 ++-----------
 drivers/usb/serial/usb-serial.h      |   18 +++++++++---------
 drivers/usb/serial/visor.c           |   20 ++++++++------------
 drivers/usb/serial/whiteheat.c       |   19 +++++--------------
 25 files changed, 107 insertions(+), 261 deletions(-)


diff -Nru a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
--- a/drivers/usb/serial/Kconfig	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/Kconfig	2004-07-14 16:43:53 -07:00
@@ -20,13 +20,6 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called usbserial.
 
-config USB_SERIAL_DEBUG
-	bool "USB Serial Converter verbose debug"
-	depends on USB_SERIAL=y
-	help
-	  Say Y here if you want verbose debug messages from the USB Serial
-	  Drivers sent to the kernel debug log.
-
 config USB_SERIAL_CONSOLE
 	bool "USB Serial Console device support (EXPERIMENTAL)"
 	depends on USB_SERIAL=y && EXPERIMENTAL
diff -Nru a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
--- a/drivers/usb/serial/belkin_sa.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/belkin_sa.c	2004-07-14 16:43:53 -07:00
@@ -75,16 +75,11 @@
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
- 	static int debug = 1;
-#else
- 	static int debug;
-#endif
-
 #include "usb-serial.h"
 #include "belkin_sa.h"
 
+static int debug;
+
 /*
  * Version Information
  */
@@ -276,7 +271,7 @@
 		goto exit;
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
 
 	/* Handle known interrupt data */
 	/* ignore data[0] and data[1] */
diff -Nru a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
--- a/drivers/usb/serial/bus.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/bus.c	2004-07-14 16:43:53 -07:00
@@ -14,13 +14,6 @@
 #include <linux/tty.h>
 #include <linux/module.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
 
 static int usb_serial_device_match (struct device *dev, struct device_driver *drv)
diff -Nru a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
--- a/drivers/usb/serial/cyberjack.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/cyberjack.c	2004-07-14 16:43:53 -07:00
@@ -35,16 +35,11 @@
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
+#include "usb-serial.h"
 
 #define CYBERJACK_LOCAL_BUF_SIZE 32
 
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
-#include "usb-serial.h"
+static int debug;
 
 /*
  * Version Information
@@ -243,7 +238,7 @@
 		memcpy (priv->wrbuf+priv->wrfilled, buf, count);
 	}  
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, count,
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count,
 		priv->wrbuf+priv->wrfilled);
 	priv->wrfilled += count;
 
@@ -318,7 +313,7 @@
 	if (urb->status)
 		return;
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
 
 	/* React only to interrupts signaling a bulk_in transfer */
 	if( (urb->actual_length==4) && (data[0]==0x01) ) {
@@ -374,13 +369,11 @@
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 	
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
 	if (urb->status) {
-		usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
 		dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
 		return;
 	}
-
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
 
 	tty = port->tty;
 	if (urb->actual_length) {
diff -Nru a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
--- a/drivers/usb/serial/digi_acceleport.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/digi_acceleport.c	2004-07-14 16:43:53 -07:00
@@ -246,16 +246,8 @@
 #include <linux/workqueue.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
 
-
 /* Defines */
 
 /*
@@ -479,6 +471,8 @@
 
 
 /* Statics */
+
+static int debug;
 
 static struct usb_device_id id_table_combined [] = {
 	{ USB_DEVICE(DIGI_VENDOR_ID, DIGI_2_ID) },
diff -Nru a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
--- a/drivers/usb/serial/empeg.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/empeg.c	2004-07-14 16:43:53 -07:00
@@ -63,15 +63,10 @@
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
 
+static int debug;
+
 /*
  * Version Information
  */
@@ -249,7 +244,7 @@
 			memcpy (urb->transfer_buffer, current_position, transfer_size);
 		}
 
-		usb_serial_debug_data (__FILE__, __FUNCTION__, transfer_size, urb->transfer_buffer);
+		usb_serial_debug_data(debug, &port->dev, __FUNCTION__, transfer_size, urb->transfer_buffer);
 
 		/* build up our urb */
 		usb_fill_bulk_urb (
@@ -365,7 +360,7 @@
 		return;
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
 
 	tty = port->tty;
 
diff -Nru a/drivers/usb/serial/ezusb.c b/drivers/usb/serial/ezusb.c
--- a/drivers/usb/serial/ezusb.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/ezusb.c	2004-07-14 16:43:53 -07:00
@@ -16,13 +16,6 @@
 #include <linux/tty.h>
 #include <linux/module.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
 
 /* EZ-USB Control and Status Register.  Bit 0 controls 8051 reset */
@@ -35,7 +28,7 @@
 
 	/* dbg("ezusb_writememory %x, %d", address, length); */
 	if (!serial->dev) {
-		dbg("%s - no physical device present, failing.", __FUNCTION__);
+		err("%s - no physical device present, failing.", __FUNCTION__);
 		return -ENODEV;
 	}
 
@@ -52,12 +45,12 @@
 
 int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit)
 {
-	int	response;
-	dbg("%s - %d", __FUNCTION__, reset_bit);
+	int response;
+
+	/* dbg("%s - %d", __FUNCTION__, reset_bit); */
 	response = ezusb_writememory (serial, CPUCS_REG, &reset_bit, 1, 0xa0);
-	if (response < 0) {
+	if (response < 0)
 		dev_err(&serial->dev->dev, "%s- %d failed\n", __FUNCTION__, reset_bit);
-	}
 	return response;
 }
 
diff -Nru a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
--- a/drivers/usb/serial/ftdi_sio.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/ftdi_sio.c	2004-07-14 16:43:53 -07:00
@@ -253,12 +253,6 @@
 #include <asm/uaccess.h>
 #include <linux/usb.h>
 #include <linux/serial.h>
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
 #include "ftdi_sio.h"
 
@@ -269,6 +263,8 @@
 #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Bill Ryder <bryder@sgi.com>, Kuba Ober <kuba@mareimbrium.org>"
 #define DRIVER_DESC "USB FTDI Serial Converters Driver"
 
+static int debug;
+
 static struct usb_device_id id_table_sio [] = {
 	{ USB_DEVICE(FTDI_VID, FTDI_SIO_PID) },
 	{ }						/* Terminating entry */
@@ -1492,7 +1488,7 @@
 		}
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, transfer_size, buffer);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, transfer_size, buffer);
 
 	/* fill the buffer and send it */
 	usb_fill_bulk_urb(urb, port->serial->dev, 
@@ -1658,7 +1654,7 @@
 
         /* The first two bytes of every read packet are status */
 	if (urb->actual_length > 2) {
-		usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+		usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
 	} else {
                 dbg("Status only: %03oo %03oo",data[0],data[1]);
         }
diff -Nru a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
--- a/drivers/usb/serial/generic.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/generic.c	2004-07-14 16:43:53 -07:00
@@ -19,16 +19,10 @@
 #include <linux/moduleparam.h>
 #include <linux/usb.h>
 #include <asm/uaccess.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
 
-	
+static int debug;
+
 #ifdef CONFIG_USB_SERIAL_GENERIC
 static __u16 vendor  = 0x05f9;
 static __u16 product = 0xffff;
@@ -169,6 +163,7 @@
 {
 	struct usb_serial *serial = port->serial;
 	int result;
+	unsigned char *data;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
@@ -193,8 +188,8 @@
 		else {
 			memcpy (port->write_urb->transfer_buffer, buf, count);
 		}
-
-		usb_serial_debug_data (__FILE__, __FUNCTION__, count, port->write_urb->transfer_buffer);
+		data = port->write_urb->transfer_buffer;
+		usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, data);
 
 		/* set up our urb */
 		usb_fill_bulk_urb (port->write_urb, serial->dev,
@@ -267,7 +262,7 @@
 		return;
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
 
 	tty = port->tty;
 	if (tty && urb->actual_length) {
diff -Nru a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
--- a/drivers/usb/serial/io_edgeport.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/io_edgeport.c	2004-07-14 16:43:53 -07:00
@@ -259,15 +259,7 @@
 #include <linux/ioctl.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
-
 #include "io_edgeport.h"
 #include "io_ionsp.h"		/* info for the iosp messages */
 #include "io_16654.h"		/* 16654 UART defines */
@@ -299,19 +291,13 @@
 #define IMAGE_VERSION_NAME	OperationalCodeImageVersion_GEN2
 #include "io_fw_down2.h"	/* Define array OperationalCodeImage[] */
 
-
 #define MAX_NAME_LEN		64
 
-
 #define CHASE_TIMEOUT		(5*HZ)		/* 5 seconds */
 #define OPEN_TIMEOUT		(5*HZ)		/* 5 seconds */
 #define COMMAND_TIMEOUT		(5*HZ)		/* 5 seconds */
 
-#ifndef SERIAL_MAGIC
-	#define SERIAL_MAGIC	0x6702
-#endif
-#define PORT_MAGIC		0x7301
-
+static int debug;
 
 /* receive port state */
 enum RXSTATE {
@@ -793,7 +779,7 @@
 
 	// process this interrupt-read even if there are no ports open
 	if (length) {
-		usb_serial_debug_data (__FILE__, __FUNCTION__, length, data);
+		usb_serial_debug_data(debug, &edge_serial->serial->dev->dev, __FUNCTION__, length, data);
 
 		if (length > 1) {
 			bytes_avail = data[0] | (data[1] << 8);
@@ -869,7 +855,7 @@
 	if (urb->actual_length) {
 		raw_data_length = urb->actual_length;
 
-		usb_serial_debug_data (__FILE__, __FUNCTION__, raw_data_length, data);
+		usb_serial_debug_data(debug, &edge_serial->serial->dev->dev, __FUNCTION__, raw_data_length, data);
 
 		/* decrement our rxBytes available by the number that we just got */
 		edge_serial->rxBytesAvail -= raw_data_length;
@@ -1327,7 +1313,7 @@
 	} else {
 		memcpy(&fifo->fifo[fifo->head], data, firsthalf);
 	}  
-	usb_serial_debug_data (__FILE__, __FUNCTION__, firsthalf, &fifo->fifo[fifo->head]);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, firsthalf, &fifo->fifo[fifo->head]);
 
 	// update the index and size
 	fifo->head  += firsthalf;
@@ -1348,7 +1334,7 @@
 		} else {
 			memcpy(&fifo->fifo[fifo->head], &data[firsthalf], secondhalf);
 		}
-		usb_serial_debug_data (__FILE__, __FUNCTION__, secondhalf, &fifo->fifo[fifo->head]);
+		usb_serial_debug_data(debug, &port->dev, __FUNCTION__, secondhalf, &fifo->fifo[fifo->head]);
 		// update the index and size
 		fifo->count += secondhalf;
 		fifo->head  += secondhalf;
@@ -1424,7 +1410,7 @@
 	count = fifo->count;
 	buffer = kmalloc (count+2, GFP_ATOMIC);
 	if (buffer == NULL) {
-		dev_err(&edge_serial->serial->dev->dev, "%s - no more kernel memory...\n", __FUNCTION__);
+		dev_err(&edge_port->port->dev, "%s - no more kernel memory...\n", __FUNCTION__);
 		edge_port->write_in_progress = FALSE;
 		return;
 	}
@@ -1448,9 +1434,8 @@
 		fifo->count -= secondhalf;
 	}
 
-	if (count) {
-		usb_serial_debug_data (__FILE__, __FUNCTION__, count, &buffer[2]);
-	}
+	if (count)
+		usb_serial_debug_data(debug, &edge_port->port->dev, __FUNCTION__, count, &buffer[2]);
 
 	/* fill up the urb with all of our data and submit it */
 	usb_fill_bulk_urb (urb, edge_serial->serial->dev, 
@@ -2443,7 +2428,7 @@
 	struct urb *urb;
 	int timeout;
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, length, buffer);
+	usb_serial_debug_data(debug, &edge_port->port->dev, __FUNCTION__, length, buffer);
 
 	/* Allocate our next urb */
 	urb = usb_alloc_urb (0, GFP_ATOMIC);
diff -Nru a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
--- a/drivers/usb/serial/io_ti.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/io_ti.c	2004-07-14 16:43:53 -07:00
@@ -35,19 +35,13 @@
 #include <linux/ioctl.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
-
 #include "io_16654.h"
 #include "io_usbvend.h"
 #include "io_ti.h"
 
+static int debug;
+
 /*
  * Version Information
  */
@@ -315,8 +309,8 @@
 		}
 
 		if (read_length > 1) {
-			usb_serial_debug_data (__FILE__, __FUNCTION__,
-					       read_length, buffer);
+			usb_serial_debug_data(debug, &dev->dev, __FUNCTION__,
+					      read_length, buffer);
 		}
 
 		/* Update pointers/length */
@@ -357,7 +351,7 @@
 	}
 
 	dbg ("%s - start_address = %x, length = %d", __FUNCTION__, start_address, length);
-	usb_serial_debug_data (__FILE__, __FUNCTION__, length, buffer);
+	usb_serial_debug_data(debug, &serial->serial->dev->dev, __FUNCTION__, length, buffer);
 
 	serial->TiReadI2C = 1;
 
@@ -390,7 +384,7 @@
 	}
 
   	dbg ("%s - start_sddr = %x, length = %d", __FUNCTION__, start_address, length);
-	usb_serial_debug_data (__FILE__, __FUNCTION__, length, buffer);
+	usb_serial_debug_data(debug, &serial->serial->dev->dev, __FUNCTION__, length, buffer);
 
 	return status;
 }
@@ -412,7 +406,7 @@
 		write_length = length;
 
 	dbg ("%s - BytesInFirstPage Addr = %x, length = %d", __FUNCTION__, start_address, write_length);
-	usb_serial_debug_data (__FILE__, __FUNCTION__, write_length, buffer);
+	usb_serial_debug_data(debug, &serial->serial->dev->dev, __FUNCTION__, write_length, buffer);
 
 	/* Write first page */
 	be_start_address = cpu_to_be16 (start_address);
@@ -439,7 +433,7 @@
 			write_length = length;
 
 		dbg ("%s - Page Write Addr = %x, length = %d", __FUNCTION__, start_address, write_length);
-		usb_serial_debug_data (__FILE__, __FUNCTION__, write_length, buffer);
+		usb_serial_debug_data(debug, &serial->serial->dev->dev, __FUNCTION__, write_length, buffer);
 
 		/* Write next page */
 		be_start_address = cpu_to_be16 (start_address);
@@ -1669,7 +1663,7 @@
 		goto exit;
 	}
 		
-	usb_serial_debug_data (__FILE__, __FUNCTION__, length, data);
+	usb_serial_debug_data(debug, &edge_serial->serial->dev->dev, __FUNCTION__, length, data);
 		
 	if (length != 2) {
 		dbg ("%s - expecting packet of size 2, got %d", __FUNCTION__, length);
@@ -1761,7 +1755,7 @@
 
 	tty = edge_port->port->tty;
 	if (tty && urb->actual_length) {
-		usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+		usb_serial_debug_data(debug, &edge_port->port->dev, __FUNCTION__, urb->actual_length, data);
 
 		if (edge_port->close_pending) {
 			dbg ("%s - close is pending, dropping data on the floor.", __FUNCTION__);
@@ -2045,7 +2039,7 @@
 		memcpy (port->write_urb->transfer_buffer, data, count);
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, count, port->write_urb->transfer_buffer);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, port->write_urb->transfer_buffer);
 
 	/* set up our urb */
 	usb_fill_bulk_urb (port->write_urb, port->serial->dev,
diff -Nru a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
--- a/drivers/usb/serial/ipaq.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/ipaq.c	2004-07-14 16:43:53 -07:00
@@ -56,13 +56,6 @@
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug = 0;
-#endif
-
 #include "usb-serial.h"
 #include "ipaq.h"
 
@@ -77,6 +70,7 @@
 #define DRIVER_DESC "USB PocketPC PDA driver"
 
 static __u16 product, vendor;
+static int debug;
 
 /* Function prototypes for an ipaq */
 static int  ipaq_open (struct usb_serial_port *port, struct file *filp);
@@ -315,7 +309,7 @@
 		return;
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
 
 	tty = port->tty;
 	if (tty && urb->actual_length) {
@@ -396,7 +390,7 @@
 	} else {
 		memcpy(pkt->data, buf, count);
 	}
-	usb_serial_debug_data(__FILE__, __FUNCTION__, count, pkt->data);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, pkt->data);
 
 	pkt->len = count;
 	pkt->written = 0;
diff -Nru a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
--- a/drivers/usb/serial/ir-usb.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/ir-usb.c	2004-07-14 16:43:53 -07:00
@@ -58,13 +58,6 @@
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
 
 /*
@@ -101,9 +94,11 @@
 	u8	bMaxUnicastList;
 } __attribute__ ((packed));
 
+static int debug;
+
 /* if overridden by the user, then use their value for the size of the read and
  * write urbs */
-static int buffer_size = 0;
+static int buffer_size;
 /* if overridden by the user, then use the specified number of XBOFs */
 static int xbof = -1;
 
@@ -404,7 +399,8 @@
 	}
 
 	usb_serial_debug_data (
-		__FILE__,
+		debug,
+		&port->dev,
 		__FUNCTION__,
 		urb->actual_length,
 		urb->transfer_buffer);
@@ -439,7 +435,8 @@
 				ir_baud = *data & 0x0f;
 
 			usb_serial_debug_data (
-				__FILE__,
+				debug,
+				&port->dev,
 				__FUNCTION__,
 				urb->actual_length,
 				data);
diff -Nru a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
--- a/drivers/usb/serial/keyspan.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/keyspan.c	2004-07-14 16:43:53 -07:00
@@ -107,19 +107,11 @@
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-	#define DEBUG
-#else
-	static int debug;
-	#undef DEBUG
-#endif
-
 #include <linux/usb.h>
-
 #include "usb-serial.h"
 #include "keyspan.h"
+
+static int debug;
 
 /*
  * Version Information
diff -Nru a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
--- a/drivers/usb/serial/keyspan_pda.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/keyspan_pda.c	2004-07-14 16:43:53 -07:00
@@ -80,12 +80,7 @@
 #include <asm/uaccess.h>
 #include <linux/usb.h>
 
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
+static int debug;
 
 struct ezusb_hex_record {
 	__u16 address;
diff -Nru a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
--- a/drivers/usb/serial/kl5kusb105.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/kl5kusb105.c	2004-07-14 16:43:53 -07:00
@@ -56,16 +56,10 @@
 #include <linux/module.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
- 	static int debug = 1;
-#else
- 	static int debug;
-#endif
-
 #include "usb-serial.h"
 #include "kl5kusb105.h"
 
+static int debug;
 
 /*
  * Version Information
@@ -659,7 +653,8 @@
 	} else if (urb->actual_length <= 2) {
 		dbg("%s - size %d URB not understood", __FUNCTION__,
 		    urb->actual_length);
-		usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+		usb_serial_debug_data(debug, &port->dev, __FUNCTION__,
+				      urb->actual_length, data);
 	} else {
 		int i;
 		int bytes_sent = ((__u8 *) data)[0] +
@@ -671,8 +666,8 @@
 		 * intermixed tty_flip_buffer_push()s
 		 * FIXME
 		 */ 
-		usb_serial_debug_data (__FILE__, __FUNCTION__,
-				       urb->actual_length, data);
+		usb_serial_debug_data(debug, &port->dev, __FUNCTION__,
+				      urb->actual_length, data);
 
 		if (bytes_sent + 2 > urb->actual_length) {
 			dbg("%s - trying to read more data than available"
diff -Nru a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
--- a/drivers/usb/serial/kobil_sct.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/kobil_sct.c	2004-07-14 16:43:53 -07:00
@@ -48,18 +48,10 @@
 #include <asm/uaccess.h>
 #include <linux/usb.h>
 #include <linux/ioctl.h>
-
-
+#include "usb-serial.h"
 #include "kobil_sct.h"
-//#include "../core/usb-debug.c"
 
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
-#include "usb-serial.h"
+static int debug;
 
 /* Version Information */
 #define DRIVER_VERSION "21/05/2004"
@@ -456,7 +448,7 @@
 		memcpy (priv->buf + priv->filled, buf, count);
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, count, priv->buf + priv->filled);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, priv->buf + priv->filled);
 
 	priv->filled = priv->filled + count;
 
diff -Nru a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
--- a/drivers/usb/serial/mct_u232.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/mct_u232.c	2004-07-14 16:43:53 -07:00
@@ -76,17 +76,9 @@
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
- 	static int debug = 1;
-#else
- 	static int debug;
-#endif
-
 #include "usb-serial.h"
 #include "mct_u232.h"
 
-
 /*
  * Version Information
  */
@@ -105,6 +97,8 @@
 static int write_blocking; /* disabled by default */
 #endif
 
+static int debug;
+
 /*
  * Function prototypes
  */
@@ -523,7 +517,7 @@
 	while (count > 0) {
 		size = (count > port->bulk_out_size) ? port->bulk_out_size : count;
 		
-		usb_serial_debug_data (__FILE__, __FUNCTION__, size, buf);
+		usb_serial_debug_data(debug, &port->dev, __FUNCTION__, size, buf);
 		
 		if (from_user) {
 			if (copy_from_user(port->write_urb->transfer_buffer, buf, size)) {
@@ -631,7 +625,7 @@
 		return;
 	}
 	
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
 
 	/*
 	 * Work-a-round: handle the 'usual' bulk-in pipe here
diff -Nru a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
--- a/drivers/usb/serial/omninet.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/omninet.c	2004-07-14 16:43:53 -07:00
@@ -47,15 +47,9 @@
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
 
+static int debug;
 
 /*
  * Version Information
@@ -280,7 +274,7 @@
 		memcpy (wport->write_urb->transfer_buffer + OMNINET_DATAOFFSET, buf, count);
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, count, wport->write_urb->transfer_buffer);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, wport->write_urb->transfer_buffer);
 
 	header->oh_seq 	= od->od_outseq++;
 	header->oh_len 	= count;
diff -Nru a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
--- a/drivers/usb/serial/pl2303.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/pl2303.c	2004-07-14 16:43:53 -07:00
@@ -49,13 +49,6 @@
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
 #include "pl2303.h"
 
@@ -65,7 +58,7 @@
 #define DRIVER_VERSION "v0.11"
 #define DRIVER_DESC "Prolific PL2303 USB to serial adaptor driver"
 
-
+static int debug;
 
 static struct usb_device_id id_table [] = {
 	{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) },
@@ -251,7 +244,7 @@
 		memcpy (port->write_urb->transfer_buffer, buf, count);
 	}
 	
-	usb_serial_debug_data (__FILE__, __FUNCTION__, count, port->write_urb->transfer_buffer);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, port->write_urb->transfer_buffer);
 
 	port->write_urb->transfer_buffer_length = count;
 	port->write_urb->dev = port->serial->dev;
@@ -716,7 +709,7 @@
 	}
 
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
 
 	if (urb->actual_length < UART_STATE)
 		goto exit;
@@ -770,7 +763,7 @@
 		return;
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
 
 	/* get tty_flag from status */
 	tty_flag = TTY_NORMAL;
diff -Nru a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
--- a/drivers/usb/serial/safe_serial.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/safe_serial.c	2004-07-14 16:43:53 -07:00
@@ -72,18 +72,14 @@
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
+#include "usb-serial.h"
 
 
-#ifndef CONFIG_USB_SERIAL_DEBUG
-#define CONFIG_USB_SERIAL_DEBUG 0
-#endif
 #ifndef CONFIG_USB_SAFE_PADDED
 #define CONFIG_USB_SAFE_PADDED 0
 #endif
 
-static int debug = CONFIG_USB_SERIAL_DEBUG;
-#include "usb-serial.h"		// must follow the declaration of debug
-
+static int debug;
 static int safe = 1;
 static int padded = CONFIG_USB_SAFE_PADDED;
 
@@ -347,7 +343,7 @@
 		port->write_urb->transfer_buffer_length = count;
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, count, port->write_urb->transfer_buffer);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, port->write_urb->transfer_buffer);
 #ifdef ECHO_TX
 	{
 		int i;
diff -Nru a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
--- a/drivers/usb/serial/usb-serial.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/usb-serial.c	2004-07-14 16:43:53 -07:00
@@ -336,14 +336,6 @@
 #include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
 #include "pl2303.h"
 
@@ -354,7 +346,6 @@
 #define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux/"
 #define DRIVER_DESC "USB Serial Driver core"
 
-
 /* Driver structure we register with the USB core */
 static struct usb_driver usb_serial_driver = {
 	.owner =	THIS_MODULE,
@@ -370,9 +361,9 @@
    drivers depend on it.
 */
 
-static struct usb_serial	*serial_table[SERIAL_TTY_MINORS];	/* initially all NULL */
+static int debug;
+static struct usb_serial *serial_table[SERIAL_TTY_MINORS];	/* initially all NULL */
 static LIST_HEAD(usb_serial_driver_list);
-
 
 struct usb_serial *usb_serial_get_by_index(unsigned index)
 {
diff -Nru a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h
--- a/drivers/usb/serial/usb-serial.h	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/usb-serial.h	2004-07-14 16:43:53 -07:00
@@ -294,20 +294,20 @@
 extern struct bus_type usb_serial_bus_type;
 extern struct tty_driver *usb_serial_tty_driver;
 
-static inline void usb_serial_debug_data (const char *file, const char *function, int size, const unsigned char *data)
+static inline void usb_serial_debug_data(int debug,
+					 struct device *dev,
+					 const char *function, int size,
+					 const unsigned char *data)
 {
 	int i;
 
-	if (!debug)
-		return;
-	
-	printk (KERN_DEBUG "%s: %s - length = %d, data = ", file, function, size);
-	for (i = 0; i < size; ++i) {
-		printk ("%.2x ", data[i]);
+	if (debug) {
+		dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size);
+		for (i = 0; i < size; ++i)
+			printk ("%.2x ", data[i]);
+		printk ("\n");
 	}
-	printk ("\n");
 }
-
 
 /* Use our own dbg macro */
 #undef dbg
diff -Nru a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
--- a/drivers/usb/serial/visor.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/visor.c	2004-07-14 16:43:53 -07:00
@@ -155,13 +155,6 @@
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
 #include "visor.h"
 
@@ -195,6 +188,7 @@
 static int palm_os_4_probe (struct usb_serial *serial, const struct usb_device_id *id);
 
 /* Parameters that may be passed into the module. */
+static int debug;
 static __u16 vendor;
 static __u16 product;
 
@@ -504,7 +498,7 @@
 		memcpy (buffer, buf, count);
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, count, buffer);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, buffer);
 
 	usb_fill_bulk_urb (urb, serial->dev,
 			   usb_sndbulkpipe (serial->dev,
@@ -590,7 +584,7 @@
 		return;
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
 
 	tty = port->tty;
 	if (tty && urb->actual_length) {
@@ -621,6 +615,7 @@
 
 static void visor_read_int_callback (struct urb *urb, struct pt_regs *regs)
 {
+	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
 	int result;
 
 	switch (urb->status) {
@@ -647,8 +642,8 @@
 	 * Rumor has it this endpoint is used to notify when data
 	 * is ready to be read from the bulk ones.
 	 */
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length,
-			       urb->transfer_buffer);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__,
+			      urb->actual_length, urb->transfer_buffer);
 
 exit:
 	result = usb_submit_urb (urb, GFP_ATOMIC);
@@ -799,7 +794,8 @@
 		dev_err(dev, "%s - error %d getting connection info\n",
 			__FUNCTION__, retval);
 	else
-		usb_serial_debug_data (__FILE__, __FUNCTION__, retval, transfer_buffer);
+		usb_serial_debug_data(debug, &serial->dev->dev, __FUNCTION__,
+				      retval, transfer_buffer);
 
 	kfree (transfer_buffer);
 	return 0;
diff -Nru a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
--- a/drivers/usb/serial/whiteheat.c	2004-07-14 16:43:53 -07:00
+++ b/drivers/usb/serial/whiteheat.c	2004-07-14 16:43:53 -07:00
@@ -80,17 +80,12 @@
 #include <linux/usb.h>
 #include <linux/serial_reg.h>
 #include <linux/serial.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-	static int debug = 1;
-#else
-	static int debug;
-#endif
-
 #include "usb-serial.h"
 #include "whiteheat_fw.h"		/* firmware for the ConnectTech WhiteHEAT device */
 #include "whiteheat.h"			/* WhiteHEAT specific commands */
 
+static int debug;
+
 #ifndef CMSPAR
 #define CMSPAR 0
 #endif
@@ -747,7 +742,7 @@
 			memcpy (urb->transfer_buffer, buf + sent, bytes);
 		}
 
-		usb_serial_debug_data (__FILE__, __FUNCTION__, bytes, urb->transfer_buffer);
+		usb_serial_debug_data(debug, &port->dev, __FUNCTION__, bytes, urb->transfer_buffer);
 
 		urb->dev = serial->dev;
 		urb->transfer_buffer_length = bytes;
@@ -975,10 +970,6 @@
 		dbg ("nonzero urb status: %d", urb->status);
 		return;
 	}
-
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
-
-	return;
 }
 
 
@@ -997,7 +988,7 @@
 		return;
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+	usb_serial_debug_data(debug, &command_port->dev, __FUNCTION__, urb->actual_length, data);
 
 	command_info = usb_get_serial_port_data(command_port);
 	if (!command_info) {
@@ -1059,7 +1050,7 @@
 		return;
 	}
 
-	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
 
 	spin_lock(&info->lock);
 	list_add_tail(&wrap->list, &info->rx_urb_q);
