diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-01 13:23:01 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-01 13:23:01 -0700 |
commit | d9a807461fc8cc0d6ba589ea0730d139122af012 (patch) | |
tree | 9d8c7a044659d821748dd40718a22557c04e4299 /drivers/usb/serial/cp210x.c | |
parent | 3498d13b8090c0b0ef911409fbc503a7c4cca6ef (diff) | |
parent | 70c048a238c780c226eb4b115ebaa908cb3b34ec (diff) | |
download | op-kernel-dev-d9a807461fc8cc0d6ba589ea0730d139122af012.zip op-kernel-dev-d9a807461fc8cc0d6ba589ea0730d139122af012.tar.gz |
Merge tag 'usb-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB changes from Greg Kroah-Hartman:
"Here is the big USB pull request for 3.7-rc1
There are lots of gadget driver changes (including copying a bunch of
files into the drivers/staging/ccg/ directory so that the other gadget
drivers can be fixed up properly without breaking that driver), and we
remove the old obsolete ub.c driver from the tree.
There are also the usual XHCI set of updates, and other various driver
changes and updates. We also are trying hard to remove the old dbg()
macro, but the final bits of that removal will be coming in through
the networking tree before we can delete it for good.
All of these patches have been in the linux-next tree.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
Fix up several annoying - but fairly mindless - conflicts due to the
termios structure having moved into the tty device, and often clashing
with dbg -> dev_dbg conversion.
* tag 'usb-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (339 commits)
USB: ezusb: move ezusb.c from drivers/usb/serial to drivers/usb/misc
USB: uas: fix gcc warning
USB: uas: fix locking
USB: Fix race condition when removing host controllers
USB: uas: add locking
USB: uas: fix abort
USB: uas: remove aborted field, replace with status bit.
USB: uas: fix task management
USB: uas: keep track of command urbs
xhci: Intel Panther Point BEI quirk.
powerpc/usb: remove checking PHY_CLK_VALID for UTMI PHY
USB: ftdi_sio: add TIAO USB Multi-Protocol Adapter (TUMPA) support
Revert "usb : Add sysfs files to control port power."
USB: serial: remove vizzini driver
usb: host: xhci: Fix Null pointer dereferencing with 71c731a for non-x86 systems
Increase XHCI suspend timeout to 16ms
USB: ohci-at91: fix null pointer in ohci_hcd_at91_overcurrent_irq
USB: sierra_ms: don't keep unused variable
fsl/usb: Add support for USB controller version 2.4
USB: qcaux: add Pantech vendor class match
...
Diffstat (limited to 'drivers/usb/serial/cp210x.c')
-rw-r--r-- | drivers/usb/serial/cp210x.c | 141 |
1 files changed, 64 insertions, 77 deletions
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index ba5e07e1..28af5ac 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -52,8 +52,6 @@ static int cp210x_startup(struct usb_serial *); static void cp210x_release(struct usb_serial *); static void cp210x_dtr_rts(struct usb_serial_port *p, int on); -static bool debug; - static const struct usb_device_id id_table[] = { { USB_DEVICE(0x045B, 0x0053) }, /* Renesas RX610 RX-Stick */ { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */ @@ -304,9 +302,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request, kfree(buf); if (result != size) { - dbg("%s - Unable to send config request, " - "request=0x%x size=%d result=%d", - __func__, request, size, result); + dev_dbg(&port->dev, "%s - Unable to send config request, request=0x%x size=%d result=%d\n", + __func__, request, size, result); if (result > 0) result = -EPROTO; @@ -361,9 +358,8 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request, kfree(buf); if ((size > 2 && result != size) || result < 0) { - dbg("%s - Unable to send request, " - "request=0x%x size=%d result=%d", - __func__, request, size, result); + dev_dbg(&port->dev, "%s - Unable to send request, request=0x%x size=%d result=%d\n", + __func__, request, size, result); if (result > 0) result = -EPROTO; @@ -487,13 +483,14 @@ static void cp210x_get_termios(struct tty_struct *tty, static void cp210x_get_termios_port(struct usb_serial_port *port, unsigned int *cflagp, unsigned int *baudp) { + struct device *dev = &port->dev; unsigned int cflag, modem_ctl[4]; unsigned int baud; unsigned int bits; 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; cflag = *cflagp; @@ -502,31 +499,30 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, cflag &= ~CSIZE; switch (bits & BITS_DATA_MASK) { case BITS_DATA_5: - dbg("%s - data bits = 5", __func__); + dev_dbg(dev, "%s - data bits = 5\n", __func__); cflag |= CS5; break; case BITS_DATA_6: - dbg("%s - data bits = 6", __func__); + dev_dbg(dev, "%s - data bits = 6\n", __func__); cflag |= CS6; break; case BITS_DATA_7: - dbg("%s - data bits = 7", __func__); + dev_dbg(dev, "%s - data bits = 7\n", __func__); cflag |= CS7; break; case BITS_DATA_8: - dbg("%s - data bits = 8", __func__); + dev_dbg(dev, "%s - data bits = 8\n", __func__); cflag |= CS8; break; case BITS_DATA_9: - dbg("%s - data bits = 9 (not supported, using 8 data bits)", - __func__); + dev_dbg(dev, "%s - data bits = 9 (not supported, using 8 data bits)\n", __func__); cflag |= CS8; bits &= ~BITS_DATA_MASK; bits |= BITS_DATA_8; cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); break; 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; bits &= ~BITS_DATA_MASK; bits |= BITS_DATA_8; @@ -536,29 +532,29 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, switch (bits & BITS_PARITY_MASK) { case BITS_PARITY_NONE: - dbg("%s - parity = NONE", __func__); + dev_dbg(dev, "%s - parity = NONE\n", __func__); cflag &= ~PARENB; break; case BITS_PARITY_ODD: - dbg("%s - parity = ODD", __func__); + dev_dbg(dev, "%s - parity = ODD\n", __func__); cflag |= (PARENB|PARODD); break; case BITS_PARITY_EVEN: - dbg("%s - parity = EVEN", __func__); + dev_dbg(dev, "%s - parity = EVEN\n", __func__); cflag &= ~PARODD; cflag |= PARENB; break; case BITS_PARITY_MARK: - dbg("%s - parity = MARK", __func__); + dev_dbg(dev, "%s - parity = MARK\n", __func__); cflag |= (PARENB|PARODD|CMSPAR); break; case BITS_PARITY_SPACE: - dbg("%s - parity = SPACE", __func__); + dev_dbg(dev, "%s - parity = SPACE\n", __func__); cflag &= ~PARODD; cflag |= (PARENB|CMSPAR); break; default: - dbg("%s - Unknown parity mode, disabling parity", __func__); + dev_dbg(dev, "%s - Unknown parity mode, disabling parity\n", __func__); cflag &= ~PARENB; bits &= ~BITS_PARITY_MASK; cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); @@ -568,21 +564,19 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, cflag &= ~CSTOPB; switch (bits & BITS_STOP_MASK) { case BITS_STOP_1: - dbg("%s - stop bits = 1", __func__); + dev_dbg(dev, "%s - stop bits = 1\n", __func__); break; case BITS_STOP_1_5: - dbg("%s - stop bits = 1.5 (not supported, using 1 stop bit)", - __func__); + dev_dbg(dev, "%s - stop bits = 1.5 (not supported, using 1 stop bit)\n", __func__); bits &= ~BITS_STOP_MASK; cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); break; case BITS_STOP_2: - dbg("%s - stop bits = 2", __func__); + dev_dbg(dev, "%s - stop bits = 2\n", __func__); cflag |= CSTOPB; break; default: - dbg("%s - Unknown number of stop bits, using 1 stop bit", - __func__); + dev_dbg(dev, "%s - Unknown number of stop bits, using 1 stop bit\n", __func__); bits &= ~BITS_STOP_MASK; cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); break; @@ -590,10 +584,10 @@ static void cp210x_get_termios_port(struct usb_serial_port *port, cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16); if (modem_ctl[0] & 0x0008) { - dbg("%s - flow control = CRTSCTS", __func__); + dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__); cflag |= CRTSCTS; } else { - dbg("%s - flow control = NONE", __func__); + dev_dbg(dev, "%s - flow control = NONE\n", __func__); cflag &= ~CRTSCTS; } @@ -640,7 +634,7 @@ static void cp210x_change_speed(struct tty_struct *tty, */ 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, sizeof(baud))) { dev_warn(&port->dev, "failed to set baud rate to %u\n", baud); @@ -656,11 +650,12 @@ static void cp210x_change_speed(struct tty_struct *tty, static void cp210x_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios) { + struct device *dev = &port->dev; unsigned int cflag, old_cflag; unsigned int bits; unsigned int modem_ctl[4]; - dbg("%s - port %d", __func__, port->number); + dev_dbg(dev, "%s - port %d\n", __func__, port->number); if (!tty) return; @@ -678,34 +673,31 @@ static void cp210x_set_termios(struct tty_struct *tty, switch (cflag & CSIZE) { case CS5: bits |= BITS_DATA_5; - dbg("%s - data bits = 5", __func__); + dev_dbg(dev, "%s - data bits = 5\n", __func__); break; case CS6: bits |= BITS_DATA_6; - dbg("%s - data bits = 6", __func__); + dev_dbg(dev, "%s - data bits = 6\n", __func__); break; case CS7: bits |= BITS_DATA_7; - dbg("%s - data bits = 7", __func__); + dev_dbg(dev, "%s - data bits = 7\n", __func__); break; case CS8: bits |= BITS_DATA_8; - dbg("%s - data bits = 8", __func__); + dev_dbg(dev, "%s - data bits = 8\n", __func__); break; /*case CS9: bits |= BITS_DATA_9; - dbg("%s - data bits = 9", __func__); + dev_dbg(dev, "%s - data bits = 9\n", __func__); break;*/ default: - dbg("cp210x driver does not " - "support the number of bits requested," - " using 8 bit mode"); + dev_dbg(dev, "cp210x driver does not support the number of bits requested, using 8 bit mode\n"); bits |= BITS_DATA_8; break; } if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) - dbg("Number of data bits requested " - "not supported by device"); + dev_dbg(dev, "Number of data bits requested not supported by device\n"); } if ((cflag & (PARENB|PARODD|CMSPAR)) != @@ -714,25 +706,25 @@ static void cp210x_set_termios(struct tty_struct *tty, bits &= ~BITS_PARITY_MASK; if (cflag & PARENB) { if (cflag & CMSPAR) { - if (cflag & PARODD) { - bits |= BITS_PARITY_MARK; - dbg("%s - parity = MARK", __func__); - } else { - bits |= BITS_PARITY_SPACE; - dbg("%s - parity = SPACE", __func__); - } + if (cflag & PARODD) { + bits |= BITS_PARITY_MARK; + dev_dbg(dev, "%s - parity = MARK\n", __func__); + } else { + bits |= BITS_PARITY_SPACE; + dev_dbg(dev, "%s - parity = SPACE\n", __func__); + } } else { - if (cflag & PARODD) { - bits |= BITS_PARITY_ODD; - dbg("%s - parity = ODD", __func__); - } else { - bits |= BITS_PARITY_EVEN; - dbg("%s - parity = EVEN", __func__); - } + if (cflag & PARODD) { + bits |= BITS_PARITY_ODD; + dev_dbg(dev, "%s - parity = ODD\n", __func__); + } else { + bits |= BITS_PARITY_EVEN; + dev_dbg(dev, "%s - parity = EVEN\n", __func__); + } } } 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)) { @@ -740,37 +732,36 @@ static void cp210x_set_termios(struct tty_struct *tty, bits &= ~BITS_STOP_MASK; if (cflag & CSTOPB) { bits |= BITS_STOP_2; - dbg("%s - stop bits = 2", __func__); + dev_dbg(dev, "%s - stop bits = 2\n", __func__); } else { 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)) - dbg("Number of stop bits requested " - "not supported by device"); + dev_dbg(dev, "Number of stop bits requested not supported by device\n"); } if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) { cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16); - dbg("%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x", - __func__, modem_ctl[0], modem_ctl[1], - modem_ctl[2], modem_ctl[3]); + dev_dbg(dev, "%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x\n", + __func__, modem_ctl[0], modem_ctl[1], + modem_ctl[2], modem_ctl[3]); if (cflag & CRTSCTS) { modem_ctl[0] &= ~0x7B; modem_ctl[0] |= 0x09; modem_ctl[1] = 0x80; - dbg("%s - flow control = CRTSCTS", __func__); + dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__); } else { modem_ctl[0] &= ~0x7B; modem_ctl[0] |= 0x01; 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", - __func__, modem_ctl[0], modem_ctl[1], - modem_ctl[2], modem_ctl[3]); + dev_dbg(dev, "%s - write modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x\n", + __func__, modem_ctl[0], modem_ctl[1], + modem_ctl[2], modem_ctl[3]); cp210x_set_config(port, CP210X_SET_FLOW, modem_ctl, 16); } @@ -805,7 +796,7 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, 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); } @@ -833,7 +824,7 @@ static int cp210x_tiocmget (struct tty_struct *tty) |((control & CONTROL_RING)? TIOCM_RI : 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; } @@ -847,8 +838,8 @@ static void cp210x_break_ctl (struct tty_struct *tty, int break_state) state = BREAK_OFF; else state = BREAK_ON; - dbg("%s - turning break %s", __func__, - state == BREAK_OFF ? "off" : "on"); + dev_dbg(&port->dev, "%s - turning break %s\n", __func__, + state == BREAK_OFF ? "off" : "on"); cp210x_set_config(port, CP210X_SET_BREAK, &state, 2); } @@ -865,7 +856,6 @@ static int cp210x_startup(struct usb_serial *serial) if (!port_priv) return -ENOMEM; - memset(port_priv, 0x00, sizeof(*port_priv)); port_priv->bInterfaceNumber = serial->interface->cur_altsetting->desc.bInterfaceNumber; @@ -892,6 +882,3 @@ module_usb_serial_driver(serial_drivers, id_table); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_VERSION(DRIVER_VERSION); MODULE_LICENSE("GPL"); - -module_param(debug, bool, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(debug, "Enable verbose debugging messages"); |