Commit 96fc8e8d authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: serial: cyberjack.c: remove dbg() usage

dbg() was a very old USB-serial-specific macro.
This patch removes it from being used in the
driver and uses dev_dbg() instead.

CC: Matthias Bruestle and Harald Welte <support@reiner-sct.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 660f3b14
...@@ -136,7 +136,8 @@ static int cyberjack_startup(struct usb_serial *serial) ...@@ -136,7 +136,8 @@ static int cyberjack_startup(struct usb_serial *serial)
if (result) if (result)
dev_err(&serial->dev->dev, dev_err(&serial->dev->dev,
"usb_submit_urb(read int) failed\n"); "usb_submit_urb(read int) failed\n");
dbg("%s - usb_submit_urb(int urb)", __func__); dev_dbg(&serial->dev->dev, "%s - usb_submit_urb(int urb)\n",
__func__);
} }
return 0; return 0;
...@@ -167,7 +168,7 @@ static int cyberjack_open(struct tty_struct *tty, ...@@ -167,7 +168,7 @@ static int cyberjack_open(struct tty_struct *tty,
unsigned long flags; unsigned long flags;
int result = 0; int result = 0;
dbg("%s - usb_clear_halt", __func__); dev_dbg(&port->dev, "%s - usb_clear_halt\n", __func__);
usb_clear_halt(port->serial->dev, port->write_urb->pipe); usb_clear_halt(port->serial->dev, port->write_urb->pipe);
priv = usb_get_serial_port_data(port); priv = usb_get_serial_port_data(port);
...@@ -192,18 +193,19 @@ static void cyberjack_close(struct usb_serial_port *port) ...@@ -192,18 +193,19 @@ static void cyberjack_close(struct usb_serial_port *port)
static int cyberjack_write(struct tty_struct *tty, static int cyberjack_write(struct tty_struct *tty,
struct usb_serial_port *port, const unsigned char *buf, int count) struct usb_serial_port *port, const unsigned char *buf, int count)
{ {
struct device *dev = &port->dev;
struct cyberjack_private *priv = usb_get_serial_port_data(port); struct cyberjack_private *priv = usb_get_serial_port_data(port);
unsigned long flags; unsigned long flags;
int result; int result;
int wrexpected; int wrexpected;
if (count == 0) { if (count == 0) {
dbg("%s - write request of 0 bytes", __func__); dev_dbg(dev, "%s - write request of 0 bytes\n", __func__);
return 0; return 0;
} }
if (!test_and_clear_bit(0, &port->write_urbs_free)) { if (!test_and_clear_bit(0, &port->write_urbs_free)) {
dbg("%s - already writing", __func__); dev_dbg(dev, "%s - already writing\n", __func__);
return 0; return 0;
} }
...@@ -220,13 +222,13 @@ static int cyberjack_write(struct tty_struct *tty, ...@@ -220,13 +222,13 @@ static int cyberjack_write(struct tty_struct *tty,
/* Copy data */ /* Copy data */
memcpy(priv->wrbuf + priv->wrfilled, buf, count); memcpy(priv->wrbuf + priv->wrfilled, buf, count);
usb_serial_debug_data(debug, &port->dev, __func__, count, usb_serial_debug_data(debug, dev, __func__, count,
priv->wrbuf + priv->wrfilled); priv->wrbuf + priv->wrfilled);
priv->wrfilled += count; priv->wrfilled += count;
if (priv->wrfilled >= 3) { if (priv->wrfilled >= 3) {
wrexpected = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3; wrexpected = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3;
dbg("%s - expected data: %d", __func__, wrexpected); dev_dbg(dev, "%s - expected data: %d\n", __func__, wrexpected);
} else } else
wrexpected = sizeof(priv->wrbuf); wrexpected = sizeof(priv->wrbuf);
...@@ -234,7 +236,7 @@ static int cyberjack_write(struct tty_struct *tty, ...@@ -234,7 +236,7 @@ static int cyberjack_write(struct tty_struct *tty,
/* We have enough data to begin transmission */ /* We have enough data to begin transmission */
int length; int length;
dbg("%s - transmitting data (frame 1)", __func__); dev_dbg(dev, "%s - transmitting data (frame 1)\n", __func__);
length = (wrexpected > port->bulk_out_size) ? length = (wrexpected > port->bulk_out_size) ?
port->bulk_out_size : wrexpected; port->bulk_out_size : wrexpected;
...@@ -258,11 +260,11 @@ static int cyberjack_write(struct tty_struct *tty, ...@@ -258,11 +260,11 @@ static int cyberjack_write(struct tty_struct *tty,
return 0; return 0;
} }
dbg("%s - priv->wrsent=%d", __func__, priv->wrsent); dev_dbg(dev, "%s - priv->wrsent=%d\n", __func__, priv->wrsent);
dbg("%s - priv->wrfilled=%d", __func__, priv->wrfilled); dev_dbg(dev, "%s - priv->wrfilled=%d\n", __func__, priv->wrfilled);
if (priv->wrsent >= priv->wrfilled) { if (priv->wrsent >= priv->wrfilled) {
dbg("%s - buffer cleaned", __func__); dev_dbg(dev, "%s - buffer cleaned\n", __func__);
memset(priv->wrbuf, 0, sizeof(priv->wrbuf)); memset(priv->wrbuf, 0, sizeof(priv->wrbuf));
priv->wrfilled = 0; priv->wrfilled = 0;
priv->wrsent = 0; priv->wrsent = 0;
...@@ -284,6 +286,7 @@ static void cyberjack_read_int_callback(struct urb *urb) ...@@ -284,6 +286,7 @@ static void cyberjack_read_int_callback(struct urb *urb)
{ {
struct usb_serial_port *port = urb->context; struct usb_serial_port *port = urb->context;
struct cyberjack_private *priv = usb_get_serial_port_data(port); struct cyberjack_private *priv = usb_get_serial_port_data(port);
struct device *dev = &port->dev;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
int status = urb->status; int status = urb->status;
int result; int result;
...@@ -292,8 +295,7 @@ static void cyberjack_read_int_callback(struct urb *urb) ...@@ -292,8 +295,7 @@ static void cyberjack_read_int_callback(struct urb *urb)
if (status) if (status)
return; return;
usb_serial_debug_data(debug, &port->dev, __func__, usb_serial_debug_data(debug, dev, __func__, urb->actual_length, data);
urb->actual_length, data);
/* React only to interrupts signaling a bulk_in transfer */ /* React only to interrupts signaling a bulk_in transfer */
if (urb->actual_length == 4 && data[0] == 0x01) { if (urb->actual_length == 4 && data[0] == 0x01) {
...@@ -307,7 +309,7 @@ static void cyberjack_read_int_callback(struct urb *urb) ...@@ -307,7 +309,7 @@ static void cyberjack_read_int_callback(struct urb *urb)
old_rdtodo = priv->rdtodo; old_rdtodo = priv->rdtodo;
if (old_rdtodo + size < old_rdtodo) { if (old_rdtodo + size < old_rdtodo) {
dbg("To many bulk_in urbs to do."); dev_dbg(dev, "To many bulk_in urbs to do.\n");
spin_unlock(&priv->lock); spin_unlock(&priv->lock);
goto resubmit; goto resubmit;
} }
...@@ -315,17 +317,16 @@ static void cyberjack_read_int_callback(struct urb *urb) ...@@ -315,17 +317,16 @@ static void cyberjack_read_int_callback(struct urb *urb)
/* "+=" is probably more fault tollerant than "=" */ /* "+=" is probably more fault tollerant than "=" */
priv->rdtodo += size; priv->rdtodo += size;
dbg("%s - rdtodo: %d", __func__, priv->rdtodo); dev_dbg(dev, "%s - rdtodo: %d\n", __func__, priv->rdtodo);
spin_unlock(&priv->lock); spin_unlock(&priv->lock);
if (!old_rdtodo) { if (!old_rdtodo) {
result = usb_submit_urb(port->read_urb, GFP_ATOMIC); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) if (result)
dev_err(&port->dev, "%s - failed resubmitting " dev_err(dev, "%s - failed resubmitting read urb, error %d\n",
"read urb, error %d\n",
__func__, result); __func__, result);
dbg("%s - usb_submit_urb(read urb)", __func__); dev_dbg(dev, "%s - usb_submit_urb(read urb)\n", __func__);
} }
} }
...@@ -333,13 +334,14 @@ static void cyberjack_read_int_callback(struct urb *urb) ...@@ -333,13 +334,14 @@ static void cyberjack_read_int_callback(struct urb *urb)
result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
if (result) if (result)
dev_err(&port->dev, "usb_submit_urb(read int) failed\n"); dev_err(&port->dev, "usb_submit_urb(read int) failed\n");
dbg("%s - usb_submit_urb(int urb)", __func__); dev_dbg(dev, "%s - usb_submit_urb(int urb)\n", __func__);
} }
static void cyberjack_read_bulk_callback(struct urb *urb) static void cyberjack_read_bulk_callback(struct urb *urb)
{ {
struct usb_serial_port *port = urb->context; struct usb_serial_port *port = urb->context;
struct cyberjack_private *priv = usb_get_serial_port_data(port); struct cyberjack_private *priv = usb_get_serial_port_data(port);
struct device *dev = &port->dev;
struct tty_struct *tty; struct tty_struct *tty;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
short todo; short todo;
...@@ -349,14 +351,14 @@ static void cyberjack_read_bulk_callback(struct urb *urb) ...@@ -349,14 +351,14 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
usb_serial_debug_data(debug, &port->dev, __func__, usb_serial_debug_data(debug, &port->dev, __func__,
urb->actual_length, data); urb->actual_length, data);
if (status) { if (status) {
dbg("%s - nonzero read bulk status received: %d", dev_dbg(dev, "%s - nonzero read bulk status received: %d\n",
__func__, status); __func__, status);
return; return;
} }
tty = tty_port_tty_get(&port->port); tty = tty_port_tty_get(&port->port);
if (!tty) { if (!tty) {
dbg("%s - ignoring since device not open", __func__); dev_dbg(dev, "%s - ignoring since device not open\n", __func__);
return; return;
} }
if (urb->actual_length) { if (urb->actual_length) {
...@@ -376,15 +378,15 @@ static void cyberjack_read_bulk_callback(struct urb *urb) ...@@ -376,15 +378,15 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
spin_unlock(&priv->lock); spin_unlock(&priv->lock);
dbg("%s - rdtodo: %d", __func__, todo); dev_dbg(dev, "%s - rdtodo: %d\n", __func__, todo);
/* Continue to read if we have still urbs to do. */ /* Continue to read if we have still urbs to do. */
if (todo /* || (urb->actual_length==port->bulk_in_endpointAddress)*/) { if (todo /* || (urb->actual_length==port->bulk_in_endpointAddress)*/) {
result = usb_submit_urb(port->read_urb, GFP_ATOMIC); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) if (result)
dev_err(&port->dev, "%s - failed resubmitting read " dev_err(dev, "%s - failed resubmitting read urb, error %d\n",
"urb, error %d\n", __func__, result); __func__, result);
dbg("%s - usb_submit_urb(read urb)", __func__); dev_dbg(dev, "%s - usb_submit_urb(read urb)\n", __func__);
} }
} }
...@@ -392,12 +394,13 @@ static void cyberjack_write_bulk_callback(struct urb *urb) ...@@ -392,12 +394,13 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
{ {
struct usb_serial_port *port = urb->context; struct usb_serial_port *port = urb->context;
struct cyberjack_private *priv = usb_get_serial_port_data(port); struct cyberjack_private *priv = usb_get_serial_port_data(port);
struct device *dev = &port->dev;
int status = urb->status; int status = urb->status;
set_bit(0, &port->write_urbs_free); set_bit(0, &port->write_urbs_free);
if (status) { if (status) {
dbg("%s - nonzero write bulk status received: %d", dev_dbg(dev, "%s - nonzero write bulk status received: %d\n",
__func__, status); __func__, status);
return; return;
} }
...@@ -407,7 +410,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb) ...@@ -407,7 +410,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
if (priv->wrfilled) { if (priv->wrfilled) {
int length, blksize, result; int length, blksize, result;
dbg("%s - transmitting data (frame n)", __func__); dev_dbg(dev, "%s - transmitting data (frame n)\n", __func__);
length = ((priv->wrfilled - priv->wrsent) > port->bulk_out_size) ? length = ((priv->wrfilled - priv->wrsent) > port->bulk_out_size) ?
port->bulk_out_size : (priv->wrfilled - priv->wrsent); port->bulk_out_size : (priv->wrfilled - priv->wrsent);
...@@ -422,8 +425,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb) ...@@ -422,8 +425,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
/* send the data out the bulk port */ /* send the data out the bulk port */
result = usb_submit_urb(port->write_urb, GFP_ATOMIC); result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) { if (result) {
dev_err(&port->dev, dev_err(dev, "%s - failed submitting write urb, error %d\n",
"%s - failed submitting write urb, error %d\n",
__func__, result); __func__, result);
/* Throw away data. No better idea what to do with it. */ /* Throw away data. No better idea what to do with it. */
priv->wrfilled = 0; priv->wrfilled = 0;
...@@ -431,14 +433,14 @@ static void cyberjack_write_bulk_callback(struct urb *urb) ...@@ -431,14 +433,14 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
goto exit; goto exit;
} }
dbg("%s - priv->wrsent=%d", __func__, priv->wrsent); dev_dbg(dev, "%s - priv->wrsent=%d\n", __func__, priv->wrsent);
dbg("%s - priv->wrfilled=%d", __func__, priv->wrfilled); dev_dbg(dev, "%s - priv->wrfilled=%d\n", __func__, priv->wrfilled);
blksize = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3; blksize = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3;
if (priv->wrsent >= priv->wrfilled || if (priv->wrsent >= priv->wrfilled ||
priv->wrsent >= blksize) { priv->wrsent >= blksize) {
dbg("%s - buffer cleaned", __func__); dev_dbg(dev, "%s - buffer cleaned\n", __func__);
memset(priv->wrbuf, 0, sizeof(priv->wrbuf)); memset(priv->wrbuf, 0, sizeof(priv->wrbuf));
priv->wrfilled = 0; priv->wrfilled = 0;
priv->wrsent = 0; priv->wrsent = 0;
......
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