]> git.karo-electronics.de Git - linux-beck.git/commitdiff
greybus: core: disable bundle connections on hot-unplug
authorJohan Hovold <johan@hovoldconsulting.com>
Tue, 19 Jan 2016 11:51:18 +0000 (12:51 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 19 Jan 2016 20:17:13 +0000 (12:17 -0800)
Disable bundle connections in core before calling driver disconnect in
case the interface is already gone.

This avoids unnecessary timeouts on hot-unplug when a driver does I/O in
its disconnect callback.

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/core.c

index a72191f467512a89a20e4d504a16f3c18697047c..522d0594eebc5284e41c5ef60d2c77b7a054c9ab 100644 (file)
@@ -161,8 +161,12 @@ static int greybus_remove(struct device *dev)
        struct gb_bundle *bundle = to_gb_bundle(dev);
        struct gb_connection *connection;
 
-       list_for_each_entry(connection, &bundle->connections, bundle_links)
-               gb_connection_disable_rx(connection);
+       list_for_each_entry(connection, &bundle->connections, bundle_links) {
+               if (bundle->intf->disconnected)
+                       gb_connection_disable(connection);
+               else
+                       gb_connection_disable_rx(connection);
+       }
 
        driver->disconnect(bundle);