Commit ff7eb602 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

cp2101: coding style

Bring up to coding style
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c17ee886
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <asm/uaccess.h> #include <linux/uaccess.h>
#include <linux/usb/serial.h> #include <linux/usb/serial.h>
/* /*
...@@ -45,12 +45,12 @@ static void cp2101_close(struct tty_struct *, struct usb_serial_port *, ...@@ -45,12 +45,12 @@ static void cp2101_close(struct tty_struct *, struct usb_serial_port *,
static void cp2101_get_termios(struct tty_struct *); static void cp2101_get_termios(struct tty_struct *);
static void cp2101_set_termios(struct tty_struct *, struct usb_serial_port *, static void cp2101_set_termios(struct tty_struct *, struct usb_serial_port *,
struct ktermios*); struct ktermios*);
static int cp2101_tiocmget (struct tty_struct *, struct file *); static int cp2101_tiocmget(struct tty_struct *, struct file *);
static int cp2101_tiocmset (struct tty_struct *, struct file *, static int cp2101_tiocmset(struct tty_struct *, struct file *,
unsigned int, unsigned int); unsigned int, unsigned int);
static void cp2101_break_ctl(struct tty_struct *, int); static void cp2101_break_ctl(struct tty_struct *, int);
static int cp2101_startup (struct usb_serial *); static int cp2101_startup(struct usb_serial *);
static void cp2101_shutdown(struct usb_serial*); static void cp2101_shutdown(struct usb_serial *);
static int debug; static int debug;
...@@ -96,7 +96,7 @@ static struct usb_device_id id_table [] = { ...@@ -96,7 +96,7 @@ static struct usb_device_id id_table [] = {
{ } /* Terminating Entry */ { } /* Terminating Entry */
}; };
MODULE_DEVICE_TABLE (usb, id_table); MODULE_DEVICE_TABLE(usb, id_table);
static struct usb_driver cp2101_driver = { static struct usb_driver cp2101_driver = {
.name = "cp2101", .name = "cp2101",
...@@ -205,12 +205,12 @@ static int cp2101_get_config(struct usb_serial_port *port, u8 request, ...@@ -205,12 +205,12 @@ static int cp2101_get_config(struct usb_serial_port *port, u8 request,
request++; request++;
/* Issue the request, attempting to read 'size' bytes */ /* Issue the request, attempting to read 'size' bytes */
result = usb_control_msg (serial->dev,usb_rcvctrlpipe (serial->dev, 0), result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
request, REQTYPE_DEVICE_TO_HOST, 0x0000, request, REQTYPE_DEVICE_TO_HOST, 0x0000,
0, buf, size, 300); 0, buf, size, 300);
/* Convert data into an array of integers */ /* Convert data into an array of integers */
for (i=0; i<length; i++) for (i = 0; i < length; i++)
data[i] = le32_to_cpu(buf[i]); data[i] = le32_to_cpu(buf[i]);
kfree(buf); kfree(buf);
...@@ -253,12 +253,12 @@ static int cp2101_set_config(struct usb_serial_port *port, u8 request, ...@@ -253,12 +253,12 @@ static int cp2101_set_config(struct usb_serial_port *port, u8 request,
buf[i] = cpu_to_le32(data[i]); buf[i] = cpu_to_le32(data[i]);
if (size > 2) { if (size > 2) {
result = usb_control_msg (serial->dev, result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0), usb_sndctrlpipe(serial->dev, 0),
request, REQTYPE_HOST_TO_DEVICE, 0x0000, request, REQTYPE_HOST_TO_DEVICE, 0x0000,
0, buf, size, 300); 0, buf, size, 300);
} else { } else {
result = usb_control_msg (serial->dev, result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0), usb_sndctrlpipe(serial->dev, 0),
request, REQTYPE_HOST_TO_DEVICE, data[0], request, REQTYPE_HOST_TO_DEVICE, data[0],
0, NULL, 0, 300); 0, NULL, 0, 300);
...@@ -274,7 +274,7 @@ static int cp2101_set_config(struct usb_serial_port *port, u8 request, ...@@ -274,7 +274,7 @@ static int cp2101_set_config(struct usb_serial_port *port, u8 request,
} }
/* Single data value */ /* Single data value */
result = usb_control_msg (serial->dev, result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0), usb_sndctrlpipe(serial->dev, 0),
request, REQTYPE_HOST_TO_DEVICE, data[0], request, REQTYPE_HOST_TO_DEVICE, data[0],
0, NULL, 0, 300); 0, NULL, 0, 300);
...@@ -292,7 +292,7 @@ static inline int cp2101_set_config_single(struct usb_serial_port *port, ...@@ -292,7 +292,7 @@ static inline int cp2101_set_config_single(struct usb_serial_port *port,
return cp2101_set_config(port, request, &data, 2); return cp2101_set_config(port, request, &data, 2);
} }
static int cp2101_open (struct tty_struct *tty, struct usb_serial_port *port, static int cp2101_open(struct tty_struct *tty, struct usb_serial_port *port,
struct file *filp) struct file *filp)
{ {
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
...@@ -307,7 +307,7 @@ static int cp2101_open (struct tty_struct *tty, struct usb_serial_port *port, ...@@ -307,7 +307,7 @@ static int cp2101_open (struct tty_struct *tty, struct usb_serial_port *port,
} }
/* Start reading from the device */ /* Start reading from the device */
usb_fill_bulk_urb (port->read_urb, serial->dev, usb_fill_bulk_urb(port->read_urb, serial->dev,
usb_rcvbulkpipe(serial->dev, usb_rcvbulkpipe(serial->dev,
port->bulk_in_endpointAddress), port->bulk_in_endpointAddress),
port->read_urb->transfer_buffer, port->read_urb->transfer_buffer,
...@@ -330,7 +330,7 @@ static int cp2101_open (struct tty_struct *tty, struct usb_serial_port *port, ...@@ -330,7 +330,7 @@ static int cp2101_open (struct tty_struct *tty, struct usb_serial_port *port,
return 0; return 0;
} }
static void cp2101_cleanup (struct usb_serial_port *port) static void cp2101_cleanup(struct usb_serial_port *port)
{ {
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
...@@ -346,7 +346,7 @@ static void cp2101_cleanup (struct usb_serial_port *port) ...@@ -346,7 +346,7 @@ static void cp2101_cleanup (struct usb_serial_port *port)
} }
static void cp2101_close(struct tty_struct *tty, struct usb_serial_port *port, static void cp2101_close(struct tty_struct *tty, struct usb_serial_port *port,
struct file * filp) struct file *filp)
{ {
dbg("%s - port %d", __func__, port->number); dbg("%s - port %d", __func__, port->number);
...@@ -388,99 +388,97 @@ static void cp2101_get_termios (struct tty_struct *tty) ...@@ -388,99 +388,97 @@ static void cp2101_get_termios (struct tty_struct *tty)
cp2101_get_config(port, CP2101_BITS, &bits, 2); cp2101_get_config(port, CP2101_BITS, &bits, 2);
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__); dbg("%s - data bits = 5", __func__);
cflag |= CS5; cflag |= CS5;
break; break;
case BITS_DATA_6: case BITS_DATA_6:
dbg("%s - data bits = 6", __func__); dbg("%s - data bits = 6", __func__);
cflag |= CS6; cflag |= CS6;
break; break;
case BITS_DATA_7: case BITS_DATA_7:
dbg("%s - data bits = 7", __func__); dbg("%s - data bits = 7", __func__);
cflag |= CS7; cflag |= CS7;
break; break;
case BITS_DATA_8: case BITS_DATA_8:
dbg("%s - data bits = 8", __func__); dbg("%s - data bits = 8", __func__);
cflag |= CS8; cflag |= CS8;
break; break;
case BITS_DATA_9: case BITS_DATA_9:
dbg("%s - data bits = 9 (not supported, " dbg("%s - data bits = 9 (not supported, using 8 data bits)",
"using 8 data bits)", __func__); __func__);
cflag |= CS8; cflag |= CS8;
bits &= ~BITS_DATA_MASK; bits &= ~BITS_DATA_MASK;
bits |= BITS_DATA_8; bits |= BITS_DATA_8;
cp2101_set_config(port, CP2101_BITS, &bits, 2); cp2101_set_config(port, CP2101_BITS, &bits, 2);
break; break;
default: default:
dbg("%s - Unknown number of data bits, " dbg("%s - Unknown number of data bits, using 8", __func__);
"using 8", __func__); cflag |= CS8;
cflag |= CS8; bits &= ~BITS_DATA_MASK;
bits &= ~BITS_DATA_MASK; bits |= BITS_DATA_8;
bits |= BITS_DATA_8; cp2101_set_config(port, CP2101_BITS, &bits, 2);
cp2101_set_config(port, CP2101_BITS, &bits, 2); break;
break;
} }
switch(bits & BITS_PARITY_MASK) { switch (bits & BITS_PARITY_MASK) {
case BITS_PARITY_NONE: case BITS_PARITY_NONE:
dbg("%s - parity = NONE", __func__); dbg("%s - parity = NONE", __func__);
cflag &= ~PARENB; cflag &= ~PARENB;
break; break;
case BITS_PARITY_ODD: case BITS_PARITY_ODD:
dbg("%s - parity = ODD", __func__); dbg("%s - parity = ODD", __func__);
cflag |= (PARENB|PARODD); cflag |= (PARENB|PARODD);
break; break;
case BITS_PARITY_EVEN: case BITS_PARITY_EVEN:
dbg("%s - parity = EVEN", __func__); dbg("%s - parity = EVEN", __func__);
cflag &= ~PARODD; cflag &= ~PARODD;
cflag |= PARENB; cflag |= PARENB;
break; break;
case BITS_PARITY_MARK: case BITS_PARITY_MARK:
dbg("%s - parity = MARK (not supported, " dbg("%s - parity = MARK (not supported, disabling parity)",
"disabling parity)", __func__); __func__);
cflag &= ~PARENB; cflag &= ~PARENB;
bits &= ~BITS_PARITY_MASK; bits &= ~BITS_PARITY_MASK;
cp2101_set_config(port, CP2101_BITS, &bits, 2); cp2101_set_config(port, CP2101_BITS, &bits, 2);
break; break;
case BITS_PARITY_SPACE: case BITS_PARITY_SPACE:
dbg("%s - parity = SPACE (not supported, " dbg("%s - parity = SPACE (not supported, disabling parity)",
"disabling parity)", __func__); __func__);
cflag &= ~PARENB; cflag &= ~PARENB;
bits &= ~BITS_PARITY_MASK; bits &= ~BITS_PARITY_MASK;
cp2101_set_config(port, CP2101_BITS, &bits, 2); cp2101_set_config(port, CP2101_BITS, &bits, 2);
break; break;
default: default:
dbg("%s - Unknown parity mode, " dbg("%s - Unknown parity mode, disabling parity", __func__);
"disabling parity", __func__); cflag &= ~PARENB;
cflag &= ~PARENB; bits &= ~BITS_PARITY_MASK;
bits &= ~BITS_PARITY_MASK; cp2101_set_config(port, CP2101_BITS, &bits, 2);
cp2101_set_config(port, CP2101_BITS, &bits, 2); break;
break;
} }
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__); dbg("%s - stop bits = 1", __func__);
break; break;
case BITS_STOP_1_5: case BITS_STOP_1_5:
dbg("%s - stop bits = 1.5 (not supported, " dbg("%s - stop bits = 1.5 (not supported, using 1 stop bit)",
"using 1 stop bit)", __func__); __func__);
bits &= ~BITS_STOP_MASK; bits &= ~BITS_STOP_MASK;
cp2101_set_config(port, CP2101_BITS, &bits, 2); cp2101_set_config(port, CP2101_BITS, &bits, 2);
break; break;
case BITS_STOP_2: case BITS_STOP_2:
dbg("%s - stop bits = 2", __func__); dbg("%s - stop bits = 2", __func__);
cflag |= CSTOPB; cflag |= CSTOPB;
break; break;
default: default:
dbg("%s - Unknown number of stop bits, " dbg("%s - Unknown number of stop bits, using 1 stop bit",
"using 1 stop bit", __func__); __func__);
bits &= ~BITS_STOP_MASK; bits &= ~BITS_STOP_MASK;
cp2101_set_config(port, CP2101_BITS, &bits, 2); cp2101_set_config(port, CP2101_BITS, &bits, 2);
break; break;
} }
cp2101_get_config(port, CP2101_MODEMCTL, modem_ctl, 16); cp2101_get_config(port, CP2101_MODEMCTL, modem_ctl, 16);
...@@ -495,7 +493,7 @@ static void cp2101_get_termios (struct tty_struct *tty) ...@@ -495,7 +493,7 @@ static void cp2101_get_termios (struct tty_struct *tty)
tty->termios->c_cflag = cflag; tty->termios->c_cflag = cflag;
} }
static void cp2101_set_termios (struct tty_struct *tty, static void cp2101_set_termios(struct tty_struct *tty,
struct usb_serial_port *port, struct ktermios *old_termios) struct usb_serial_port *port, struct ktermios *old_termios)
{ {
unsigned int cflag, old_cflag; unsigned int cflag, old_cflag;
...@@ -515,30 +513,30 @@ static void cp2101_set_termios (struct tty_struct *tty, ...@@ -515,30 +513,30 @@ static void cp2101_set_termios (struct tty_struct *tty,
/* If the baud rate is to be updated*/ /* If the baud rate is to be updated*/
if (baud != tty_termios_baud_rate(old_termios)) { if (baud != tty_termios_baud_rate(old_termios)) {
switch (baud) { switch (baud) {
case 0: case 0:
case 600: case 600:
case 1200: case 1200:
case 1800: case 1800:
case 2400: case 2400:
case 4800: case 4800:
case 7200: case 7200:
case 9600: case 9600:
case 14400: case 14400:
case 19200: case 19200:
case 28800: case 28800:
case 38400: case 38400:
case 55854: case 55854:
case 57600: case 57600:
case 115200: case 115200:
case 127117: case 127117:
case 230400: case 230400:
case 460800: case 460800:
case 921600: case 921600:
case 3686400: case 3686400:
break; break;
default: default:
baud = 9600; baud = 9600;
break; break;
} }
if (baud) { if (baud) {
...@@ -560,28 +558,28 @@ static void cp2101_set_termios (struct tty_struct *tty, ...@@ -560,28 +558,28 @@ static void cp2101_set_termios (struct tty_struct *tty,
cp2101_get_config(port, CP2101_BITS, &bits, 2); cp2101_get_config(port, CP2101_BITS, &bits, 2);
bits &= ~BITS_DATA_MASK; bits &= ~BITS_DATA_MASK;
switch (cflag & CSIZE) { switch (cflag & CSIZE) {
case CS5: case CS5:
bits |= BITS_DATA_5; bits |= BITS_DATA_5;
dbg("%s - data bits = 5", __func__); dbg("%s - data bits = 5", __func__);
break; break;
case CS6: case CS6:
bits |= BITS_DATA_6; bits |= BITS_DATA_6;
dbg("%s - data bits = 6", __func__); dbg("%s - data bits = 6", __func__);
break; break;
case CS7: case CS7:
bits |= BITS_DATA_7; bits |= BITS_DATA_7;
dbg("%s - data bits = 7", __func__); dbg("%s - data bits = 7", __func__);
break; break;
case CS8: case CS8:
bits |= BITS_DATA_8; bits |= BITS_DATA_8;
dbg("%s - data bits = 8", __func__); dbg("%s - data bits = 8", __func__);
break; break;
/*case CS9: /*case CS9:
bits |= BITS_DATA_9; bits |= BITS_DATA_9;
dbg("%s - data bits = 9", __func__); dbg("%s - data bits = 9", __func__);
break;*/ break;*/
default: default:
dev_err(&port->dev, "cp2101 driver does not " dev_err(&port->dev, "cp2101 driver does not "
"support the number of bits requested," "support the number of bits requested,"
" using 8 bit mode\n"); " using 8 bit mode\n");
bits |= BITS_DATA_8; bits |= BITS_DATA_8;
...@@ -714,30 +712,29 @@ static void cp2101_break_ctl (struct tty_struct *tty, int break_state) ...@@ -714,30 +712,29 @@ static void cp2101_break_ctl (struct tty_struct *tty, int break_state)
else else
state = BREAK_ON; state = BREAK_ON;
dbg("%s - turning break %s", __func__, dbg("%s - turning break %s", __func__,
state==BREAK_OFF ? "off" : "on"); state == BREAK_OFF ? "off" : "on");
cp2101_set_config(port, CP2101_BREAK, &state, 2); cp2101_set_config(port, CP2101_BREAK, &state, 2);
} }
static int cp2101_startup (struct usb_serial *serial) static int cp2101_startup(struct usb_serial *serial)
{ {
/* CP2101 buffers behave strangely unless device is reset */ /* CP2101 buffers behave strangely unless device is reset */
usb_reset_device(serial->dev); usb_reset_device(serial->dev);
return 0; return 0;
} }
static void cp2101_shutdown (struct usb_serial *serial) static void cp2101_shutdown(struct usb_serial *serial)
{ {
int i; int i;
dbg("%s", __func__); dbg("%s", __func__);
/* Stop reads and writes on all ports */ /* Stop reads and writes on all ports */
for (i=0; i < serial->num_ports; ++i) { for (i = 0; i < serial->num_ports; ++i)
cp2101_cleanup(serial->port[i]); cp2101_cleanup(serial->port[i]);
}
} }
static int __init cp2101_init (void) static int __init cp2101_init(void)
{ {
int retval; int retval;
...@@ -757,10 +754,10 @@ static int __init cp2101_init (void) ...@@ -757,10 +754,10 @@ static int __init cp2101_init (void)
return 0; return 0;
} }
static void __exit cp2101_exit (void) static void __exit cp2101_exit(void)
{ {
usb_deregister (&cp2101_driver); usb_deregister(&cp2101_driver);
usb_serial_deregister (&cp2101_device); usb_serial_deregister(&cp2101_device);
} }
module_init(cp2101_init); module_init(cp2101_init);
......
...@@ -646,7 +646,6 @@ static int whiteheat_open(struct tty_struct *tty, ...@@ -646,7 +646,6 @@ static int whiteheat_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp) struct usb_serial_port *port, struct file *filp)
{ {
int retval = 0; int retval = 0;
struct ktermios old_term;
dbg("%s - port %d", __func__, port->number); dbg("%s - port %d", __func__, port->number);
......
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