Commit 9e70f319 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

tty-usb-keyspan-pda: 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 f035a8ad
......@@ -10,7 +10,8 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* See Documentation/usb/usb-serial.txt for more information on using this driver
* See Documentation/usb/usb-serial.txt for more information on using this
* driver
*
* (09/07/2001) gkh
* cleaned up the Xircom support. Added ids for Entregra device which is
......@@ -21,7 +22,8 @@
* support for Xircom PGSDB9
*
* (05/31/2001) gkh
* switched from using spinlock to a semaphore, which fixes lots of problems.
* switched from using spinlock to a semaphore, which fixes lots of
* problems.
*
* (04/08/2001) gb
* Identify version on module load.
......@@ -78,7 +80,7 @@
#include <linux/workqueue.h>
#include <linux/firmware.h>
#include <linux/ihex.h>
#include <asm/uaccess.h>
#include <linux/uaccess.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
......@@ -135,7 +137,7 @@ static struct usb_device_id id_table_combined [] = {
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE (usb, id_table_combined);
MODULE_DEVICE_TABLE(usb, id_table_combined);
static struct usb_driver keyspan_pda_driver = {
.name = "keyspan_pda",
......@@ -200,7 +202,7 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work)
}
static void keyspan_pda_rx_interrupt (struct urb *urb)
static void keyspan_pda_rx_interrupt(struct urb *urb)
{
struct usb_serial_port *port = urb->context;
struct tty_struct *tty = port->port.tty;
......@@ -233,9 +235,8 @@ static void keyspan_pda_rx_interrupt (struct urb *urb)
case 0:
/* rest of message is rx data */
if (urb->actual_length) {
for (i = 1; i < urb->actual_length ; ++i) {
for (i = 1; i < urb->actual_length ; ++i)
tty_insert_flip_char(tty, data[i], 0);
}
tty_flip_buffer_push(tty);
}
break;
......@@ -259,9 +260,9 @@ static void keyspan_pda_rx_interrupt (struct urb *urb)
}
exit:
retval = usb_submit_urb (urb, GFP_ATOMIC);
retval = usb_submit_urb(urb, GFP_ATOMIC);
if (retval)
err ("%s - usb_submit_urb failed with result %d",
err("%s - usb_submit_urb failed with result %d",
__func__, retval);
}
......@@ -292,22 +293,42 @@ static void keyspan_pda_rx_unthrottle(struct tty_struct *tty)
}
static speed_t keyspan_pda_setbaud (struct usb_serial *serial, speed_t baud)
static speed_t keyspan_pda_setbaud(struct usb_serial *serial, speed_t baud)
{
int rc;
int bindex;
switch(baud) {
case 110: bindex = 0; break;
case 300: bindex = 1; break;
case 1200: bindex = 2; break;
case 2400: bindex = 3; break;
case 4800: bindex = 4; break;
case 9600: bindex = 5; break;
case 19200: bindex = 6; break;
case 38400: bindex = 7; break;
case 57600: bindex = 8; break;
case 115200: bindex = 9; break;
switch (baud) {
case 110:
bindex = 0;
break;
case 300:
bindex = 1;
break;
case 1200:
bindex = 2;
break;
case 2400:
bindex = 3;
break;
case 4800:
bindex = 4;
break;
case 9600:
bindex = 5;
break;
case 19200:
bindex = 6;
break;
case 38400:
bindex = 7;
break;
case 57600:
bindex = 8;
break;
case 115200:
bindex = 9;
break;
default:
bindex = 5; /* Default to 9600 */
baud = 9600;
......@@ -490,10 +511,10 @@ static int keyspan_pda_write(struct tty_struct *tty,
select() or poll() too) until we receive that unthrottle interrupt.
Block if we can't write anything at all, otherwise write as much as
we can. */
dbg("keyspan_pda_write(%d)",count);
dbg("keyspan_pda_write(%d)", count);
if (count == 0) {
dbg(" write request of 0 bytes");
return (0);
return 0;
}
/* we might block because of:
......@@ -551,7 +572,7 @@ static int keyspan_pda_write(struct tty_struct *tty,
if (count) {
/* now transfer data */
memcpy (port->write_urb->transfer_buffer, buf, count);
memcpy(port->write_urb->transfer_buffer, buf, count);
/* send the data out the bulk port */
port->write_urb->transfer_buffer_length = count;
......@@ -563,8 +584,7 @@ static int keyspan_pda_write(struct tty_struct *tty,
dbg(" usb_submit_urb(write bulk) failed");
goto exit;
}
}
else {
} else {
/* There wasn't any room left, so we are throttled until
the buffer empties a bit */
request_unthrottle = 1;
......@@ -583,7 +603,7 @@ static int keyspan_pda_write(struct tty_struct *tty,
}
static void keyspan_pda_write_bulk_callback (struct urb *urb)
static void keyspan_pda_write_bulk_callback(struct urb *urb)
{
struct usb_serial_port *port = urb->context;
struct keyspan_pda_private *priv;
......@@ -604,7 +624,7 @@ static int keyspan_pda_write_room(struct tty_struct *tty)
/* used by n_tty.c for processing of tabs and such. Giving it our
conservative guess is probably good enough, but needs testing by
running a console through the device. */
return (priv->tx_room);
return priv->tx_room;
}
......@@ -662,7 +682,7 @@ static int keyspan_pda_open(struct tty_struct *tty,
/* the normal serial device seems to always turn on DTR and RTS here,
so do the same */
if (tty && (tty->termios->c_cflag & CBAUD))
keyspan_pda_set_modem_info(serial, (1<<7) | (1<<2) );
keyspan_pda_set_modem_info(serial, (1<<7) | (1<<2));
else
keyspan_pda_set_modem_info(serial, 0);
......@@ -685,7 +705,8 @@ static void keyspan_pda_close(struct tty_struct *tty,
struct usb_serial *serial = port->serial;
if (serial->dev) {
/* the normal serial device seems to always shut off DTR and RTS now */
/* the normal serial device seems to always shut
off DTR and RTS now */
if (tty->termios->c_cflag & HUPCL)
keyspan_pda_set_modem_info(serial, 0);
......@@ -697,7 +718,7 @@ static void keyspan_pda_close(struct tty_struct *tty,
/* download the firmware to a "fake" device (pre-renumeration) */
static int keyspan_pda_fake_startup (struct usb_serial *serial)
static int keyspan_pda_fake_startup(struct usb_serial *serial)
{
int response;
const char *fw_name;
......@@ -746,10 +767,10 @@ static int keyspan_pda_fake_startup (struct usb_serial *serial)
response = ezusb_set_reset(serial, 0);
/* we want this device to fail to have a driver assigned to it. */
return (1);
return 1;
}
static int keyspan_pda_startup (struct usb_serial *serial)
static int keyspan_pda_startup(struct usb_serial *serial)
{
struct keyspan_pda_private *priv;
......@@ -759,17 +780,17 @@ static int keyspan_pda_startup (struct usb_serial *serial)
priv = kmalloc(sizeof(struct keyspan_pda_private), GFP_KERNEL);
if (!priv)
return (1); /* error */
return 1; /* error */
usb_set_serial_port_data(serial->port[0], priv);
init_waitqueue_head(&serial->port[0]->write_wait);
INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write);
INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle);
priv->serial = serial;
priv->port = serial->port[0];
return (0);
return 0;
}
static void keyspan_pda_shutdown (struct usb_serial *serial)
static void keyspan_pda_shutdown(struct usb_serial *serial)
{
dbg("%s", __func__);
......@@ -831,7 +852,7 @@ static struct usb_serial_driver keyspan_pda_device = {
};
static int __init keyspan_pda_init (void)
static int __init keyspan_pda_init(void)
{
int retval;
retval = usb_serial_register(&keyspan_pda_device);
......@@ -869,15 +890,15 @@ static int __init keyspan_pda_init (void)
}
static void __exit keyspan_pda_exit (void)
static void __exit keyspan_pda_exit(void)
{
usb_deregister (&keyspan_pda_driver);
usb_serial_deregister (&keyspan_pda_device);
usb_deregister(&keyspan_pda_driver);
usb_serial_deregister(&keyspan_pda_device);
#ifdef KEYSPAN
usb_serial_deregister (&keyspan_pda_fake_device);
usb_serial_deregister(&keyspan_pda_fake_device);
#endif
#ifdef XIRCOM
usb_serial_deregister (&xircom_pgs_fake_device);
usb_serial_deregister(&xircom_pgs_fake_device);
#endif
}
......@@ -885,8 +906,8 @@ static void __exit keyspan_pda_exit (void)
module_init(keyspan_pda_init);
module_exit(keyspan_pda_exit);
MODULE_AUTHOR( DRIVER_AUTHOR );
MODULE_DESCRIPTION( DRIVER_DESC );
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
module_param(debug, bool, S_IRUGO | S_IWUSR);
......
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