static int cfs_disable(struct usb_client *usb)
{
struct cfs_client *cfs_client;
+ usbg_function *func;
+ int ret;
if (!usb)
return -EINVAL;
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);
}