greybus: es1: separate stopping and deallocating urbs
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 4 Nov 2015 17:55:17 +0000 (18:55 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 5 Nov 2015 04:35:18 +0000 (20:35 -0800)
Separate stopping and deallocating our in-urbs.

This will facilitate implementing proper host-device life-time management.

Compile-only tested.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/es1.c

index 5724771..ddca5f9 100644 (file)
@@ -369,6 +369,9 @@ static void ap_disconnect(struct usb_interface *interface)
        if (!es1)
                return;
 
+       for (i = 0; i < NUM_CPORT_IN_URB; ++i)
+               usb_kill_urb(es1->cport_in_urb[i]);
+
        usb_log_disable(es1);
 
        /* Tear down everything! */
@@ -377,7 +380,6 @@ static void ap_disconnect(struct usb_interface *interface)
 
                if (!urb)
                        break;
-               usb_kill_urb(urb);
                usb_free_urb(urb);
                es1->cport_out_urb[i] = NULL;
                es1->cport_out_urb_busy[i] = false;     /* just to be anal */