aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/visor.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/visor.c')
-rw-r--r--drivers/usb/serial/visor.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 1aa5d20a5d99..ad1f9232292d 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -513,7 +513,8 @@ static void visor_read_bulk_callback(struct urb *urb)
513 tty_kref_put(tty); 513 tty_kref_put(tty);
514 } 514 }
515 spin_lock(&priv->lock); 515 spin_lock(&priv->lock);
516 priv->bytes_in += available_room; 516 if (tty)
517 priv->bytes_in += available_room;
517 518
518 } else { 519 } else {
519 spin_lock(&priv->lock); 520 spin_lock(&priv->lock);
@@ -582,12 +583,11 @@ static void visor_throttle(struct tty_struct *tty)
582{ 583{
583 struct usb_serial_port *port = tty->driver_data; 584 struct usb_serial_port *port = tty->driver_data;
584 struct visor_private *priv = usb_get_serial_port_data(port); 585 struct visor_private *priv = usb_get_serial_port_data(port);
585 unsigned long flags;
586 586
587 dbg("%s - port %d", __func__, port->number); 587 dbg("%s - port %d", __func__, port->number);
588 spin_lock_irqsave(&priv->lock, flags); 588 spin_lock_irq(&priv->lock);
589 priv->throttled = 1; 589 priv->throttled = 1;
590 spin_unlock_irqrestore(&priv->lock, flags); 590 spin_unlock_irq(&priv->lock);
591} 591}
592 592
593 593
@@ -595,21 +595,23 @@ static void visor_unthrottle(struct tty_struct *tty)
595{ 595{
596 struct usb_serial_port *port = tty->driver_data; 596 struct usb_serial_port *port = tty->driver_data;
597 struct visor_private *priv = usb_get_serial_port_data(port); 597 struct visor_private *priv = usb_get_serial_port_data(port);
598 unsigned long flags; 598 int result, was_throttled;
599 int result;
600 599
601 dbg("%s - port %d", __func__, port->number); 600 dbg("%s - port %d", __func__, port->number);
602 spin_lock_irqsave(&priv->lock, flags); 601 spin_lock_irq(&priv->lock);
603 priv->throttled = 0; 602 priv->throttled = 0;
603 was_throttled = priv->actually_throttled;
604 priv->actually_throttled = 0; 604 priv->actually_throttled = 0;
605 spin_unlock_irqrestore(&priv->lock, flags); 605 spin_unlock_irq(&priv->lock);
606 606
607 port->read_urb->dev = port->serial->dev; 607 if (was_throttled) {
608 result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 608 port->read_urb->dev = port->serial->dev;
609 if (result) 609 result = usb_submit_urb(port->read_urb, GFP_KERNEL);
610 dev_err(&port->dev, 610 if (result)
611 "%s - failed submitting read urb, error %d\n", 611 dev_err(&port->dev,
612 "%s - failed submitting read urb, error %d\n",
612 __func__, result); 613 __func__, result);
614 }
613} 615}
614 616
615static int palm_os_3_probe(struct usb_serial *serial, 617static int palm_os_3_probe(struct usb_serial *serial,