From 801a68b73e5cbc10c4271b844d28d7fb5e85e3bf Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 14 Jul 2004 01:01:49 -0700 Subject: [PATCH] [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 --- 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 --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 46c0ebfb55f39..88fede7b447ec 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -20,13 +20,6 @@ config USB_SERIAL 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 --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 3998061a2e361..bcf56011ec221 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c @@ -75,16 +75,11 @@ #include #include #include - -#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 @@ static void belkin_sa_read_int_callback (struct urb *urb, struct pt_regs *regs) 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 --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index 991d37d5375cd..3cabbbb10f009 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c @@ -14,13 +14,6 @@ #include #include #include - -#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 --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 1559622e6cdf3..3ee5f493a89e2 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c @@ -35,16 +35,11 @@ #include #include #include +#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 @@ static int cyberjack_write (struct usb_serial_port *port, int from_user, const u 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 @@ static void cyberjack_read_int_callback( struct urb *urb, struct pt_regs *regs ) 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,14 +369,12 @@ static void cyberjack_read_bulk_callback (struct urb *urb, struct pt_regs *regs) 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) { for (i = 0; i < urb->actual_length ; ++i) { diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 419e552d830ee..f187b3165d57d 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -246,16 +246,8 @@ #include #include #include - -#ifdef CONFIG_USB_SERIAL_DEBUG - static int debug = 1; -#else - static int debug; -#endif - #include "usb-serial.h" - /* Defines */ /* @@ -480,6 +472,8 @@ static int digi_read_oob_callback( struct urb *urb ); /* Statics */ +static int debug; + static struct usb_device_id id_table_combined [] = { { USB_DEVICE(DIGI_VENDOR_ID, DIGI_2_ID) }, { USB_DEVICE(DIGI_VENDOR_ID, DIGI_4_ID) }, diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index 07dae840d45a9..972f3b91d41c1 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c @@ -63,15 +63,10 @@ #include #include #include - -#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 @@ static int empeg_write (struct usb_serial_port *port, int from_user, const unsig 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 @@ static void empeg_read_bulk_callback (struct urb *urb, struct pt_regs *regs) 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 --git a/drivers/usb/serial/ezusb.c b/drivers/usb/serial/ezusb.c index 676d9650f1862..93c803b00b65a 100644 --- a/drivers/usb/serial/ezusb.c +++ b/drivers/usb/serial/ezusb.c @@ -16,13 +16,6 @@ #include #include #include - -#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 @@ int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *da /* 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_writememory (struct usb_serial *serial, int address, unsigned char *da 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 --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 991cd2e7a03df..576f882d01e69 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -253,12 +253,6 @@ #include #include #include -#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 , Bill Ryder , Kuba Ober " #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 @@ static int ftdi_write (struct usb_serial_port *port, int from_user, } } - 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 @@ static void ftdi_process_read (struct usb_serial_port *port) /* 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 --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index bc63e274f2ec5..196fea084f219 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -19,16 +19,10 @@ #include #include #include - -#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 @@ int usb_serial_generic_write (struct usb_serial_port *port, int from_user, const { struct usb_serial *serial = port->serial; int result; + unsigned char *data; dbg("%s - port %d", __FUNCTION__, port->number); @@ -193,8 +188,8 @@ int usb_serial_generic_write (struct usb_serial_port *port, int from_user, const 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 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *reg 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 --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 2c56ac3af4343..e727628bde190 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -259,15 +259,7 @@ #include #include #include - -#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 @@ static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs) // 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 @@ static void edge_bulk_in_callback (struct urb *urb, struct pt_regs *regs) 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 @@ static int edge_write (struct usb_serial_port *port, int from_user, const unsign } 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 @@ static int edge_write (struct usb_serial_port *port, int from_user, const unsign } 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 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge 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 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge 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 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer 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 --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 1eb5bdf908e36..6b821b6edc1b7 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -35,19 +35,13 @@ #include #include #include - -#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 @@ static int TIReadDownloadMemory(struct usb_device *dev, int start_address, } 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 @@ static int TIReadBootMemory (struct edgeport_serial *serial, int start_address, } 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 @@ static int TIWriteBootMemory (struct edgeport_serial *serial, int start_address, } 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 @@ static int TIWriteDownloadI2C (struct edgeport_serial *serial, int start_address 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 @@ static int TIWriteDownloadI2C (struct edgeport_serial *serial, int start_address 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 @@ static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs) 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 @@ static void edge_bulk_in_callback (struct urb *urb, struct pt_regs *regs) 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 @@ static int edge_write (struct usb_serial_port *port, int from_user, const unsign 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 --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index bd2ff2f3817c7..fa119db028127 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c @@ -56,13 +56,6 @@ #include #include #include - -#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 @@ static void ipaq_read_bulk_callback(struct urb *urb, struct pt_regs *regs) 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 @@ static int ipaq_write_bulk(struct usb_serial_port *port, int from_user, const un } 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 --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index c5fa8b6edfa65..cb42cc7c3224c 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c @@ -58,13 +58,6 @@ #include #include #include - -#ifdef CONFIG_USB_SERIAL_DEBUG - static int debug = 1; -#else - static int debug; -#endif - #include "usb-serial.h" /* @@ -101,9 +94,11 @@ struct irda_class_desc { 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 @@ static void ir_write_bulk_callback (struct urb *urb, struct pt_regs *regs) } usb_serial_debug_data ( - __FILE__, + debug, + &port->dev, __FUNCTION__, urb->actual_length, urb->transfer_buffer); @@ -439,7 +435,8 @@ static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs) ir_baud = *data & 0x0f; usb_serial_debug_data ( - __FILE__, + debug, + &port->dev, __FUNCTION__, urb->actual_length, data); diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 3ffdb923ef1cf..64aa1a2a4edb3 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c @@ -107,20 +107,12 @@ #include #include #include - -#ifdef CONFIG_USB_SERIAL_DEBUG - static int debug = 1; - #define DEBUG -#else - static int debug; - #undef DEBUG -#endif - #include - #include "usb-serial.h" #include "keyspan.h" +static int debug; + /* * Version Information */ diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index fbf162f413dbc..fd6c1b8388aab 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -80,12 +80,7 @@ #include #include -#ifdef CONFIG_USB_SERIAL_DEBUG - static int debug = 1; -#else - static int debug; -#endif - +static int debug; struct ezusb_hex_record { __u16 address; diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index 060953e7cf60a..c5207d19401a7 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -56,16 +56,10 @@ #include #include #include - -#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 @@ static void klsi_105_read_bulk_callback (struct urb *urb, struct pt_regs *regs) } 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 @@ static void klsi_105_read_bulk_callback (struct urb *urb, struct pt_regs *regs) * 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 --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 71634e7ac2f36..96d8cf735bc81 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c @@ -48,18 +48,10 @@ #include #include #include - - +#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 @@ static int kobil_write (struct usb_serial_port *port, int from_user, 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 --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index bca19cda79efb..b4961f0d25098 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c @@ -76,17 +76,9 @@ #include #include #include - -#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 @@ static int mct_u232_write (struct usb_serial_port *port, int from_user, 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 @@ static void mct_u232_read_int_callback (struct urb *urb, struct pt_regs *regs) 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 --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 434a71a1c5875..371aa2e8e3f1e 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c @@ -47,15 +47,9 @@ #include #include #include - -#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 @@ static int omninet_write (struct usb_serial_port *port, int from_user, const uns 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 --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 2516bd883af20..af0d230c61c68 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -49,13 +49,6 @@ #include #include #include - -#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 @@ static int pl2303_write (struct usb_serial_port *port, int from_user, const uns 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 @@ static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs) } - 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 @@ static void pl2303_read_bulk_callback (struct urb *urb, struct pt_regs *regs) 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 --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c index 131c6e29fd54c..fa0abc4b625ac 100644 --- a/drivers/usb/serial/safe_serial.c +++ b/drivers/usb/serial/safe_serial.c @@ -72,18 +72,14 @@ #include #include #include +#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 @@ static int safe_write (struct usb_serial_port *port, int from_user, const unsign 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 --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 89e5e66af137c..2656807d7c18f 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -336,14 +336,6 @@ #include #include #include - - -#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,10 +361,10 @@ static struct usb_driver usb_serial_driver = { 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) { struct usb_serial *serial = serial_table[index]; diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h index 766546dc3fa5d..e2e59560d7fb8 100644 --- a/drivers/usb/serial/usb-serial.h +++ b/drivers/usb/serial/usb-serial.h @@ -294,21 +294,21 @@ extern struct usb_serial_device_type usb_serial_generic_device; 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 #define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0) diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 29b64a49e7414..8a0a75533e703 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c @@ -155,13 +155,6 @@ #include #include #include - -#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_3_probe (struct usb_serial *serial, const struct usb_device_i 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 @@ static int visor_write (struct usb_serial_port *port, int from_user, const unsig 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 @@ static void visor_read_bulk_callback (struct urb *urb, struct pt_regs *regs) 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_bulk_callback (struct urb *urb, struct pt_regs *regs) 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 @@ static void visor_read_int_callback (struct urb *urb, struct pt_regs *regs) * 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 @@ static int palm_os_4_probe (struct usb_serial *serial, const struct usb_device_i 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 --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 1e901e22cd4d0..b27741bf54979 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -80,17 +80,12 @@ #include #include #include - -#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 @@ static int whiteheat_write(struct usb_serial_port *port, int from_user, const un 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 @@ static void command_port_write_callback (struct urb *urb, struct pt_regs *regs) 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 @@ static void command_port_read_callback (struct urb *urb, struct pt_regs *regs) 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 @@ static void whiteheat_read_callback(struct urb *urb, struct pt_regs *regs) 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); -- 2.53.0