aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/sierra.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/sierra.c')
-rw-r--r--drivers/usb/serial/sierra.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index ecedd833818d..644607de4c11 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -456,12 +456,6 @@ static int sierra_open(struct usb_serial_port *port, struct file *filp)
456 return (0); 456 return (0);
457} 457}
458 458
459static inline void stop_urb(struct urb *urb)
460{
461 if (urb && urb->status == -EINPROGRESS)
462 usb_kill_urb(urb);
463}
464
465static void sierra_close(struct usb_serial_port *port, struct file *filp) 459static void sierra_close(struct usb_serial_port *port, struct file *filp)
466{ 460{
467 int i; 461 int i;
@@ -479,9 +473,9 @@ static void sierra_close(struct usb_serial_port *port, struct file *filp)
479 473
480 /* Stop reading/writing urbs */ 474 /* Stop reading/writing urbs */
481 for (i = 0; i < N_IN_URB; i++) 475 for (i = 0; i < N_IN_URB; i++)
482 stop_urb(portdata->in_urbs[i]); 476 usb_unlink_urb(portdata->in_urbs[i]);
483 for (i = 0; i < N_OUT_URB; i++) 477 for (i = 0; i < N_OUT_URB; i++)
484 stop_urb(portdata->out_urbs[i]); 478 usb_unlink_urb(portdata->out_urbs[i]);
485 } 479 }
486 port->tty = NULL; 480 port->tty = NULL;
487} 481}
@@ -583,17 +577,26 @@ static void sierra_shutdown(struct usb_serial *serial)
583 /* Stop reading/writing urbs */ 577 /* Stop reading/writing urbs */
584 for (i = 0; i < serial->num_ports; ++i) { 578 for (i = 0; i < serial->num_ports; ++i) {
585 port = serial->port[i]; 579 port = serial->port[i];
580 if (!port)
581 continue;
586 portdata = usb_get_serial_port_data(port); 582 portdata = usb_get_serial_port_data(port);
583 if (!portdata)
584 continue;
585
587 for (j = 0; j < N_IN_URB; j++) 586 for (j = 0; j < N_IN_URB; j++)
588 stop_urb(portdata->in_urbs[j]); 587 usb_unlink_urb(portdata->in_urbs[j]);
589 for (j = 0; j < N_OUT_URB; j++) 588 for (j = 0; j < N_OUT_URB; j++)
590 stop_urb(portdata->out_urbs[j]); 589 usb_unlink_urb(portdata->out_urbs[j]);
591 } 590 }
592 591
593 /* Now free them */ 592 /* Now free them */
594 for (i = 0; i < serial->num_ports; ++i) { 593 for (i = 0; i < serial->num_ports; ++i) {
595 port = serial->port[i]; 594 port = serial->port[i];
595 if (!port)
596 continue;
596 portdata = usb_get_serial_port_data(port); 597 portdata = usb_get_serial_port_data(port);
598 if (!portdata)
599 continue;
597 600
598 for (j = 0; j < N_IN_URB; j++) { 601 for (j = 0; j < N_IN_URB; j++) {
599 if (portdata->in_urbs[j]) { 602 if (portdata->in_urbs[j]) {
@@ -612,6 +615,8 @@ static void sierra_shutdown(struct usb_serial *serial)
612 /* Now free per port private data */ 615 /* Now free per port private data */
613 for (i = 0; i < serial->num_ports; i++) { 616 for (i = 0; i < serial->num_ports; i++) {
614 port = serial->port[i]; 617 port = serial->port[i];
618 if (!port)
619 continue;
615 kfree(usb_get_serial_port_data(port)); 620 kfree(usb_get_serial_port_data(port));
616 } 621 }
617} 622}