summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2016-03-09 11:20:41 (GMT)
committerGreg Kroah-Hartman <gregkh@google.com>2016-03-10 21:57:42 (GMT)
commit66d674cfafb2be4002265e6081a1580d0ea461f7 (patch)
treec8746898026d2ebd5fa07c5be0bdf853e83f35be /drivers/staging/greybus
parent64acb6611f3c17251347870e73ddc106fed807cb (diff)
downloadlinux-66d674cfafb2be4002265e6081a1580d0ea461f7.tar.xz
greybus: interface: move interface-removal helper
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>
Diffstat (limited to 'drivers/staging/greybus')
-rw-r--r--drivers/staging/greybus/hd.c1
-rw-r--r--drivers/staging/greybus/interface.c8
-rw-r--r--drivers/staging/greybus/interface.h1
-rw-r--r--drivers/staging/greybus/svc.c10
4 files changed, 10 insertions, 10 deletions
diff --git a/drivers/staging/greybus/hd.c b/drivers/staging/greybus/hd.c
index 147a92d..2c13860 100644
--- a/drivers/staging/greybus/hd.c
+++ b/drivers/staging/greybus/hd.c
@@ -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);
}
diff --git a/drivers/staging/greybus/interface.c b/drivers/staging/greybus/interface.c
index 4671f40..ebf0081 100644
--- a/drivers/staging/greybus/interface.c
+++ b/drivers/staging/greybus/interface.c
@@ -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.
diff --git a/drivers/staging/greybus/interface.h b/drivers/staging/greybus/interface.h
index 5238804..7fc7d29 100644
--- a/drivers/staging/greybus/interface.h
+++ b/drivers/staging/greybus/interface.h
@@ -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 */
diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c
index 572ed0e..446cb25 100644
--- a/drivers/staging/greybus/svc.c
+++ b/drivers/staging/greybus/svc.c
@@ -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)