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 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/usb.h>
#include <asm/uaccess.h>
#include <linux/uaccess.h>
#include <linux/usb/serial.h>
/*
......@@ -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_set_termios(struct tty_struct *, struct usb_serial_port *,
struct ktermios*);
static int cp2101_tiocmget (struct tty_struct *, struct file *);
static int cp2101_tiocmset (struct tty_struct *, struct file *,
static int cp2101_tiocmget(struct tty_struct *, struct file *);
static int cp2101_tiocmset(struct tty_struct *, struct file *,
unsigned int, unsigned int);
static void cp2101_break_ctl(struct tty_struct *, int);
static int cp2101_startup (struct usb_serial *);
static void cp2101_shutdown(struct usb_serial*);
static int cp2101_startup(struct usb_serial *);
static void cp2101_shutdown(struct usb_serial *);
static int debug;
......@@ -96,7 +96,7 @@ static struct usb_device_id id_table [] = {
{ } /* Terminating Entry */
};
MODULE_DEVICE_TABLE (usb, id_table);
MODULE_DEVICE_TABLE(usb, id_table);
static struct usb_driver cp2101_driver = {
.name = "cp2101",
......@@ -205,12 +205,12 @@ static int cp2101_get_config(struct usb_serial_port *port, u8 request,
request++;
/* 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,
0, buf, size, 300);
/* 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]);
kfree(buf);
......@@ -253,12 +253,12 @@ static int cp2101_set_config(struct usb_serial_port *port, u8 request,
buf[i] = cpu_to_le32(data[i]);
if (size > 2) {
result = usb_control_msg (serial->dev,
result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0),
request, REQTYPE_HOST_TO_DEVICE, 0x0000,
0, buf, size, 300);
} else {
result = usb_control_msg (serial->dev,
result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0),
request, REQTYPE_HOST_TO_DEVICE, data[0],
0, NULL, 0, 300);
......@@ -274,7 +274,7 @@ static int cp2101_set_config(struct usb_serial_port *port, u8 request,
}
/* Single data value */
result = usb_control_msg (serial->dev,
result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0),
request, REQTYPE_HOST_TO_DEVICE, data[0],
0, NULL, 0, 300);
......@@ -292,7 +292,7 @@ static inline int cp2101_set_config_single(struct usb_serial_port *port,
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 usb_serial *serial = port->serial;
......@@ -307,7 +307,7 @@ static int cp2101_open (struct tty_struct *tty, struct usb_serial_port *port,
}
/* 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,
port->bulk_in_endpointAddress),
port->read_urb->transfer_buffer,
......@@ -330,7 +330,7 @@ static int cp2101_open (struct tty_struct *tty, struct usb_serial_port *port,
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;
......@@ -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,
struct file * filp)
struct file *filp)
{
dbg("%s - port %d", __func__, port->number);
......@@ -388,7 +388,7 @@ static void cp2101_get_termios (struct tty_struct *tty)
cp2101_get_config(port, CP2101_BITS, &bits, 2);
cflag &= ~CSIZE;
switch(bits & BITS_DATA_MASK) {
switch (bits & BITS_DATA_MASK) {
case BITS_DATA_5:
dbg("%s - data bits = 5", __func__);
cflag |= CS5;
......@@ -406,16 +406,15 @@ static void cp2101_get_termios (struct tty_struct *tty)
cflag |= CS8;
break;
case BITS_DATA_9:
dbg("%s - data bits = 9 (not supported, "
"using 8 data bits)", __func__);
dbg("%s - data bits = 9 (not supported, using 8 data bits)",
__func__);
cflag |= CS8;
bits &= ~BITS_DATA_MASK;
bits |= BITS_DATA_8;
cp2101_set_config(port, CP2101_BITS, &bits, 2);
break;
default:
dbg("%s - Unknown number of data bits, "
"using 8", __func__);
dbg("%s - Unknown number of data bits, using 8", __func__);
cflag |= CS8;
bits &= ~BITS_DATA_MASK;
bits |= BITS_DATA_8;
......@@ -423,7 +422,7 @@ static void cp2101_get_termios (struct tty_struct *tty)
break;
}
switch(bits & BITS_PARITY_MASK) {
switch (bits & BITS_PARITY_MASK) {
case BITS_PARITY_NONE:
dbg("%s - parity = NONE", __func__);
cflag &= ~PARENB;
......@@ -438,22 +437,21 @@ static void cp2101_get_termios (struct tty_struct *tty)
cflag |= PARENB;
break;
case BITS_PARITY_MARK:
dbg("%s - parity = MARK (not supported, "
"disabling parity)", __func__);
dbg("%s - parity = MARK (not supported, disabling parity)",
__func__);
cflag &= ~PARENB;
bits &= ~BITS_PARITY_MASK;
cp2101_set_config(port, CP2101_BITS, &bits, 2);
break;
case BITS_PARITY_SPACE:
dbg("%s - parity = SPACE (not supported, "
"disabling parity)", __func__);
dbg("%s - parity = SPACE (not supported, disabling parity)",
__func__);
cflag &= ~PARENB;
bits &= ~BITS_PARITY_MASK;
cp2101_set_config(port, CP2101_BITS, &bits, 2);
break;
default:
dbg("%s - Unknown parity mode, "
"disabling parity", __func__);
dbg("%s - Unknown parity mode, disabling parity", __func__);
cflag &= ~PARENB;
bits &= ~BITS_PARITY_MASK;
cp2101_set_config(port, CP2101_BITS, &bits, 2);
......@@ -461,13 +459,13 @@ static void cp2101_get_termios (struct tty_struct *tty)
}
cflag &= ~CSTOPB;
switch(bits & BITS_STOP_MASK) {
switch (bits & BITS_STOP_MASK) {
case BITS_STOP_1:
dbg("%s - stop bits = 1", __func__);
break;
case BITS_STOP_1_5:
dbg("%s - stop bits = 1.5 (not supported, "
"using 1 stop bit)", __func__);
dbg("%s - stop bits = 1.5 (not supported, using 1 stop bit)",
__func__);
bits &= ~BITS_STOP_MASK;
cp2101_set_config(port, CP2101_BITS, &bits, 2);
break;
......@@ -476,8 +474,8 @@ static void cp2101_get_termios (struct tty_struct *tty)
cflag |= CSTOPB;
break;
default:
dbg("%s - Unknown number of stop bits, "
"using 1 stop bit", __func__);
dbg("%s - Unknown number of stop bits, using 1 stop bit",
__func__);
bits &= ~BITS_STOP_MASK;
cp2101_set_config(port, CP2101_BITS, &bits, 2);
break;
......@@ -495,7 +493,7 @@ static void cp2101_get_termios (struct tty_struct *tty)
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)
{
unsigned int cflag, old_cflag;
......@@ -714,30 +712,29 @@ static void cp2101_break_ctl (struct tty_struct *tty, int break_state)
else
state = BREAK_ON;
dbg("%s - turning break %s", __func__,
state==BREAK_OFF ? "off" : "on");
state == BREAK_OFF ? "off" : "on");
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 */
usb_reset_device(serial->dev);
return 0;
}
static void cp2101_shutdown (struct usb_serial *serial)
static void cp2101_shutdown(struct usb_serial *serial)
{
int i;
dbg("%s", __func__);
/* 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]);
}
}
static int __init cp2101_init (void)
static int __init cp2101_init(void)
{
int retval;
......@@ -757,10 +754,10 @@ static int __init cp2101_init (void)
return 0;
}
static void __exit cp2101_exit (void)
static void __exit cp2101_exit(void)
{
usb_deregister (&cp2101_driver);
usb_serial_deregister (&cp2101_device);
usb_deregister(&cp2101_driver);
usb_serial_deregister(&cp2101_device);
}
module_init(cp2101_init);
......
......@@ -646,7 +646,6 @@ static int whiteheat_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
{
int retval = 0;
struct ktermios old_term;
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