Commit 7384a922 authored by Kevin Lloyd's avatar Kevin Lloyd Committed by Greg Kroah-Hartman

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