aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/oti6858.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/oti6858.c')
-rw-r--r--drivers/usb/serial/oti6858.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index c644e26394b4..deeacdea05db 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -58,7 +58,7 @@
58#define OTI6858_AUTHOR "Tomasz Michal Lukaszewski <FIXME@FIXME>" 58#define OTI6858_AUTHOR "Tomasz Michal Lukaszewski <FIXME@FIXME>"
59#define OTI6858_VERSION "0.1" 59#define OTI6858_VERSION "0.1"
60 60
61static struct usb_device_id id_table [] = { 61static const struct usb_device_id id_table[] = {
62 { USB_DEVICE(OTI6858_VENDOR_ID, OTI6858_PRODUCT_ID) }, 62 { USB_DEVICE(OTI6858_VENDOR_ID, OTI6858_PRODUCT_ID) },
63 { } 63 { }
64}; 64};
@@ -302,7 +302,7 @@ void send_data(struct work_struct *work)
302 struct usb_serial_port *port = priv->port; 302 struct usb_serial_port *port = priv->port;
303 int count = 0, result; 303 int count = 0, result;
304 unsigned long flags; 304 unsigned long flags;
305 unsigned char allow; 305 u8 *allow;
306 306
307 dbg("%s(port = %d)", __func__, port->number); 307 dbg("%s(port = %d)", __func__, port->number);
308 308
@@ -321,13 +321,20 @@ void send_data(struct work_struct *work)
321 count = port->bulk_out_size; 321 count = port->bulk_out_size;
322 322
323 if (count != 0) { 323 if (count != 0) {
324 allow = kmalloc(1, GFP_KERNEL);
325 if (!allow) {
326 dev_err(&port->dev, "%s(): kmalloc failed\n",
327 __func__);
328 return;
329 }
324 result = usb_control_msg(port->serial->dev, 330 result = usb_control_msg(port->serial->dev,
325 usb_rcvctrlpipe(port->serial->dev, 0), 331 usb_rcvctrlpipe(port->serial->dev, 0),
326 OTI6858_REQ_T_CHECK_TXBUFF, 332 OTI6858_REQ_T_CHECK_TXBUFF,
327 OTI6858_REQ_CHECK_TXBUFF, 333 OTI6858_REQ_CHECK_TXBUFF,
328 count, 0, &allow, 1, 100); 334 count, 0, allow, 1, 100);
329 if (result != 1 || allow != 0) 335 if (result != 1 || *allow != 0)
330 count = 0; 336 count = 0;
337 kfree(allow);
331 } 338 }
332 339
333 if (count == 0) { 340 if (count == 0) {
@@ -578,9 +585,6 @@ static int oti6858_open(struct tty_struct *tty, struct usb_serial_port *port)
578 usb_clear_halt(serial->dev, port->write_urb->pipe); 585 usb_clear_halt(serial->dev, port->write_urb->pipe);
579 usb_clear_halt(serial->dev, port->read_urb->pipe); 586 usb_clear_halt(serial->dev, port->read_urb->pipe);
580 587
581 if (port->port.count != 1)
582 return 0;
583
584 buf = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL); 588 buf = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL);
585 if (buf == NULL) { 589 if (buf == NULL) {
586 dev_err(&port->dev, "%s(): out of memory!\n", __func__); 590 dev_err(&port->dev, "%s(): out of memory!\n", __func__);
@@ -927,10 +931,6 @@ static void oti6858_read_bulk_callback(struct urb *urb)
927 spin_unlock_irqrestore(&priv->lock, flags); 931 spin_unlock_irqrestore(&priv->lock, flags);
928 932
929 if (status != 0) { 933 if (status != 0) {
930 if (!port->port.count) {
931 dbg("%s(): port is closed, exiting", __func__);
932 return;
933 }
934 /* 934 /*
935 if (status == -EPROTO) { 935 if (status == -EPROTO) {
936 * PL2303 mysteriously fails with -EPROTO reschedule 936 * PL2303 mysteriously fails with -EPROTO reschedule
@@ -954,14 +954,12 @@ static void oti6858_read_bulk_callback(struct urb *urb)
954 } 954 }
955 tty_kref_put(tty); 955 tty_kref_put(tty);
956 956
957 /* schedule the interrupt urb if we are still open */ 957 /* schedule the interrupt urb */
958 if (port->port.count != 0) { 958 port->interrupt_in_urb->dev = port->serial->dev;
959 port->interrupt_in_urb->dev = port->serial->dev; 959 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
960 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); 960 if (result != 0 && result != -EPERM) {
961 if (result != 0) { 961 dev_err(&port->dev, "%s(): usb_submit_urb() failed,"
962 dev_err(&port->dev, "%s(): usb_submit_urb() failed," 962 " error %d\n", __func__, result);
963 " error %d\n", __func__, result);
964 }
965 } 963 }
966} 964}
967 965