summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Szewczyk <p.szewczyk@samsung.com>2018-10-12 13:47:05 +0200
committerPaweł Szewczyk <p.szewczyk@samsung.com>2018-10-12 14:22:05 +0200
commit2b95d87b5fd4c8cd133588e777fcf7126066b626 (patch)
treee31b426d6b2088a14c621d06ea4dcfa26d30cbe8
parentc2449fb54e75c6bd629d86d01a244df6db8a34bb (diff)
downloadlibdevice-node-2b95d87b5fd4c8cd133588e777fcf7126066b626.tar.gz
libdevice-node-2b95d87b5fd4c8cd133588e777fcf7126066b626.tar.bz2
libdevice-node-2b95d87b5fd4c8cd133588e777fcf7126066b626.zip
usb_client: Cleanup ffs services at gadget disablesubmit/tizen/20181015.022811
Each functionfs daemon spawned at gadget initialization should be closed before functionfs can be succesfully cleaned up. Change-Id: I97654fa882f5b7346e5aee3aedd3ea00e50fcb47 Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
-rw-r--r--hw/usb_cfs_client_common.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/hw/usb_cfs_client_common.c b/hw/usb_cfs_client_common.c
index c133aff..0fd1912 100644
--- a/hw/usb_cfs_client_common.c
+++ b/hw/usb_cfs_client_common.c
@@ -836,6 +836,8 @@ static int cfs_enable(struct usb_client *usb)
static int cfs_disable(struct usb_client *usb)
{
struct cfs_client *cfs_client;
+ usbg_function *func;
+ int ret;
if (!usb)
return -EINVAL;
@@ -843,6 +845,29 @@ static int cfs_disable(struct usb_client *usb)
cfs_client = container_of(usb, struct cfs_client,
client);
+ usbg_for_each_function(func, cfs_client->gadget) {
+ char *name = (char *)usbg_get_function_type_str(
+ usbg_get_function_type(func));
+ char *instance = (char *)usbg_get_function_instance(func);
+ struct usb_function *usb_func;
+
+ ret = cfs_find_func(name, instance);
+ if (ret < 0)
+ continue;
+
+ usb_func = _available_funcs[ret];
+ if (usb_func->function_group ==
+ USB_FUNCTION_GROUP_WITH_SERVICE) {
+ struct usb_function_with_service *fws;
+
+ fws = container_of(usb_func,
+ struct usb_function_with_service,
+ func);
+ systemd_stop_socket(fws->service);
+ systemd_stop_service(fws->service);
+ }
+ }
+
return usbg_disable_gadget(cfs_client->gadget);
}