diff options
Diffstat (limited to 'drivers/usb/serial/visor.c')
-rw-r--r-- | drivers/usb/serial/visor.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index ad1f9232292d..094942707c7d 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -368,7 +368,7 @@ static int visor_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
368 | spin_lock_irqsave(&priv->lock, flags); | 368 | spin_lock_irqsave(&priv->lock, flags); |
369 | if (priv->outstanding_urbs > URB_UPPER_LIMIT) { | 369 | if (priv->outstanding_urbs > URB_UPPER_LIMIT) { |
370 | spin_unlock_irqrestore(&priv->lock, flags); | 370 | spin_unlock_irqrestore(&priv->lock, flags); |
371 | dbg("%s - write limit hit\n", __func__); | 371 | dbg("%s - write limit hit", __func__); |
372 | return 0; | 372 | return 0; |
373 | } | 373 | } |
374 | priv->outstanding_urbs++; | 374 | priv->outstanding_urbs++; |
@@ -446,7 +446,7 @@ static int visor_write_room(struct tty_struct *tty) | |||
446 | spin_lock_irqsave(&priv->lock, flags); | 446 | spin_lock_irqsave(&priv->lock, flags); |
447 | if (priv->outstanding_urbs > URB_UPPER_LIMIT * 2 / 3) { | 447 | if (priv->outstanding_urbs > URB_UPPER_LIMIT * 2 / 3) { |
448 | spin_unlock_irqrestore(&priv->lock, flags); | 448 | spin_unlock_irqrestore(&priv->lock, flags); |
449 | dbg("%s - write limit hit\n", __func__); | 449 | dbg("%s - write limit hit", __func__); |
450 | return 0; | 450 | return 0; |
451 | } | 451 | } |
452 | spin_unlock_irqrestore(&priv->lock, flags); | 452 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -503,13 +503,9 @@ static void visor_read_bulk_callback(struct urb *urb) | |||
503 | if (urb->actual_length) { | 503 | if (urb->actual_length) { |
504 | tty = tty_port_tty_get(&port->port); | 504 | tty = tty_port_tty_get(&port->port); |
505 | if (tty) { | 505 | if (tty) { |
506 | available_room = tty_buffer_request_room(tty, | 506 | tty_insert_flip_string(tty, data, |
507 | urb->actual_length); | 507 | urb->actual_length); |
508 | if (available_room) { | 508 | tty_flip_buffer_push(tty); |
509 | tty_insert_flip_string(tty, data, | ||
510 | available_room); | ||
511 | tty_flip_buffer_push(tty); | ||
512 | } | ||
513 | tty_kref_put(tty); | 509 | tty_kref_put(tty); |
514 | } | 510 | } |
515 | spin_lock(&priv->lock); | 511 | spin_lock(&priv->lock); |
@@ -807,10 +803,14 @@ static int clie_3_5_startup(struct usb_serial *serial) | |||
807 | { | 803 | { |
808 | struct device *dev = &serial->dev->dev; | 804 | struct device *dev = &serial->dev->dev; |
809 | int result; | 805 | int result; |
810 | u8 data; | 806 | u8 *data; |
811 | 807 | ||
812 | dbg("%s", __func__); | 808 | dbg("%s", __func__); |
813 | 809 | ||
810 | data = kmalloc(1, GFP_KERNEL); | ||
811 | if (!data) | ||
812 | return -ENOMEM; | ||
813 | |||
814 | /* | 814 | /* |
815 | * Note that PEG-300 series devices expect the following two calls. | 815 | * Note that PEG-300 series devices expect the following two calls. |
816 | */ | 816 | */ |
@@ -818,36 +818,42 @@ static int clie_3_5_startup(struct usb_serial *serial) | |||
818 | /* get the config number */ | 818 | /* get the config number */ |
819 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 819 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
820 | USB_REQ_GET_CONFIGURATION, USB_DIR_IN, | 820 | USB_REQ_GET_CONFIGURATION, USB_DIR_IN, |
821 | 0, 0, &data, 1, 3000); | 821 | 0, 0, data, 1, 3000); |
822 | if (result < 0) { | 822 | if (result < 0) { |
823 | dev_err(dev, "%s: get config number failed: %d\n", | 823 | dev_err(dev, "%s: get config number failed: %d\n", |
824 | __func__, result); | 824 | __func__, result); |
825 | return result; | 825 | goto out; |
826 | } | 826 | } |
827 | if (result != 1) { | 827 | if (result != 1) { |
828 | dev_err(dev, "%s: get config number bad return length: %d\n", | 828 | dev_err(dev, "%s: get config number bad return length: %d\n", |
829 | __func__, result); | 829 | __func__, result); |
830 | return -EIO; | 830 | result = -EIO; |
831 | goto out; | ||
831 | } | 832 | } |
832 | 833 | ||
833 | /* get the interface number */ | 834 | /* get the interface number */ |
834 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 835 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
835 | USB_REQ_GET_INTERFACE, | 836 | USB_REQ_GET_INTERFACE, |
836 | USB_DIR_IN | USB_RECIP_INTERFACE, | 837 | USB_DIR_IN | USB_RECIP_INTERFACE, |
837 | 0, 0, &data, 1, 3000); | 838 | 0, 0, data, 1, 3000); |
838 | if (result < 0) { | 839 | if (result < 0) { |
839 | dev_err(dev, "%s: get interface number failed: %d\n", | 840 | dev_err(dev, "%s: get interface number failed: %d\n", |
840 | __func__, result); | 841 | __func__, result); |
841 | return result; | 842 | goto out; |
842 | } | 843 | } |
843 | if (result != 1) { | 844 | if (result != 1) { |
844 | dev_err(dev, | 845 | dev_err(dev, |
845 | "%s: get interface number bad return length: %d\n", | 846 | "%s: get interface number bad return length: %d\n", |
846 | __func__, result); | 847 | __func__, result); |
847 | return -EIO; | 848 | result = -EIO; |
849 | goto out; | ||
848 | } | 850 | } |
849 | 851 | ||
850 | return generic_startup(serial); | 852 | result = generic_startup(serial); |
853 | out: | ||
854 | kfree(data); | ||
855 | |||
856 | return result; | ||
851 | } | 857 | } |
852 | 858 | ||
853 | static int treo_attach(struct usb_serial *serial) | 859 | static int treo_attach(struct usb_serial *serial) |