Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 93373
b: refs/heads/master
c: a5b6f60
h: refs/heads/master
i:
  93371: 4b66bce
v: v3
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Apr 25, 2008
1 parent b48068e commit e7edd4f
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 68 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 441b62c1edb986827154768d89bbac0ba779984f
refs/heads/master: a5b6f60c5a30c494017c7a2d11c4067f90d3d0df
1 change: 1 addition & 0 deletions trunk/drivers/usb/serial/ark3116.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ static void ark3116_set_termios(struct usb_serial_port *port,
buf = kmalloc(1, GFP_KERNEL);
if (!buf) {
dbg("error kmalloc");
*port->tty->termios = *old_termios;
return;
}

Expand Down
31 changes: 16 additions & 15 deletions trunk/drivers/usb/serial/cyberjack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
Expand Down Expand Up @@ -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);
Expand All @@ -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 */
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
}

Expand All @@ -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;
}

Expand All @@ -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. */
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}
}

Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/usb/serial/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,14 @@ int usb_serial_generic_write_room (struct usb_serial_port *port)

dbg("%s - port %d", __func__, port->number);

/* FIXME: Locking */
if (serial->num_bulk_out) {
if (!(port->write_urb_busy))
room = port->bulk_out_size;
}

dbg("%s - returns %d", __func__, room);
return (room);
return room;
}

int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port)
Expand All @@ -278,6 +279,7 @@ int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port)

dbg("%s - port %d", __func__, port->number);

/* FIXME: Locking */
if (serial->num_bulk_out) {
if (port->write_urb_busy)
chars = port->write_urb->transfer_buffer_length;
Expand Down Expand Up @@ -368,7 +370,6 @@ void usb_serial_generic_write_bulk_callback (struct urb *urb)
__func__, status);
return;
}

usb_serial_port_softint(port);
}
EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback);
Expand Down
19 changes: 10 additions & 9 deletions trunk/drivers/usb/serial/keyspan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,7 @@ static int keyspan_write_room (struct usb_serial_port *port)
p_priv = usb_get_serial_port_data(port);
d_details = p_priv->device_details;

/* FIXME: locking */
if (d_details->msg_format == msg_usa90)
data_len = 64;
else
Expand All @@ -1203,13 +1204,13 @@ static int keyspan_write_room (struct usb_serial_port *port)
if (this_urb->status != -EINPROGRESS)
return (data_len);
}
return (0);
return 0;
}


static int keyspan_chars_in_buffer (struct usb_serial_port *port)
{
return (0);
return 0;
}


Expand Down Expand Up @@ -1289,7 +1290,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
//mdelay(100);
//keyspan_set_termios(port, NULL);

return (0);
return 0;
}

static inline void stop_urb(struct urb *urb)
Expand Down Expand Up @@ -2006,7 +2007,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
}
#endif

return (0);
return 0;
}

static int keyspan_usa28_send_setup(struct usb_serial *serial,
Expand Down Expand Up @@ -2131,7 +2132,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial,
}
#endif

return (0);
return 0;
}

static int keyspan_usa49_send_setup(struct usb_serial *serial,
Expand Down Expand Up @@ -2317,7 +2318,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
}
#endif

return (0);
return 0;
}

static int keyspan_usa90_send_setup(struct usb_serial *serial,
Expand Down Expand Up @@ -2455,7 +2456,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial,
if ((err = usb_submit_urb(this_urb, GFP_ATOMIC)) != 0) {
dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err);
}
return (0);
return 0;
}

static int keyspan_usa67_send_setup(struct usb_serial *serial,
Expand Down Expand Up @@ -2603,7 +2604,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial,
if (err != 0)
dbg("%s - usb_submit_urb(setup) failed (%d)", __func__,
err);
return (0);
return 0;
}

static void keyspan_send_setup(struct usb_serial_port *port, int reset_port)
Expand Down Expand Up @@ -2696,7 +2697,7 @@ static int keyspan_startup (struct usb_serial *serial)
err);
}

return (0);
return 0;
}

static void keyspan_shutdown (struct usb_serial *serial)
Expand Down
9 changes: 7 additions & 2 deletions trunk/drivers/usb/serial/keyspan_pda.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,14 +636,19 @@ static int keyspan_pda_write_room (struct usb_serial_port *port)
static int keyspan_pda_chars_in_buffer (struct usb_serial_port *port)
{
struct keyspan_pda_private *priv;
unsigned long flags;
int ret = 0;

priv = usb_get_serial_port_data(port);

/* when throttled, return at least WAKEUP_CHARS to tell select() (via
n_tty.c:normal_poll() ) that we're not writeable. */

spin_lock_irqsave(&port->lock, flags);
if (port->write_urb_busy || priv->tx_throttled)
return 256;
return 0;
ret = 256;
spin_unlock_irqrestore(&port->lock, flags);
return ret;
}


Expand Down
41 changes: 25 additions & 16 deletions trunk/drivers/usb/serial/kl5kusb105.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,19 +702,23 @@ static void klsi_105_set_termios (struct usb_serial_port *port,
struct ktermios *old_termios)
{
struct klsi_105_private *priv = usb_get_serial_port_data(port);
unsigned int iflag = port->tty->termios->c_iflag;
struct tty_struct *tty = port->tty;
unsigned int iflag = tty->termios->c_iflag;
unsigned int old_iflag = old_termios->c_iflag;
unsigned int cflag = port->tty->termios->c_cflag;
unsigned int cflag = tty->termios->c_cflag;
unsigned int old_cflag = old_termios->c_cflag;
struct klsi_105_port_settings cfg;
unsigned long flags;
speed_t baud;

/* lock while we are modifying the settings */
spin_lock_irqsave (&priv->lock, flags);

/*
* Update baud rate
*/
baud = tty_get_baud_rate(tty);

if( (cflag & CBAUD) != (old_cflag & CBAUD) ) {
/* reassert DTR and (maybe) RTS on transition from B0 */
if( (old_cflag & CBAUD) == B0 ) {
Expand All @@ -728,8 +732,8 @@ static void klsi_105_set_termios (struct usb_serial_port *port,
mct_u232_set_modem_ctrl(serial, priv->control_state);
#endif
}
switch(tty_get_baud_rate(port->tty)) {
}
switch(baud) {
case 0: /* handled below */
break;
case 1200:
Expand Down Expand Up @@ -757,25 +761,26 @@ static void klsi_105_set_termios (struct usb_serial_port *port,
priv->cfg.baudrate = kl5kusb105a_sio_b115200;
break;
default:
err("KLSI USB->Serial converter:"
dbg("KLSI USB->Serial converter:"
" unsupported baudrate request, using default"
" of 9600");
priv->cfg.baudrate = kl5kusb105a_sio_b9600;
baud = 9600;
break;
}
if ((cflag & CBAUD) == B0 ) {
dbg("%s: baud is B0", __func__);
/* Drop RTS and DTR */
/* maybe this should be simulated by sending read
* disable and read enable messages?
*/
;
}
if ((cflag & CBAUD) == B0 ) {
dbg("%s: baud is B0", __func__);
/* Drop RTS and DTR */
/* maybe this should be simulated by sending read
* disable and read enable messages?
*/
;
#if 0
priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS);
mct_u232_set_modem_ctrl(serial, priv->control_state);
priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS);
mct_u232_set_modem_ctrl(serial, priv->control_state);
#endif
}
}
tty_encode_baud_rate(tty, baud, baud);

if ((cflag & CSIZE) != (old_cflag & CSIZE)) {
/* set the number of data bits */
Expand Down Expand Up @@ -807,6 +812,8 @@ static void klsi_105_set_termios (struct usb_serial_port *port,
if ((cflag & (PARENB|PARODD)) != (old_cflag & (PARENB|PARODD))
|| (cflag & CSTOPB) != (old_cflag & CSTOPB) ) {

/* Not currently supported */
tty->termios->c_cflag &= ~(PARENB|PARODD|CSTOPB);
#if 0
priv->last_lcr = 0;

Expand Down Expand Up @@ -834,6 +841,8 @@ static void klsi_105_set_termios (struct usb_serial_port *port,
|| (iflag & IXON) != (old_iflag & IXON)
|| (cflag & CRTSCTS) != (old_cflag & CRTSCTS) ) {

/* Not currently supported */
tty->termios->c_cflag &= ~CRTSCTS;
/* Drop DTR/RTS if no flow control otherwise assert */
#if 0
if ((iflag & IXOFF) || (iflag & IXON) || (cflag & CRTSCTS) )
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/usb/serial/mos7720.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ static int mos7720_write_room(struct usb_serial_port *port)
return -ENODEV;
}

/* FIXME: Locking */
for (i = 0; i < NUM_URBS; ++i) {
if (mos7720_port->write_urb_pool[i] && mos7720_port->write_urb_pool[i]->status != -EINPROGRESS)
room += URB_TRANSFER_BUFFER_SIZE;
Expand Down
10 changes: 5 additions & 5 deletions trunk/drivers/usb/serial/navman.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* TODO:
* Add termios method that uses copy_hw but also kills all echo
* flags as the navman is rx only so cannot echo.
*/

#include <linux/kernel.h>
Expand Down Expand Up @@ -106,12 +110,8 @@ static int navman_write(struct usb_serial_port *port,

/*
* This device can't write any data, only read from the device
* so we just silently eat all data sent to us and say it was
* successfully sent.
* Evil, I know, but do you have a better idea?
*/

return count;
return -EOPNOTSUPP;
}

static struct usb_serial_driver navman_device = {
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/usb/serial/omninet.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,9 @@ static int omninet_write_room (struct usb_serial_port *port)
struct usb_serial *serial = port->serial;
struct usb_serial_port *wport = serial->port[1];

int room = 0; // Default: no room
int room = 0; /* Default: no room */

/* FIXME: no consistent locking for write_urb_busy */
if (wport->write_urb_busy)
room = wport->bulk_out_size - OMNINET_HEADERLEN;

Expand Down
Loading

0 comments on commit e7edd4f

Please sign in to comment.