USB Serial: Sierra: debug message fix

This patch moves dbg calls to dev_dbg where possible. It also fixes some
issues with a previous submission aiming to do the same thing.

Signed-off-by: Kevin Lloyd <klloyd@sierrawireless.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Kevin Lloyd 2008-09-16 21:05:24 -07:00 committed by Greg Kroah-Hartman
parent 399d31da4e
commit 7384a922b5
1 changed files with 38 additions and 31 deletions

View File

@ -247,7 +247,7 @@ static int sierra_send_setup(struct tty_struct *tty,
struct sierra_port_private *portdata;
__u16 interface = 0;
dbg("%s", __func__);
dev_dbg(&port->dev, "%s", __func__);
portdata = usb_get_serial_port_data(port);
@ -284,7 +284,7 @@ static int sierra_send_setup(struct tty_struct *tty,
static void sierra_set_termios(struct tty_struct *tty,
struct usb_serial_port *port, struct ktermios *old_termios)
{
dbg("%s", __func__);
dev_dbg(&port->dev, "%s", __func__);
tty_termios_copy_hw(tty->termios, old_termios);
sierra_send_setup(tty, port);
}
@ -295,6 +295,7 @@ static int sierra_tiocmget(struct tty_struct *tty, struct file *file)
unsigned int value;
struct sierra_port_private *portdata;
dev_dbg(&port->dev, "%s", __func__);
portdata = usb_get_serial_port_data(port);
value = ((portdata->rts_state) ? TIOCM_RTS : 0) |
@ -334,14 +335,14 @@ static void sierra_outdat_callback(struct urb *urb)
int status = urb->status;
unsigned long flags;
dbg("%s - port %d", __func__, port->number);
dev_dbg(&port->dev, "%s - port %d", __func__, port->number);
/* free up the transfer buffer, as usb_free_urb() does not do this */
kfree(urb->transfer_buffer);
if (status)
dbg("%s - nonzero write bulk status received: %d",
__func__, status);
dev_dbg(&port->dev, "%s - nonzero write bulk status "
"received: %d", __func__, status);
spin_lock_irqsave(&portdata->lock, flags);
--portdata->outstanding_urbs;
@ -363,12 +364,12 @@ static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port,
portdata = usb_get_serial_port_data(port);
dbg("%s: write (%d chars)", __func__, count);
dev_dbg(&port->dev, "%s: write (%d chars)", __func__, count);
spin_lock_irqsave(&portdata->lock, flags);
if (portdata->outstanding_urbs > N_OUT_URB) {
spin_unlock_irqrestore(&portdata->lock, flags);
dbg("%s - write limit hit\n", __func__);
dev_dbg(&port->dev, "%s - write limit hit\n", __func__);
return 0;
}
portdata->outstanding_urbs++;
@ -437,8 +438,8 @@ static void sierra_indat_callback(struct urb *urb)
port = urb->context;
if (status) {
dbg("%s: nonzero status: %d on endpoint %02x.",
__func__, status, endpoint);
dev_dbg(&port->dev, "%s: nonzero status: %d on"
" endpoint %02x.", __func__, status, endpoint);
} else {
if (urb->actual_length) {
tty = tty_port_tty_get(&port->port);
@ -447,7 +448,8 @@ static void sierra_indat_callback(struct urb *urb)
tty_flip_buffer_push(tty);
tty_kref_put(tty);
} else
dbg("%s: empty read urb received", __func__);
dev_dbg(&port->dev, "%s: empty read urb"
" received", __func__);
/* Resubmit urb so we continue receiving */
if (port->port.count && status != -ESHUTDOWN) {
@ -468,15 +470,17 @@ static void sierra_instat_callback(struct urb *urb)
struct sierra_port_private *portdata = usb_get_serial_port_data(port);
struct usb_serial *serial = port->serial;
dbg("%s", __func__);
dbg("%s: urb %p port %p has data %p", __func__, urb, port, portdata);
dev_dbg(&port->dev, "%s", __func__);
dev_dbg(&port->dev, "%s: urb %p port %p has data %p", __func__,
urb, port, portdata);
if (status == 0) {
struct usb_ctrlrequest *req_pkt =
(struct usb_ctrlrequest *)urb->transfer_buffer;
if (!req_pkt) {
dbg("%s: NULL req_pkt\n", __func__);
dev_dbg(&port->dev, "%s: NULL req_pkt\n",
__func__);
return;
}
if ((req_pkt->bRequestType == 0xA1) &&
@ -487,7 +491,8 @@ static void sierra_instat_callback(struct urb *urb)
sizeof(struct usb_ctrlrequest));
struct tty_struct *tty;
dbg("%s: signal x%x", __func__, signals);
dev_dbg(&port->dev, "%s: signal x%x", __func__,
signals);
old_dcd_state = portdata->dcd_state;
portdata->cts_state = 1;
@ -501,19 +506,20 @@ static void sierra_instat_callback(struct urb *urb)
tty_hangup(tty);
tty_kref_put(tty);
} else {
dbg("%s: type %x req %x", __func__,
req_pkt->bRequestType, req_pkt->bRequest);
dev_dbg(&port->dev, "%s: type %x req %x",
__func__, req_pkt->bRequestType,
req_pkt->bRequest);
}
} else
dbg("%s: error %d", __func__, status);
dev_dbg(&port->dev, "%s: error %d", __func__, status);
/* Resubmit urb so we continue receiving IRQ data */
if (status != -ESHUTDOWN) {
urb->dev = serial->dev;
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err)
dbg("%s: resubmit intr urb failed. (%d)",
__func__, err);
dev_dbg(&port->dev, "%s: resubmit intr urb "
"failed. (%d)", __func__, err);
}
}
@ -523,14 +529,14 @@ static int sierra_write_room(struct tty_struct *tty)
struct sierra_port_private *portdata = usb_get_serial_port_data(port);
unsigned long flags;
dbg("%s - port %d", __func__, port->number);
dev_dbg(&port->dev, "%s - port %d", __func__, port->number);
/* try to give a good number back based on if we have any free urbs at
* this point in time */
spin_lock_irqsave(&portdata->lock, flags);
if (portdata->outstanding_urbs > N_OUT_URB * 2 / 3) {
spin_unlock_irqrestore(&portdata->lock, flags);
dbg("%s - write limit hit\n", __func__);
dev_dbg(&port->dev, "%s - write limit hit\n", __func__);
return 0;
}
spin_unlock_irqrestore(&portdata->lock, flags);
@ -549,7 +555,7 @@ static int sierra_open(struct tty_struct *tty,
portdata = usb_get_serial_port_data(port);
dbg("%s", __func__);
dev_dbg(&port->dev, "%s", __func__);
/* Set some sane defaults */
portdata->rts_state = 1;
@ -561,8 +567,8 @@ static int sierra_open(struct tty_struct *tty,
if (!urb)
continue;
if (urb->dev != serial->dev) {
dbg("%s: dev %p != %p", __func__,
urb->dev, serial->dev);
dev_dbg(&port->dev, "%s: dev %p != %p",
__func__, urb->dev, serial->dev);
continue;
}
@ -601,7 +607,7 @@ static void sierra_close(struct tty_struct *tty,
struct usb_serial *serial = port->serial;
struct sierra_port_private *portdata;
dbg("%s", __func__);
dev_dbg(&port->dev, "%s", __func__);
portdata = usb_get_serial_port_data(port);
portdata->rts_state = 0;
@ -630,7 +636,7 @@ static int sierra_startup(struct usb_serial *serial)
int i;
int j;
dbg("%s", __func__);
dev_dbg(&serial->dev->dev, "%s", __func__);
/* Set Device mode to D0 */
sierra_set_power_state(serial->dev, 0x0000);
@ -644,7 +650,8 @@ static int sierra_startup(struct usb_serial *serial)
port = serial->port[i];
portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
if (!portdata) {
dbg("%s: kmalloc for sierra_port_private (%d) failed!.",
dev_dbg(&port->dev, "%s: kmalloc for "
"sierra_port_private (%d) failed!.",
__func__, i);
return -ENOMEM;
}
@ -665,8 +672,8 @@ static int sierra_startup(struct usb_serial *serial)
for (j = 0; j < N_IN_URB; ++j) {
urb = usb_alloc_urb(0, GFP_KERNEL);
if (urb == NULL) {
dbg("%s: alloc for in port failed.",
__func__);
dev_dbg(&port->dev, "%s: alloc for in "
"port failed.", __func__);
continue;
}
/* Fill URB using supplied data. */
@ -688,7 +695,7 @@ static void sierra_shutdown(struct usb_serial *serial)
struct usb_serial_port *port;
struct sierra_port_private *portdata;
dbg("%s", __func__);
dev_dbg(&serial->dev->dev, "%s", __func__);
for (i = 0; i < serial->num_ports; ++i) {
port = serial->port[i];