]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
greybus: interface: fix hot-unplug control-connection timeouts
authorJohan Hovold <johan@hovoldconsulting.com>
Tue, 15 Dec 2015 14:28:57 +0000 (15:28 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 15 Dec 2015 22:23:37 +0000 (14:23 -0800)
Set an interface disconnected flag when the interface has been
hot-unplugged (e.g. forcibly removed or after a reboot), and use it to
disable the control connection early when deregistering the interface
and its bundles.

This avoids a one-second (default) timeout for every enabled connection
(e.g. one per bundle) at hot-unplug, something which for the default
gpbridge manifest currently amounts to five seconds.

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

index aa30dc2a9551e80e537f3605cd44bb200fe1bc69..ecc64bedbef5dbf55c729da5578f9987aa073380 100644 (file)
@@ -130,6 +130,9 @@ void gb_interface_remove(struct gb_interface *intf)
        struct gb_bundle *bundle;
        struct gb_bundle *next;
 
+       if (intf->disconnected)
+               gb_control_disable(intf->control);
+
        list_for_each_entry_safe(bundle, next, &intf->bundles, links)
                gb_bundle_destroy(bundle);
 
index 61e9c05e75c61a9d882df82696fb242b237461a7..ca123ce11e767f72f4873baa9140aa0b4ffd175d 100644 (file)
@@ -35,6 +35,7 @@ struct gb_interface {
 
        /* The interface needs to boot over unipro */
        bool boot_over_unipro;
+       bool disconnected;
 };
 #define to_gb_interface(d) container_of(d, struct gb_interface, dev)
 
index c013083d79f6623ca30fd963c1da8153cadfd7a7..5c4ca7938387f13ec0909f8b65a116f942e8583d 100644 (file)
@@ -335,9 +335,10 @@ static int gb_svc_hello(struct gb_operation *op)
 static void gb_svc_intf_remove(struct gb_svc *svc, struct gb_interface *intf)
 {
        u8 intf_id = intf->interface_id;
-       u8 device_id;
+       u8 device_id = intf->device_id;
+
+       intf->disconnected = true;
 
-       device_id = intf->device_id;
        gb_interface_remove(intf);
 
        /*