]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
greybus: interface: move interface-removal helper
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 9 Mar 2016 11:20:41 +0000 (12:20 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 10 Mar 2016 21:57:42 +0000 (13:57 -0800)
Move helper to remove all interfaces of a host-device to the svc code
and call it when removing the svc device as this needs to be coordinated
with flushing the SVC work queue.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/hd.c
drivers/staging/greybus/interface.c
drivers/staging/greybus/interface.h
drivers/staging/greybus/svc.c

index 147a92d14cfc1d566759f9e28e245f8087b3e788..2c13860e4a05984a5508d13904832dced3655e40 100644 (file)
@@ -138,7 +138,6 @@ void gb_hd_del(struct gb_host_device *hd)
         * removing the remaining interfaces.
         */
        gb_svc_del(hd->svc);
-       gb_interfaces_remove(hd);
 
        device_del(&hd->dev);
 }
index 4671f4092a1796c6fa9e1d11b228031db6cbcb16..ebf008161120fc47c7b338feaca3d201faee8493 100644 (file)
@@ -167,14 +167,6 @@ void gb_interface_remove(struct gb_interface *intf)
        put_device(&intf->dev);
 }
 
-void gb_interfaces_remove(struct gb_host_device *hd)
-{
-       struct gb_interface *intf, *temp;
-
-       list_for_each_entry_safe(intf, temp, &hd->interfaces, links)
-               gb_interface_remove(intf);
-}
-
 /*
  * Intialise an interface by enabling the control connection and fetching the
  * manifest and other information over it.
index 5238804e236bc33eac31ba526fdd11e08d59771f..7fc7d29257d99490f04ef3e2a690f9675dcfe7ea 100644 (file)
@@ -50,6 +50,5 @@ struct gb_interface *gb_interface_create(struct gb_host_device *hd,
 int gb_interface_init(struct gb_interface *intf);
 int gb_interface_add(struct gb_interface *intf);
 void gb_interface_remove(struct gb_interface *intf);
-void gb_interfaces_remove(struct gb_host_device *hd);
 
 #endif /* __INTERFACE_H */
index 572ed0e23fe799e81ce713984b4fc40011cadddf..446cb25b49c02362b07978b5da2d8e6c8ad46a30 100644 (file)
@@ -997,6 +997,14 @@ int gb_svc_add(struct gb_svc *svc)
        return 0;
 }
 
+static void gb_svc_remove_interfaces(struct gb_svc *svc)
+{
+       struct gb_interface *intf, *tmp;
+
+       list_for_each_entry_safe(intf, tmp, &svc->hd->interfaces, links)
+               gb_interface_remove(intf);
+}
+
 void gb_svc_del(struct gb_svc *svc)
 {
        gb_connection_disable(svc->connection);
@@ -1012,6 +1020,8 @@ void gb_svc_del(struct gb_svc *svc)
        }
 
        flush_workqueue(svc->wq);
+
+       gb_svc_remove_interfaces(svc);
 }
 
 void gb_svc_put(struct gb_svc *svc)