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
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (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
|
* (09/07/2001) gkh
|
||||||
* cleaned up the Xircom support. Added ids for Entregra device which is
|
* cleaned up the Xircom support. Added ids for Entregra device which is
|
||||||
@ -21,7 +22,8 @@
|
|||||||
* support for Xircom PGSDB9
|
* support for Xircom PGSDB9
|
||||||
*
|
*
|
||||||
* (05/31/2001) gkh
|
* (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
|
* (04/08/2001) gb
|
||||||
* Identify version on module load.
|
* Identify version on module load.
|
||||||
@ -78,7 +80,7 @@
|
|||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
#include <linux/ihex.h>
|
#include <linux/ihex.h>
|
||||||
#include <asm/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <linux/usb.h>
|
#include <linux/usb.h>
|
||||||
#include <linux/usb/serial.h>
|
#include <linux/usb/serial.h>
|
||||||
|
|
||||||
@ -233,9 +235,8 @@ static void keyspan_pda_rx_interrupt (struct urb *urb)
|
|||||||
case 0:
|
case 0:
|
||||||
/* rest of message is rx data */
|
/* rest of message is rx data */
|
||||||
if (urb->actual_length) {
|
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_insert_flip_char(tty, data[i], 0);
|
||||||
}
|
|
||||||
tty_flip_buffer_push(tty);
|
tty_flip_buffer_push(tty);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -298,16 +299,36 @@ static speed_t keyspan_pda_setbaud (struct usb_serial *serial, speed_t baud)
|
|||||||
int bindex;
|
int bindex;
|
||||||
|
|
||||||
switch (baud) {
|
switch (baud) {
|
||||||
case 110: bindex = 0; break;
|
case 110:
|
||||||
case 300: bindex = 1; break;
|
bindex = 0;
|
||||||
case 1200: bindex = 2; break;
|
break;
|
||||||
case 2400: bindex = 3; break;
|
case 300:
|
||||||
case 4800: bindex = 4; break;
|
bindex = 1;
|
||||||
case 9600: bindex = 5; break;
|
break;
|
||||||
case 19200: bindex = 6; break;
|
case 1200:
|
||||||
case 38400: bindex = 7; break;
|
bindex = 2;
|
||||||
case 57600: bindex = 8; break;
|
break;
|
||||||
case 115200: bindex = 9; 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:
|
default:
|
||||||
bindex = 5; /* Default to 9600 */
|
bindex = 5; /* Default to 9600 */
|
||||||
baud = 9600;
|
baud = 9600;
|
||||||
@ -493,7 +514,7 @@ static int keyspan_pda_write(struct tty_struct *tty,
|
|||||||
dbg("keyspan_pda_write(%d)", count);
|
dbg("keyspan_pda_write(%d)", count);
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
dbg(" write request of 0 bytes");
|
dbg(" write request of 0 bytes");
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we might block because of:
|
/* 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");
|
dbg(" usb_submit_urb(write bulk) failed");
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* There wasn't any room left, so we are throttled until
|
/* There wasn't any room left, so we are throttled until
|
||||||
the buffer empties a bit */
|
the buffer empties a bit */
|
||||||
request_unthrottle = 1;
|
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
|
/* used by n_tty.c for processing of tabs and such. Giving it our
|
||||||
conservative guess is probably good enough, but needs testing by
|
conservative guess is probably good enough, but needs testing by
|
||||||
running a console through the device. */
|
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;
|
struct usb_serial *serial = port->serial;
|
||||||
|
|
||||||
if (serial->dev) {
|
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)
|
if (tty->termios->c_cflag & HUPCL)
|
||||||
keyspan_pda_set_modem_info(serial, 0);
|
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);
|
response = ezusb_set_reset(serial, 0);
|
||||||
|
|
||||||
/* we want this device to fail to have a driver assigned to it. */
|
/* 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)
|
||||||
@ -759,14 +780,14 @@ static int keyspan_pda_startup (struct usb_serial *serial)
|
|||||||
|
|
||||||
priv = kmalloc(sizeof(struct keyspan_pda_private), GFP_KERNEL);
|
priv = kmalloc(sizeof(struct keyspan_pda_private), GFP_KERNEL);
|
||||||
if (!priv)
|
if (!priv)
|
||||||
return (1); /* error */
|
return 1; /* error */
|
||||||
usb_set_serial_port_data(serial->port[0], priv);
|
usb_set_serial_port_data(serial->port[0], priv);
|
||||||
init_waitqueue_head(&serial->port[0]->write_wait);
|
init_waitqueue_head(&serial->port[0]->write_wait);
|
||||||
INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write);
|
INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write);
|
||||||
INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle);
|
INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle);
|
||||||
priv->serial = serial;
|
priv->serial = serial;
|
||||||
priv->port = serial->port[0];
|
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user