aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/serial/ark3116.c1
-rw-r--r--drivers/usb/serial/cyberjack.c31
-rw-r--r--drivers/usb/serial/generic.c5
-rw-r--r--drivers/usb/serial/keyspan.c19
-rw-r--r--drivers/usb/serial/keyspan_pda.c9
-rw-r--r--drivers/usb/serial/kl5kusb105.c41
-rw-r--r--drivers/usb/serial/mos7720.c1
-rw-r--r--drivers/usb/serial/navman.c10
-rw-r--r--drivers/usb/serial/omninet.c3
-rw-r--r--drivers/usb/serial/option.c3
-rw-r--r--drivers/usb/serial/pl2303.c2
-rw-r--r--drivers/usb/serial/safe_serial.c27
-rw-r--r--drivers/usb/serial/sierra.c2
-rw-r--r--drivers/usb/serial/usb-serial.c2
-rw-r--r--drivers/usb/serial/visor.c2
-rw-r--r--drivers/usb/serial/whiteheat.c2
16 files changed, 93 insertions, 67 deletions
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 9d708b22e955..599ab2e548a7 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -192,6 +192,7 @@ static void ark3116_set_termios(struct usb_serial_port *port,
192 buf = kmalloc(1, GFP_KERNEL); 192 buf = kmalloc(1, GFP_KERNEL);
193 if (!buf) { 193 if (!buf) {
194 dbg("error kmalloc"); 194 dbg("error kmalloc");
195 *port->tty->termios = *old_termios;
195 return; 196 return;
196 } 197 }
197 198
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
index 5348e97b52b5..d077534ceaeb 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)
151 151
152 dbg("%s", __func__); 152 dbg("%s", __func__);
153 153
154 for (i=0; i < serial->num_ports; ++i) { 154 for (i = 0; i < serial->num_ports; ++i) {
155 usb_kill_urb(serial->port[i]->interrupt_in_urb); 155 usb_kill_urb(serial->port[i]->interrupt_in_urb);
156 /* My special items, the standard routines free my urbs */ 156 /* My special items, the standard routines free my urbs */
157 kfree(usb_get_serial_port_data(serial->port[i])); 157 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
209 209
210 if (count == 0) { 210 if (count == 0) {
211 dbg("%s - write request of 0 bytes", __func__); 211 dbg("%s - write request of 0 bytes", __func__);
212 return (0); 212 return 0;
213 } 213 }
214 214
215 spin_lock_bh(&port->lock); 215 spin_lock_bh(&port->lock);
@@ -223,12 +223,12 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b
223 223
224 spin_lock_irqsave(&priv->lock, flags); 224 spin_lock_irqsave(&priv->lock, flags);
225 225
226 if( (count+priv->wrfilled)>sizeof(priv->wrbuf) ) { 226 if( (count+priv->wrfilled) > sizeof(priv->wrbuf) ) {
227 /* To much data for buffer. Reset buffer. */ 227 /* To much data for buffer. Reset buffer. */
228 priv->wrfilled=0; 228 priv->wrfilled = 0;
229 spin_unlock_irqrestore(&priv->lock, flags);
230 port->write_urb_busy = 0; 229 port->write_urb_busy = 0;
231 return (0); 230 spin_unlock_irqrestore(&priv->lock, flags);
231 return 0;
232 } 232 }
233 233
234 /* Copy data */ 234 /* Copy data */
@@ -269,8 +269,8 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b
269 if (result) { 269 if (result) {
270 err("%s - failed submitting write urb, error %d", __func__, result); 270 err("%s - failed submitting write urb, error %d", __func__, result);
271 /* Throw away data. No better idea what to do with it. */ 271 /* Throw away data. No better idea what to do with it. */
272 priv->wrfilled=0; 272 priv->wrfilled = 0;
273 priv->wrsent=0; 273 priv->wrsent = 0;
274 spin_unlock_irqrestore(&priv->lock, flags); 274 spin_unlock_irqrestore(&priv->lock, flags);
275 port->write_urb_busy = 0; 275 port->write_urb_busy = 0;
276 return 0; 276 return 0;
@@ -282,8 +282,8 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b
282 if( priv->wrsent>=priv->wrfilled ) { 282 if( priv->wrsent>=priv->wrfilled ) {
283 dbg("%s - buffer cleaned", __func__); 283 dbg("%s - buffer cleaned", __func__);
284 memset( priv->wrbuf, 0, sizeof(priv->wrbuf) ); 284 memset( priv->wrbuf, 0, sizeof(priv->wrbuf) );
285 priv->wrfilled=0; 285 priv->wrfilled = 0;
286 priv->wrsent=0; 286 priv->wrsent = 0;
287 } 287 }
288 } 288 }
289 289
@@ -294,6 +294,7 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b
294 294
295static int cyberjack_write_room( struct usb_serial_port *port ) 295static int cyberjack_write_room( struct usb_serial_port *port )
296{ 296{
297 /* FIXME: .... */
297 return CYBERJACK_LOCAL_BUF_SIZE; 298 return CYBERJACK_LOCAL_BUF_SIZE;
298} 299}
299 300
@@ -314,7 +315,7 @@ static void cyberjack_read_int_callback( struct urb *urb )
314 usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); 315 usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data);
315 316
316 /* React only to interrupts signaling a bulk_in transfer */ 317 /* React only to interrupts signaling a bulk_in transfer */
317 if( (urb->actual_length==4) && (data[0]==0x01) ) { 318 if( (urb->actual_length == 4) && (data[0] == 0x01) ) {
318 short old_rdtodo; 319 short old_rdtodo;
319 320
320 /* This is a announcement of coming bulk_ins. */ 321 /* This is a announcement of coming bulk_ins. */
@@ -450,8 +451,8 @@ static void cyberjack_write_bulk_callback (struct urb *urb)
450 if (result) { 451 if (result) {
451 err("%s - failed submitting write urb, error %d", __func__, result); 452 err("%s - failed submitting write urb, error %d", __func__, result);
452 /* Throw away data. No better idea what to do with it. */ 453 /* Throw away data. No better idea what to do with it. */
453 priv->wrfilled=0; 454 priv->wrfilled = 0;
454 priv->wrsent=0; 455 priv->wrsent = 0;
455 goto exit; 456 goto exit;
456 } 457 }
457 458
@@ -463,8 +464,8 @@ static void cyberjack_write_bulk_callback (struct urb *urb)
463 if( (priv->wrsent>=priv->wrfilled) || (priv->wrsent>=blksize) ) { 464 if( (priv->wrsent>=priv->wrfilled) || (priv->wrsent>=blksize) ) {
464 dbg("%s - buffer cleaned", __func__); 465 dbg("%s - buffer cleaned", __func__);
465 memset( priv->wrbuf, 0, sizeof(priv->wrbuf) ); 466 memset( priv->wrbuf, 0, sizeof(priv->wrbuf) );
466 priv->wrfilled=0; 467 priv->wrfilled = 0;
467 priv->wrsent=0; 468 priv->wrsent = 0;
468 } 469 }
469 } 470 }
470 471
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 2078667db4aa..65765ce76251 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -262,13 +262,14 @@ int usb_serial_generic_write_room (struct usb_serial_port *port)
262 262
263 dbg("%s - port %d", __func__, port->number); 263 dbg("%s - port %d", __func__, port->number);
264 264
265 /* FIXME: Locking */
265 if (serial->num_bulk_out) { 266 if (serial->num_bulk_out) {
266 if (!(port->write_urb_busy)) 267 if (!(port->write_urb_busy))
267 room = port->bulk_out_size; 268 room = port->bulk_out_size;
268 } 269 }
269 270
270 dbg("%s - returns %d", __func__, room); 271 dbg("%s - returns %d", __func__, room);
271 return (room); 272 return room;
272} 273}
273 274
274int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port) 275int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port)
@@ -278,6 +279,7 @@ int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port)
278 279
279 dbg("%s - port %d", __func__, port->number); 280 dbg("%s - port %d", __func__, port->number);
280 281
282 /* FIXME: Locking */
281 if (serial->num_bulk_out) { 283 if (serial->num_bulk_out) {
282 if (port->write_urb_busy) 284 if (port->write_urb_busy)
283 chars = port->write_urb->transfer_buffer_length; 285 chars = port->write_urb->transfer_buffer_length;
@@ -368,7 +370,6 @@ void usb_serial_generic_write_bulk_callback (struct urb *urb)
368 __func__, status); 370 __func__, status);
369 return; 371 return;
370 } 372 }
371
372 usb_serial_port_softint(port); 373 usb_serial_port_softint(port);
373} 374}
374EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback); 375EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback);
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 857c5312555a..0d122feb2b22 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -1187,6 +1187,7 @@ static int keyspan_write_room (struct usb_serial_port *port)
1187 p_priv = usb_get_serial_port_data(port); 1187 p_priv = usb_get_serial_port_data(port);
1188 d_details = p_priv->device_details; 1188 d_details = p_priv->device_details;
1189 1189
1190 /* FIXME: locking */
1190 if (d_details->msg_format == msg_usa90) 1191 if (d_details->msg_format == msg_usa90)
1191 data_len = 64; 1192 data_len = 64;
1192 else 1193 else
@@ -1203,13 +1204,13 @@ static int keyspan_write_room (struct usb_serial_port *port)
1203 if (this_urb->status != -EINPROGRESS) 1204 if (this_urb->status != -EINPROGRESS)
1204 return (data_len); 1205 return (data_len);
1205 } 1206 }
1206 return (0); 1207 return 0;
1207} 1208}
1208 1209
1209 1210
1210static int keyspan_chars_in_buffer (struct usb_serial_port *port) 1211static int keyspan_chars_in_buffer (struct usb_serial_port *port)
1211{ 1212{
1212 return (0); 1213 return 0;
1213} 1214}
1214 1215
1215 1216
@@ -1289,7 +1290,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
1289 //mdelay(100); 1290 //mdelay(100);
1290 //keyspan_set_termios(port, NULL); 1291 //keyspan_set_termios(port, NULL);
1291 1292
1292 return (0); 1293 return 0;
1293} 1294}
1294 1295
1295static inline void stop_urb(struct urb *urb) 1296static inline void stop_urb(struct urb *urb)
@@ -2006,7 +2007,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
2006 } 2007 }
2007#endif 2008#endif
2008 2009
2009 return (0); 2010 return 0;
2010} 2011}
2011 2012
2012static int keyspan_usa28_send_setup(struct usb_serial *serial, 2013static int keyspan_usa28_send_setup(struct usb_serial *serial,
@@ -2131,7 +2132,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial,
2131 } 2132 }
2132#endif 2133#endif
2133 2134
2134 return (0); 2135 return 0;
2135} 2136}
2136 2137
2137static int keyspan_usa49_send_setup(struct usb_serial *serial, 2138static int keyspan_usa49_send_setup(struct usb_serial *serial,
@@ -2317,7 +2318,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
2317 } 2318 }
2318#endif 2319#endif
2319 2320
2320 return (0); 2321 return 0;
2321} 2322}
2322 2323
2323static int keyspan_usa90_send_setup(struct usb_serial *serial, 2324static int keyspan_usa90_send_setup(struct usb_serial *serial,
@@ -2455,7 +2456,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial,
2455 if ((err = usb_submit_urb(this_urb, GFP_ATOMIC)) != 0) { 2456 if ((err = usb_submit_urb(this_urb, GFP_ATOMIC)) != 0) {
2456 dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); 2457 dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err);
2457 } 2458 }
2458 return (0); 2459 return 0;
2459} 2460}
2460 2461
2461static int keyspan_usa67_send_setup(struct usb_serial *serial, 2462static int keyspan_usa67_send_setup(struct usb_serial *serial,
@@ -2603,7 +2604,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial,
2603 if (err != 0) 2604 if (err != 0)
2604 dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, 2605 dbg("%s - usb_submit_urb(setup) failed (%d)", __func__,
2605 err); 2606 err);
2606 return (0); 2607 return 0;
2607} 2608}
2608 2609
2609static void keyspan_send_setup(struct usb_serial_port *port, int reset_port) 2610static void keyspan_send_setup(struct usb_serial_port *port, int reset_port)
@@ -2696,7 +2697,7 @@ static int keyspan_startup (struct usb_serial *serial)
2696 err); 2697 err);
2697 } 2698 }
2698 2699
2699 return (0); 2700 return 0;
2700} 2701}
2701 2702
2702static void keyspan_shutdown (struct usb_serial *serial) 2703static void keyspan_shutdown (struct usb_serial *serial)
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index 6ce292ef1c47..b650fb4754b4 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -636,14 +636,19 @@ static int keyspan_pda_write_room (struct usb_serial_port *port)
636static int keyspan_pda_chars_in_buffer (struct usb_serial_port *port) 636static int keyspan_pda_chars_in_buffer (struct usb_serial_port *port)
637{ 637{
638 struct keyspan_pda_private *priv; 638 struct keyspan_pda_private *priv;
639 unsigned long flags;
640 int ret = 0;
639 641
640 priv = usb_get_serial_port_data(port); 642 priv = usb_get_serial_port_data(port);
641 643
642 /* when throttled, return at least WAKEUP_CHARS to tell select() (via 644 /* when throttled, return at least WAKEUP_CHARS to tell select() (via
643 n_tty.c:normal_poll() ) that we're not writeable. */ 645 n_tty.c:normal_poll() ) that we're not writeable. */
646
647 spin_lock_irqsave(&port->lock, flags);
644 if (port->write_urb_busy || priv->tx_throttled) 648 if (port->write_urb_busy || priv->tx_throttled)
645 return 256; 649 ret = 256;
646 return 0; 650 spin_unlock_irqrestore(&port->lock, flags);
651 return ret;
647} 652}
648 653
649 654
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index 160e19263e25..b3ac045ab408 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -702,12 +702,14 @@ static void klsi_105_set_termios (struct usb_serial_port *port,
702 struct ktermios *old_termios) 702 struct ktermios *old_termios)
703{ 703{
704 struct klsi_105_private *priv = usb_get_serial_port_data(port); 704 struct klsi_105_private *priv = usb_get_serial_port_data(port);
705 unsigned int iflag = port->tty->termios->c_iflag; 705 struct tty_struct *tty = port->tty;
706 unsigned int iflag = tty->termios->c_iflag;
706 unsigned int old_iflag = old_termios->c_iflag; 707 unsigned int old_iflag = old_termios->c_iflag;
707 unsigned int cflag = port->tty->termios->c_cflag; 708 unsigned int cflag = tty->termios->c_cflag;
708 unsigned int old_cflag = old_termios->c_cflag; 709 unsigned int old_cflag = old_termios->c_cflag;
709 struct klsi_105_port_settings cfg; 710 struct klsi_105_port_settings cfg;
710 unsigned long flags; 711 unsigned long flags;
712 speed_t baud;
711 713
712 /* lock while we are modifying the settings */ 714 /* lock while we are modifying the settings */
713 spin_lock_irqsave (&priv->lock, flags); 715 spin_lock_irqsave (&priv->lock, flags);
@@ -715,6 +717,8 @@ static void klsi_105_set_termios (struct usb_serial_port *port,
715 /* 717 /*
716 * Update baud rate 718 * Update baud rate
717 */ 719 */
720 baud = tty_get_baud_rate(tty);
721
718 if( (cflag & CBAUD) != (old_cflag & CBAUD) ) { 722 if( (cflag & CBAUD) != (old_cflag & CBAUD) ) {
719 /* reassert DTR and (maybe) RTS on transition from B0 */ 723 /* reassert DTR and (maybe) RTS on transition from B0 */
720 if( (old_cflag & CBAUD) == B0 ) { 724 if( (old_cflag & CBAUD) == B0 ) {
@@ -728,8 +732,8 @@ static void klsi_105_set_termios (struct usb_serial_port *port,
728 mct_u232_set_modem_ctrl(serial, priv->control_state); 732 mct_u232_set_modem_ctrl(serial, priv->control_state);
729#endif 733#endif
730 } 734 }
731 735 }
732 switch(tty_get_baud_rate(port->tty)) { 736 switch(baud) {
733 case 0: /* handled below */ 737 case 0: /* handled below */
734 break; 738 break;
735 case 1200: 739 case 1200:
@@ -757,25 +761,26 @@ static void klsi_105_set_termios (struct usb_serial_port *port,
757 priv->cfg.baudrate = kl5kusb105a_sio_b115200; 761 priv->cfg.baudrate = kl5kusb105a_sio_b115200;
758 break; 762 break;
759 default: 763 default:
760 err("KLSI USB->Serial converter:" 764 dbg("KLSI USB->Serial converter:"
761 " unsupported baudrate request, using default" 765 " unsupported baudrate request, using default"
762 " of 9600"); 766 " of 9600");
763 priv->cfg.baudrate = kl5kusb105a_sio_b9600; 767 priv->cfg.baudrate = kl5kusb105a_sio_b9600;
768 baud = 9600;
764 break; 769 break;
765 } 770 }
766 if ((cflag & CBAUD) == B0 ) { 771 if ((cflag & CBAUD) == B0 ) {
767 dbg("%s: baud is B0", __func__); 772 dbg("%s: baud is B0", __func__);
768 /* Drop RTS and DTR */ 773 /* Drop RTS and DTR */
769 /* maybe this should be simulated by sending read 774 /* maybe this should be simulated by sending read
770 * disable and read enable messages? 775 * disable and read enable messages?
771 */ 776 */
772 ; 777 ;
773#if 0 778#if 0
774 priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS); 779 priv->control_state &= ~(TIOCM_DTR | TIOCM_RTS);
775 mct_u232_set_modem_ctrl(serial, priv->control_state); 780 mct_u232_set_modem_ctrl(serial, priv->control_state);
776#endif 781#endif
777 }
778 } 782 }
783 tty_encode_baud_rate(tty, baud, baud);
779 784
780 if ((cflag & CSIZE) != (old_cflag & CSIZE)) { 785 if ((cflag & CSIZE) != (old_cflag & CSIZE)) {
781 /* set the number of data bits */ 786 /* set the number of data bits */
@@ -807,6 +812,8 @@ static void klsi_105_set_termios (struct usb_serial_port *port,
807 if ((cflag & (PARENB|PARODD)) != (old_cflag & (PARENB|PARODD)) 812 if ((cflag & (PARENB|PARODD)) != (old_cflag & (PARENB|PARODD))
808 || (cflag & CSTOPB) != (old_cflag & CSTOPB) ) { 813 || (cflag & CSTOPB) != (old_cflag & CSTOPB) ) {
809 814
815 /* Not currently supported */
816 tty->termios->c_cflag &= ~(PARENB|PARODD|CSTOPB);
810#if 0 817#if 0
811 priv->last_lcr = 0; 818 priv->last_lcr = 0;
812 819
@@ -834,6 +841,8 @@ static void klsi_105_set_termios (struct usb_serial_port *port,
834 || (iflag & IXON) != (old_iflag & IXON) 841 || (iflag & IXON) != (old_iflag & IXON)
835 || (cflag & CRTSCTS) != (old_cflag & CRTSCTS) ) { 842 || (cflag & CRTSCTS) != (old_cflag & CRTSCTS) ) {
836 843
844 /* Not currently supported */
845 tty->termios->c_cflag &= ~CRTSCTS;
837 /* Drop DTR/RTS if no flow control otherwise assert */ 846 /* Drop DTR/RTS if no flow control otherwise assert */
838#if 0 847#if 0
839 if ((iflag & IXOFF) || (iflag & IXON) || (cflag & CRTSCTS) ) 848 if ((iflag & IXOFF) || (iflag & IXON) || (cflag & CRTSCTS) )
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 74b889bf19cf..50f1fe263338 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -635,6 +635,7 @@ static int mos7720_write_room(struct usb_serial_port *port)
635 return -ENODEV; 635 return -ENODEV;
636 } 636 }
637 637
638 /* FIXME: Locking */
638 for (i = 0; i < NUM_URBS; ++i) { 639 for (i = 0; i < NUM_URBS; ++i) {
639 if (mos7720_port->write_urb_pool[i] && mos7720_port->write_urb_pool[i]->status != -EINPROGRESS) 640 if (mos7720_port->write_urb_pool[i] && mos7720_port->write_urb_pool[i]->status != -EINPROGRESS)
640 room += URB_TRANSFER_BUFFER_SIZE; 641 room += URB_TRANSFER_BUFFER_SIZE;
diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c
index 7cea325d577c..43c8894353bf 100644
--- a/drivers/usb/serial/navman.c
+++ b/drivers/usb/serial/navman.c
@@ -6,6 +6,10 @@
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation. 8 * version 2 as published by the Free Software Foundation.
9 *
10 * TODO:
11 * Add termios method that uses copy_hw but also kills all echo
12 * flags as the navman is rx only so cannot echo.
9 */ 13 */
10 14
11#include <linux/kernel.h> 15#include <linux/kernel.h>
@@ -106,12 +110,8 @@ static int navman_write(struct usb_serial_port *port,
106 110
107 /* 111 /*
108 * This device can't write any data, only read from the device 112 * This device can't write any data, only read from the device
109 * so we just silently eat all data sent to us and say it was
110 * successfully sent.
111 * Evil, I know, but do you have a better idea?
112 */ 113 */
113 114 return -EOPNOTSUPP;
114 return count;
115} 115}
116 116
117static struct usb_serial_driver navman_device = { 117static struct usb_serial_driver navman_device = {
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index 1b041c59aab2..10090cb52d31 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -295,8 +295,9 @@ static int omninet_write_room (struct usb_serial_port *port)
295 struct usb_serial *serial = port->serial; 295 struct usb_serial *serial = port->serial;
296 struct usb_serial_port *wport = serial->port[1]; 296 struct usb_serial_port *wport = serial->port[1];
297 297
298 int room = 0; // Default: no room 298 int room = 0; /* Default: no room */
299 299
300 /* FIXME: no consistent locking for write_urb_busy */
300 if (wport->write_urb_busy) 301 if (wport->write_urb_busy)
301 room = wport->bulk_out_size - OMNINET_HEADERLEN; 302 room = wport->bulk_out_size - OMNINET_HEADERLEN;
302 303
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 920241897c95..a83892627d66 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -656,6 +656,7 @@ static int option_write_room(struct usb_serial_port *port)
656 656
657 portdata = usb_get_serial_port_data(port); 657 portdata = usb_get_serial_port_data(port);
658 658
659
659 for (i=0; i < N_OUT_URB; i++) { 660 for (i=0; i < N_OUT_URB; i++) {
660 this_urb = portdata->out_urbs[i]; 661 this_urb = portdata->out_urbs[i];
661 if (this_urb && !test_bit(i, &portdata->out_busy)) 662 if (this_urb && !test_bit(i, &portdata->out_busy))
@@ -677,6 +678,8 @@ static int option_chars_in_buffer(struct usb_serial_port *port)
677 678
678 for (i=0; i < N_OUT_URB; i++) { 679 for (i=0; i < N_OUT_URB; i++) {
679 this_urb = portdata->out_urbs[i]; 680 this_urb = portdata->out_urbs[i];
681 /* FIXME: This locking is insufficient as this_urb may
682 go unused during the test */
680 if (this_urb && test_bit(i, &portdata->out_busy)) 683 if (this_urb && test_bit(i, &portdata->out_busy))
681 data_len += this_urb->transfer_buffer_length; 684 data_len += this_urb->transfer_buffer_length;
682 } 685 }
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 2b4ab371c762..c60930ec9341 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -546,6 +546,8 @@ static void pl2303_set_termios(struct usb_serial_port *port,
546 buf = kzalloc(7, GFP_KERNEL); 546 buf = kzalloc(7, GFP_KERNEL);
547 if (!buf) { 547 if (!buf) {
548 dev_err(&port->dev, "%s - out of memory.\n", __func__); 548 dev_err(&port->dev, "%s - out of memory.\n", __func__);
549 /* Report back no change occurred */
550 *port->tty->termios = *old_termios;
549 return; 551 return;
550 } 552 }
551 553
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
index 3fe98a52b914..e6acac49a9c8 100644
--- a/drivers/usb/serial/safe_serial.c
+++ b/drivers/usb/serial/safe_serial.c
@@ -198,7 +198,6 @@ static void safe_read_bulk_callback (struct urb *urb)
198 struct usb_serial_port *port = (struct usb_serial_port *) urb->context; 198 struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
199 unsigned char *data = urb->transfer_buffer; 199 unsigned char *data = urb->transfer_buffer;
200 unsigned char length = urb->actual_length; 200 unsigned char length = urb->actual_length;
201 int i;
202 int result; 201 int result;
203 int status = urb->status; 202 int status = urb->status;
204 203
@@ -227,16 +226,10 @@ static void safe_read_bulk_callback (struct urb *urb)
227 if (safe) { 226 if (safe) {
228 __u16 fcs; 227 __u16 fcs;
229 if (!(fcs = fcs_compute10 (data, length, CRC10_INITFCS))) { 228 if (!(fcs = fcs_compute10 (data, length, CRC10_INITFCS))) {
230
231 int actual_length = data[length - 2] >> 2; 229 int actual_length = data[length - 2] >> 2;
232
233 if (actual_length <= (length - 2)) { 230 if (actual_length <= (length - 2)) {
234
235 info ("%s - actual: %d", __func__, actual_length); 231 info ("%s - actual: %d", __func__, actual_length);
236 232 tty_insert_flip_string(port->tty, data, actual_length);
237 for (i = 0; i < actual_length; i++) {
238 tty_insert_flip_char (port->tty, data[i], 0);
239 }
240 tty_flip_buffer_push (port->tty); 233 tty_flip_buffer_push (port->tty);
241 } else { 234 } else {
242 err ("%s - inconsistent lengths %d:%d", __func__, 235 err ("%s - inconsistent lengths %d:%d", __func__,
@@ -246,9 +239,7 @@ static void safe_read_bulk_callback (struct urb *urb)
246 err ("%s - bad CRC %x", __func__, fcs); 239 err ("%s - bad CRC %x", __func__, fcs);
247 } 240 }
248 } else { 241 } else {
249 for (i = 0; i < length; i++) { 242 tty_insert_flip_string(port->tty, data, length);
250 tty_insert_flip_char (port->tty, data[i], 0);
251 }
252 tty_flip_buffer_push (port->tty); 243 tty_flip_buffer_push (port->tty);
253 } 244 }
254 245
@@ -260,6 +251,7 @@ static void safe_read_bulk_callback (struct urb *urb)
260 251
261 if ((result = usb_submit_urb (urb, GFP_ATOMIC))) { 252 if ((result = usb_submit_urb (urb, GFP_ATOMIC))) {
262 err ("%s - failed resubmitting read urb, error %d", __func__, result); 253 err ("%s - failed resubmitting read urb, error %d", __func__, result);
254 /* FIXME: Need a mechanism to retry later if this happens */
263 } 255 }
264} 256}
265 257
@@ -275,7 +267,7 @@ static int safe_write (struct usb_serial_port *port, const unsigned char *buf, i
275 267
276 if (!port->write_urb) { 268 if (!port->write_urb) {
277 dbg ("%s - write urb NULL", __func__); 269 dbg ("%s - write urb NULL", __func__);
278 return (0); 270 return 0;
279 } 271 }
280 272
281 dbg ("safe_write write_urb: %d transfer_buffer_length", 273 dbg ("safe_write write_urb: %d transfer_buffer_length",
@@ -283,11 +275,11 @@ static int safe_write (struct usb_serial_port *port, const unsigned char *buf, i
283 275
284 if (!port->write_urb->transfer_buffer_length) { 276 if (!port->write_urb->transfer_buffer_length) {
285 dbg ("%s - write urb transfer_buffer_length zero", __func__); 277 dbg ("%s - write urb transfer_buffer_length zero", __func__);
286 return (0); 278 return 0;
287 } 279 }
288 if (count == 0) { 280 if (count == 0) {
289 dbg ("%s - write request of 0 bytes", __func__); 281 dbg ("%s - write request of 0 bytes", __func__);
290 return (0); 282 return 0;
291 } 283 }
292 spin_lock_bh(&port->lock); 284 spin_lock_bh(&port->lock);
293 if (port->write_urb_busy) { 285 if (port->write_urb_busy) {
@@ -359,18 +351,21 @@ static int safe_write (struct usb_serial_port *port, const unsigned char *buf, i
359 351
360static int safe_write_room (struct usb_serial_port *port) 352static int safe_write_room (struct usb_serial_port *port)
361{ 353{
362 int room = 0; // Default: no room 354 int room = 0; /* Default: no room */
355 unsigned long flags;
363 356
364 dbg ("%s", __func__); 357 dbg ("%s", __func__);
365 358
359 spin_lock_irqsave(&port->lock, flags);
366 if (port->write_urb_busy) 360 if (port->write_urb_busy)
367 room = port->bulk_out_size - (safe ? 2 : 0); 361 room = port->bulk_out_size - (safe ? 2 : 0);
362 spin_unlock_irqrestore(&port->lock, flags);
368 363
369 if (room) { 364 if (room) {
370 dbg ("safe_write_room returns %d", room); 365 dbg ("safe_write_room returns %d", room);
371 } 366 }
372 367
373 return (room); 368 return room;
374} 369}
375 370
376static int safe_startup (struct usb_serial *serial) 371static int safe_startup (struct usb_serial *serial)
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index ed30adefff85..23188873eb07 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -566,6 +566,8 @@ static int sierra_chars_in_buffer(struct usb_serial_port *port)
566 * have sent out, but hasn't made it through to the 566 * have sent out, but hasn't made it through to the
567 * device as we can't see the backend here, so just 567 * device as we can't see the backend here, so just
568 * tell the tty layer that everything is flushed. 568 * tell the tty layer that everything is flushed.
569 *
570 * FIXME: should walk the outstanding urbs info
569 */ 571 */
570 return 0; 572 return 0;
571} 573}
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index baf953d14d82..a9934a3f9845 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1179,6 +1179,8 @@ static int __init usb_serial_init(void)
1179 usb_serial_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; 1179 usb_serial_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
1180 usb_serial_tty_driver->init_termios = tty_std_termios; 1180 usb_serial_tty_driver->init_termios = tty_std_termios;
1181 usb_serial_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; 1181 usb_serial_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
1182 usb_serial_tty_driver->init_termios.c_ispeed = 9600;
1183 usb_serial_tty_driver->init_termios.c_ospeed = 9600;
1182 tty_set_operations(usb_serial_tty_driver, &serial_ops); 1184 tty_set_operations(usb_serial_tty_driver, &serial_ops);
1183 result = tty_register_driver(usb_serial_tty_driver); 1185 result = tty_register_driver(usb_serial_tty_driver);
1184 if (result) { 1186 if (result) {
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 137df445e296..a100a52a376e 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -469,6 +469,8 @@ static int visor_chars_in_buffer (struct usb_serial_port *port)
469 * have sent out, but hasn't made it through to the 469 * have sent out, but hasn't made it through to the
470 * device, so just tell the tty layer that everything 470 * device, so just tell the tty layer that everything
471 * is flushed. 471 * is flushed.
472 *
473 * FIXME: Should walk outstanding_urbs
472 */ 474 */
473 return 0; 475 return 0;
474} 476}
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index fb02424de4a0..6926a81a0ccd 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -219,7 +219,7 @@ struct whiteheat_urb_wrap {
219struct whiteheat_private { 219struct whiteheat_private {
220 spinlock_t lock; 220 spinlock_t lock;
221 __u8 flags; 221 __u8 flags;
222 __u8 mcr; 222 __u8 mcr; /* FIXME: no locking on mcr */
223 struct list_head rx_urbs_free; 223 struct list_head rx_urbs_free;
224 struct list_head rx_urbs_submitted; 224 struct list_head rx_urbs_submitted;
225 struct list_head rx_urb_q; 225 struct list_head rx_urb_q;