diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2008-04-08 17:16:06 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-04-24 21:16:55 -0700 |
commit | a5b6f60c5a30c494017c7a2d11c4067f90d3d0df (patch) | |
tree | 2f80d1a6c2655c5c12f40cafbc47516284934d42 /drivers/usb/serial/cyberjack.c | |
parent | 441b62c1edb986827154768d89bbac0ba779984f (diff) | |
download | kernel-crypto-a5b6f60c5a30c494017c7a2d11c4067f90d3d0df.tar.gz kernel-crypto-a5b6f60c5a30c494017c7a2d11c4067f90d3d0df.tar.xz kernel-crypto-a5b6f60c5a30c494017c7a2d11c4067f90d3d0df.zip |
usb serial: more fixes and groundwork for tty changes
- If a termios change fails due to lack of memory we should copy the
old settings back over as the device has not changed
- Note various locking problems
- kl5kusb105 had various remaining tty flag handling problems
- Make safe_serial use tty_insert_flip_string not open coded loops
- set termios speed properly in usb_serial
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/cyberjack.c')
-rw-r--r-- | drivers/usb/serial/cyberjack.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 5348e97b52b..d077534ceae 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c @@ -151,7 +151,7 @@ static void cyberjack_shutdown (struct usb_serial *serial) dbg("%s", __func__); - for (i=0; i < serial->num_ports; ++i) { + for (i = 0; i < serial->num_ports; ++i) { usb_kill_urb(serial->port[i]->interrupt_in_urb); /* My special items, the standard routines free my urbs */ kfree(usb_get_serial_port_data(serial->port[i])); @@ -209,7 +209,7 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b if (count == 0) { dbg("%s - write request of 0 bytes", __func__); - return (0); + return 0; } spin_lock_bh(&port->lock); @@ -223,12 +223,12 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b spin_lock_irqsave(&priv->lock, flags); - if( (count+priv->wrfilled)>sizeof(priv->wrbuf) ) { + if( (count+priv->wrfilled) > sizeof(priv->wrbuf) ) { /* To much data for buffer. Reset buffer. */ - priv->wrfilled=0; - spin_unlock_irqrestore(&priv->lock, flags); + priv->wrfilled = 0; port->write_urb_busy = 0; - return (0); + spin_unlock_irqrestore(&priv->lock, flags); + return 0; } /* Copy data */ @@ -269,8 +269,8 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b if (result) { err("%s - failed submitting write urb, error %d", __func__, result); /* Throw away data. No better idea what to do with it. */ - priv->wrfilled=0; - priv->wrsent=0; + priv->wrfilled = 0; + priv->wrsent = 0; spin_unlock_irqrestore(&priv->lock, flags); port->write_urb_busy = 0; return 0; @@ -282,8 +282,8 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b if( priv->wrsent>=priv->wrfilled ) { dbg("%s - buffer cleaned", __func__); memset( priv->wrbuf, 0, sizeof(priv->wrbuf) ); - priv->wrfilled=0; - priv->wrsent=0; + priv->wrfilled = 0; + priv->wrsent = 0; } } @@ -294,6 +294,7 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b static int cyberjack_write_room( struct usb_serial_port *port ) { + /* FIXME: .... */ return CYBERJACK_LOCAL_BUF_SIZE; } @@ -314,7 +315,7 @@ static void cyberjack_read_int_callback( struct urb *urb ) usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); /* React only to interrupts signaling a bulk_in transfer */ - if( (urb->actual_length==4) && (data[0]==0x01) ) { + if( (urb->actual_length == 4) && (data[0] == 0x01) ) { short old_rdtodo; /* This is a announcement of coming bulk_ins. */ @@ -450,8 +451,8 @@ static void cyberjack_write_bulk_callback (struct urb *urb) if (result) { err("%s - failed submitting write urb, error %d", __func__, result); /* Throw away data. No better idea what to do with it. */ - priv->wrfilled=0; - priv->wrsent=0; + priv->wrfilled = 0; + priv->wrsent = 0; goto exit; } @@ -463,8 +464,8 @@ static void cyberjack_write_bulk_callback (struct urb *urb) if( (priv->wrsent>=priv->wrfilled) || (priv->wrsent>=blksize) ) { dbg("%s - buffer cleaned", __func__); memset( priv->wrbuf, 0, sizeof(priv->wrbuf) ); - priv->wrfilled=0; - priv->wrsent=0; + priv->wrfilled = 0; + priv->wrsent = 0; } } |