Commit 801a68b7 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[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: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent bb965572
......@@ -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
......
......@@ -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 @@ 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] */
......
......@@ -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)
......
......@@ -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 @@ 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) {
......
......@@ -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 */
/*
......@@ -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) },
......
......@@ -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 @@ 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;
......
......@@ -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 @@ 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;
}
......
......@@ -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 @@ 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]);
}
......
......@@ -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 @@ 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) {
......
......@@ -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 @@ 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);
......
......@@ -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 @@ 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,
......
......@@ -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 @@ 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;
......
......@@ -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 @@ 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);
......
......@@ -107,20 +107,12 @@
#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
*/
......
......@@ -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;
......
......@@ -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 @@ 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"
......
......@@ -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 @@ 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;
......
......@@ -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 @@ 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
......
......@@ -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 @@ 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;
......
......@@ -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 @@ 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;
......
......@@ -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 @@ 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;
......
......@@ -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,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];
......
......@@ -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)
......
......@@ -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_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;
......
......@@ -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 @@ 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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment