tty-usb-keyspan-pda: Coding style
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
f035a8ad15
commit
9e70f319d1
@ -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>
|
||||
|
||||
@ -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;
|
||||
@ -298,16 +299,36 @@ static speed_t keyspan_pda_setbaud (struct usb_serial *serial, speed_t baud)
|
||||
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;
|
||||
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;
|
||||
@ -493,7 +514,7 @@ static int keyspan_pda_write(struct tty_struct *tty,
|
||||
dbg("keyspan_pda_write(%d)", count);
|
||||
if (count == 0) {
|
||||
dbg(" write request of 0 bytes");
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* we might block because of:
|
||||
@ -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;
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -746,7 +767,7 @@ 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)
|
||||
@ -759,14 +780,14 @@ 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)
|
||||
|
Loading…
Reference in New Issue
Block a user