Commit 660f3b14 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: serial: cp210x.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: Johan Hovold <jhovold@gmail.com>
CC: Preston Fick <preston.fick@silabs.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 79cbeeaf
...@@ -304,8 +304,7 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request, ...@@ -304,8 +304,7 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
kfree(buf); kfree(buf);
if (result != size) { if (result != size) {
dbg("%s - Unable to send config request, " dev_dbg(&port->dev, "%s - Unable to send config request, request=0x%x size=%d result=%d\n",
"request=0x%x size=%d result=%d",
__func__, request, size, result); __func__, request, size, result);
if (result > 0) if (result > 0)
result = -EPROTO; result = -EPROTO;
...@@ -361,8 +360,7 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request, ...@@ -361,8 +360,7 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
kfree(buf); kfree(buf);
if ((size > 2 && result != size) || result < 0) { if ((size > 2 && result != size) || result < 0) {
dbg("%s - Unable to send request, " dev_dbg(&port->dev, "%s - Unable to send request, request=0x%x size=%d result=%d\n",
"request=0x%x size=%d result=%d",
__func__, request, size, result); __func__, request, size, result);
if (result > 0) if (result > 0)
result = -EPROTO; result = -EPROTO;
...@@ -487,13 +485,14 @@ static void cp210x_get_termios(struct tty_struct *tty, ...@@ -487,13 +485,14 @@ static void cp210x_get_termios(struct tty_struct *tty,
static void cp210x_get_termios_port(struct usb_serial_port *port, static void cp210x_get_termios_port(struct usb_serial_port *port,
unsigned int *cflagp, unsigned int *baudp) unsigned int *cflagp, unsigned int *baudp)
{ {
struct device *dev = &port->dev;
unsigned int cflag, modem_ctl[4]; unsigned int cflag, modem_ctl[4];
unsigned int baud; unsigned int baud;
unsigned int bits; unsigned int bits;
cp210x_get_config(port, CP210X_GET_BAUDRATE, &baud, 4); cp210x_get_config(port, CP210X_GET_BAUDRATE, &baud, 4);
dbg("%s - baud rate = %d", __func__, baud); dev_dbg(dev, "%s - baud rate = %d\n", __func__, baud);
*baudp = baud; *baudp = baud;
cflag = *cflagp; cflag = *cflagp;
...@@ -502,31 +501,30 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, ...@@ -502,31 +501,30 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
cflag &= ~CSIZE; cflag &= ~CSIZE;
switch (bits & BITS_DATA_MASK) { switch (bits & BITS_DATA_MASK) {
case BITS_DATA_5: case BITS_DATA_5:
dbg("%s - data bits = 5", __func__); dev_dbg(dev, "%s - data bits = 5\n", __func__);
cflag |= CS5; cflag |= CS5;
break; break;
case BITS_DATA_6: case BITS_DATA_6:
dbg("%s - data bits = 6", __func__); dev_dbg(dev, "%s - data bits = 6\n", __func__);
cflag |= CS6; cflag |= CS6;
break; break;
case BITS_DATA_7: case BITS_DATA_7:
dbg("%s - data bits = 7", __func__); dev_dbg(dev, "%s - data bits = 7\n", __func__);
cflag |= CS7; cflag |= CS7;
break; break;
case BITS_DATA_8: case BITS_DATA_8:
dbg("%s - data bits = 8", __func__); dev_dbg(dev, "%s - data bits = 8\n", __func__);
cflag |= CS8; cflag |= CS8;
break; break;
case BITS_DATA_9: case BITS_DATA_9:
dbg("%s - data bits = 9 (not supported, using 8 data bits)", dev_dbg(dev, "%s - data bits = 9 (not supported, using 8 data bits)\n", __func__);
__func__);
cflag |= CS8; cflag |= CS8;
bits &= ~BITS_DATA_MASK; bits &= ~BITS_DATA_MASK;
bits |= BITS_DATA_8; bits |= BITS_DATA_8;
cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
break; break;
default: default:
dbg("%s - Unknown number of data bits, using 8", __func__); dev_dbg(dev, "%s - Unknown number of data bits, using 8\n", __func__);
cflag |= CS8; cflag |= CS8;
bits &= ~BITS_DATA_MASK; bits &= ~BITS_DATA_MASK;
bits |= BITS_DATA_8; bits |= BITS_DATA_8;
...@@ -536,29 +534,29 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, ...@@ -536,29 +534,29 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
switch (bits & BITS_PARITY_MASK) { switch (bits & BITS_PARITY_MASK) {
case BITS_PARITY_NONE: case BITS_PARITY_NONE:
dbg("%s - parity = NONE", __func__); dev_dbg(dev, "%s - parity = NONE\n", __func__);
cflag &= ~PARENB; cflag &= ~PARENB;
break; break;
case BITS_PARITY_ODD: case BITS_PARITY_ODD:
dbg("%s - parity = ODD", __func__); dev_dbg(dev, "%s - parity = ODD\n", __func__);
cflag |= (PARENB|PARODD); cflag |= (PARENB|PARODD);
break; break;
case BITS_PARITY_EVEN: case BITS_PARITY_EVEN:
dbg("%s - parity = EVEN", __func__); dev_dbg(dev, "%s - parity = EVEN\n", __func__);
cflag &= ~PARODD; cflag &= ~PARODD;
cflag |= PARENB; cflag |= PARENB;
break; break;
case BITS_PARITY_MARK: case BITS_PARITY_MARK:
dbg("%s - parity = MARK", __func__); dev_dbg(dev, "%s - parity = MARK\n", __func__);
cflag |= (PARENB|PARODD|CMSPAR); cflag |= (PARENB|PARODD|CMSPAR);
break; break;
case BITS_PARITY_SPACE: case BITS_PARITY_SPACE:
dbg("%s - parity = SPACE", __func__); dev_dbg(dev, "%s - parity = SPACE\n", __func__);
cflag &= ~PARODD; cflag &= ~PARODD;
cflag |= (PARENB|CMSPAR); cflag |= (PARENB|CMSPAR);
break; break;
default: default:
dbg("%s - Unknown parity mode, disabling parity", __func__); dev_dbg(dev, "%s - Unknown parity mode, disabling parity\n", __func__);
cflag &= ~PARENB; cflag &= ~PARENB;
bits &= ~BITS_PARITY_MASK; bits &= ~BITS_PARITY_MASK;
cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
...@@ -568,21 +566,19 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, ...@@ -568,21 +566,19 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
cflag &= ~CSTOPB; cflag &= ~CSTOPB;
switch (bits & BITS_STOP_MASK) { switch (bits & BITS_STOP_MASK) {
case BITS_STOP_1: case BITS_STOP_1:
dbg("%s - stop bits = 1", __func__); dev_dbg(dev, "%s - stop bits = 1\n", __func__);
break; break;
case BITS_STOP_1_5: case BITS_STOP_1_5:
dbg("%s - stop bits = 1.5 (not supported, using 1 stop bit)", dev_dbg(dev, "%s - stop bits = 1.5 (not supported, using 1 stop bit)\n", __func__);
__func__);
bits &= ~BITS_STOP_MASK; bits &= ~BITS_STOP_MASK;
cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
break; break;
case BITS_STOP_2: case BITS_STOP_2:
dbg("%s - stop bits = 2", __func__); dev_dbg(dev, "%s - stop bits = 2\n", __func__);
cflag |= CSTOPB; cflag |= CSTOPB;
break; break;
default: default:
dbg("%s - Unknown number of stop bits, using 1 stop bit", dev_dbg(dev, "%s - Unknown number of stop bits, using 1 stop bit\n", __func__);
__func__);
bits &= ~BITS_STOP_MASK; bits &= ~BITS_STOP_MASK;
cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
break; break;
...@@ -590,10 +586,10 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, ...@@ -590,10 +586,10 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16); cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16);
if (modem_ctl[0] & 0x0008) { if (modem_ctl[0] & 0x0008) {
dbg("%s - flow control = CRTSCTS", __func__); dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__);
cflag |= CRTSCTS; cflag |= CRTSCTS;
} else { } else {
dbg("%s - flow control = NONE", __func__); dev_dbg(dev, "%s - flow control = NONE\n", __func__);
cflag &= ~CRTSCTS; cflag &= ~CRTSCTS;
} }
...@@ -640,7 +636,7 @@ static void cp210x_change_speed(struct tty_struct *tty, ...@@ -640,7 +636,7 @@ static void cp210x_change_speed(struct tty_struct *tty,
*/ */
baud = cp210x_quantise_baudrate(baud); baud = cp210x_quantise_baudrate(baud);
dbg("%s - setting baud rate to %u", __func__, baud); dev_dbg(&port->dev, "%s - setting baud rate to %u\n", __func__, baud);
if (cp210x_set_config(port, CP210X_SET_BAUDRATE, &baud, if (cp210x_set_config(port, CP210X_SET_BAUDRATE, &baud,
sizeof(baud))) { sizeof(baud))) {
dev_warn(&port->dev, "failed to set baud rate to %u\n", baud); dev_warn(&port->dev, "failed to set baud rate to %u\n", baud);
...@@ -656,11 +652,12 @@ static void cp210x_change_speed(struct tty_struct *tty, ...@@ -656,11 +652,12 @@ static void cp210x_change_speed(struct tty_struct *tty,
static void cp210x_set_termios(struct tty_struct *tty, static void cp210x_set_termios(struct tty_struct *tty,
struct usb_serial_port *port, struct ktermios *old_termios) struct usb_serial_port *port, struct ktermios *old_termios)
{ {
struct device *dev = &port->dev;
unsigned int cflag, old_cflag; unsigned int cflag, old_cflag;
unsigned int bits; unsigned int bits;
unsigned int modem_ctl[4]; unsigned int modem_ctl[4];
dbg("%s - port %d", __func__, port->number); dev_dbg(dev, "%s - port %d\n", __func__, port->number);
if (!tty) if (!tty)
return; return;
...@@ -678,34 +675,31 @@ static void cp210x_set_termios(struct tty_struct *tty, ...@@ -678,34 +675,31 @@ static void cp210x_set_termios(struct tty_struct *tty,
switch (cflag & CSIZE) { switch (cflag & CSIZE) {
case CS5: case CS5:
bits |= BITS_DATA_5; bits |= BITS_DATA_5;
dbg("%s - data bits = 5", __func__); dev_dbg(dev, "%s - data bits = 5\n", __func__);
break; break;
case CS6: case CS6:
bits |= BITS_DATA_6; bits |= BITS_DATA_6;
dbg("%s - data bits = 6", __func__); dev_dbg(dev, "%s - data bits = 6\n", __func__);
break; break;
case CS7: case CS7:
bits |= BITS_DATA_7; bits |= BITS_DATA_7;
dbg("%s - data bits = 7", __func__); dev_dbg(dev, "%s - data bits = 7\n", __func__);
break; break;
case CS8: case CS8:
bits |= BITS_DATA_8; bits |= BITS_DATA_8;
dbg("%s - data bits = 8", __func__); dev_dbg(dev, "%s - data bits = 8\n", __func__);
break; break;
/*case CS9: /*case CS9:
bits |= BITS_DATA_9; bits |= BITS_DATA_9;
dbg("%s - data bits = 9", __func__); dev_dbg(dev, "%s - data bits = 9\n", __func__);
break;*/ break;*/
default: default:
dbg("cp210x driver does not " dev_dbg(dev, "cp210x driver does not support the number of bits requested, using 8 bit mode\n");
"support the number of bits requested,"
" using 8 bit mode");
bits |= BITS_DATA_8; bits |= BITS_DATA_8;
break; break;
} }
if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
dbg("Number of data bits requested " dev_dbg(dev, "Number of data bits requested not supported by device\n");
"not supported by device");
} }
if ((cflag & (PARENB|PARODD|CMSPAR)) != if ((cflag & (PARENB|PARODD|CMSPAR)) !=
...@@ -716,23 +710,23 @@ static void cp210x_set_termios(struct tty_struct *tty, ...@@ -716,23 +710,23 @@ static void cp210x_set_termios(struct tty_struct *tty,
if (cflag & CMSPAR) { if (cflag & CMSPAR) {
if (cflag & PARODD) { if (cflag & PARODD) {
bits |= BITS_PARITY_MARK; bits |= BITS_PARITY_MARK;
dbg("%s - parity = MARK", __func__); dev_dbg(dev, "%s - parity = MARK\n", __func__);
} else { } else {
bits |= BITS_PARITY_SPACE; bits |= BITS_PARITY_SPACE;
dbg("%s - parity = SPACE", __func__); dev_dbg(dev, "%s - parity = SPACE\n", __func__);
} }
} else { } else {
if (cflag & PARODD) { if (cflag & PARODD) {
bits |= BITS_PARITY_ODD; bits |= BITS_PARITY_ODD;
dbg("%s - parity = ODD", __func__); dev_dbg(dev, "%s - parity = ODD\n", __func__);
} else { } else {
bits |= BITS_PARITY_EVEN; bits |= BITS_PARITY_EVEN;
dbg("%s - parity = EVEN", __func__); dev_dbg(dev, "%s - parity = EVEN\n", __func__);
} }
} }
} }
if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
dbg("Parity mode not supported by device"); dev_dbg(dev, "Parity mode not supported by device\n");
} }
if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) { if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) {
...@@ -740,19 +734,18 @@ static void cp210x_set_termios(struct tty_struct *tty, ...@@ -740,19 +734,18 @@ static void cp210x_set_termios(struct tty_struct *tty,
bits &= ~BITS_STOP_MASK; bits &= ~BITS_STOP_MASK;
if (cflag & CSTOPB) { if (cflag & CSTOPB) {
bits |= BITS_STOP_2; bits |= BITS_STOP_2;
dbg("%s - stop bits = 2", __func__); dev_dbg(dev, "%s - stop bits = 2\n", __func__);
} else { } else {
bits |= BITS_STOP_1; bits |= BITS_STOP_1;
dbg("%s - stop bits = 1", __func__); dev_dbg(dev, "%s - stop bits = 1\n", __func__);
} }
if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
dbg("Number of stop bits requested " dev_dbg(dev, "Number of stop bits requested not supported by device\n");
"not supported by device");
} }
if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) { if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) {
cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16); cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16);
dbg("%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x", dev_dbg(dev, "%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x\n",
__func__, modem_ctl[0], modem_ctl[1], __func__, modem_ctl[0], modem_ctl[1],
modem_ctl[2], modem_ctl[3]); modem_ctl[2], modem_ctl[3]);
...@@ -760,15 +753,15 @@ static void cp210x_set_termios(struct tty_struct *tty, ...@@ -760,15 +753,15 @@ static void cp210x_set_termios(struct tty_struct *tty,
modem_ctl[0] &= ~0x7B; modem_ctl[0] &= ~0x7B;
modem_ctl[0] |= 0x09; modem_ctl[0] |= 0x09;
modem_ctl[1] = 0x80; modem_ctl[1] = 0x80;
dbg("%s - flow control = CRTSCTS", __func__); dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__);
} else { } else {
modem_ctl[0] &= ~0x7B; modem_ctl[0] &= ~0x7B;
modem_ctl[0] |= 0x01; modem_ctl[0] |= 0x01;
modem_ctl[1] |= 0x40; modem_ctl[1] |= 0x40;
dbg("%s - flow control = NONE", __func__); dev_dbg(dev, "%s - flow control = NONE\n", __func__);
} }
dbg("%s - write modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x", dev_dbg(dev, "%s - write modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x\n",
__func__, modem_ctl[0], modem_ctl[1], __func__, modem_ctl[0], modem_ctl[1],
modem_ctl[2], modem_ctl[3]); modem_ctl[2], modem_ctl[3]);
cp210x_set_config(port, CP210X_SET_FLOW, modem_ctl, 16); cp210x_set_config(port, CP210X_SET_FLOW, modem_ctl, 16);
...@@ -805,7 +798,7 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, ...@@ -805,7 +798,7 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port,
control |= CONTROL_WRITE_DTR; control |= CONTROL_WRITE_DTR;
} }
dbg("%s - control = 0x%.4x", __func__, control); dev_dbg(&port->dev, "%s - control = 0x%.4x\n", __func__, control);
return cp210x_set_config(port, CP210X_SET_MHS, &control, 2); return cp210x_set_config(port, CP210X_SET_MHS, &control, 2);
} }
...@@ -833,7 +826,7 @@ static int cp210x_tiocmget (struct tty_struct *tty) ...@@ -833,7 +826,7 @@ static int cp210x_tiocmget (struct tty_struct *tty)
|((control & CONTROL_RING)? TIOCM_RI : 0) |((control & CONTROL_RING)? TIOCM_RI : 0)
|((control & CONTROL_DCD) ? TIOCM_CD : 0); |((control & CONTROL_DCD) ? TIOCM_CD : 0);
dbg("%s - control = 0x%.2x", __func__, control); dev_dbg(&port->dev, "%s - control = 0x%.2x\n", __func__, control);
return result; return result;
} }
...@@ -847,7 +840,7 @@ static void cp210x_break_ctl (struct tty_struct *tty, int break_state) ...@@ -847,7 +840,7 @@ static void cp210x_break_ctl (struct tty_struct *tty, int break_state)
state = BREAK_OFF; state = BREAK_OFF;
else else
state = BREAK_ON; state = BREAK_ON;
dbg("%s - turning break %s", __func__, dev_dbg(&port->dev, "%s - turning break %s\n", __func__,
state == BREAK_OFF ? "off" : "on"); state == BREAK_OFF ? "off" : "on");
cp210x_set_config(port, CP210X_SET_BREAK, &state, 2); cp210x_set_config(port, CP210X_SET_BREAK, &state, 2);
} }
......
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