Lines Matching +full:num +full:- +full:strings

1 // SPDX-License-Identifier: GPL-2.0+
3 * g_ffs.c -- user mode file system API for USB composite function controllers
108 .language = 0x0409, /* en-us */
109 .strings = gfs_strings,
117 int num; member
151 .strings = gfs_dev_strings,
195 ret = -ENOMEM; in gfs_init()
203 ret = -ENOMEM; in gfs_init()
211 --i; in gfs_init()
216 ret = ffs_single_dev(opts->dev); in gfs_init()
218 ret = ffs_name_dev(opts->dev, func_names[i]); in gfs_init()
221 opts->dev->ffs_ready_callback = functionfs_ready_callback; in gfs_init()
222 opts->dev->ffs_closed_callback = functionfs_closed_callback; in gfs_init()
223 opts->dev->ffs_acquire_dev_callback = functionfs_acquire_dev; in gfs_init()
224 opts->dev->ffs_release_dev_callback = functionfs_release_dev; in gfs_init()
225 opts->no_configfs = true; in gfs_init()
233 usb_put_function_instance(fi_ffs[i--]); in gfs_init()
263 return ERR_PTR(-ENOENT); in functionfs_acquire_dev()
280 if (--missing_funcs) in functionfs_ready_callback()
284 return -EBUSY; in functionfs_ready_callback()
322 return -ENODEV; in gfs_bind()
324 if (can_support_ecm(cdev->gadget)) { in gfs_bind()
331 net = ecm_opts->net; in gfs_bind()
340 net = geth_opts->net; in gfs_bind()
353 func_inst)->net; in gfs_bind()
367 gether_set_gadget(net, cdev->gadget); in gfs_bind()
372 if (can_support_ecm(cdev->gadget)) { in gfs_bind()
376 ecm_opts->bound = true; in gfs_bind()
382 geth_opts->bound = true; in gfs_bind()
394 if (gadget_is_otg(cdev->gadget) && !gfs_otg_desc[0]) { in gfs_bind()
397 usb_desc = usb_otg_descriptor_alloc(cdev->gadget); in gfs_bind()
400 usb_otg_descriptor_init(cdev->gadget, usb_desc); in gfs_bind()
409 c->c.label = gfs_strings[sid].s; in gfs_bind()
410 c->c.iConfiguration = gfs_strings[sid].id; in gfs_bind()
411 c->c.bConfigurationValue = 1 + i; in gfs_bind()
412 c->c.bmAttributes = USB_CONFIG_ATT_SELFPOWER; in gfs_bind()
414 c->num = i; in gfs_bind()
416 ret = usb_add_config(cdev, &c->c, gfs_do_config); in gfs_bind()
433 if (can_support_ecm(cdev->gadget)) in gfs_bind()
457 if (can_support_ecm(cdev->gadget)) { in gfs_unbind()
486 return -ENODEV; in gfs_do_config()
488 if (gadget_is_otg(c->cdev->gadget)) { in gfs_do_config()
489 c->descriptors = gfs_otg_desc; in gfs_do_config()
490 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; in gfs_do_config()
493 if (gc->eth) { in gfs_do_config()
494 ret = gc->eth(c); in gfs_do_config()
500 f_ffs[gc->num][i] = usb_get_function(fi_ffs[i]); in gfs_do_config()
501 if (IS_ERR(f_ffs[gc->num][i])) { in gfs_do_config()
502 ret = PTR_ERR(f_ffs[gc->num][i]); in gfs_do_config()
505 ret = usb_add_function(c, f_ffs[gc->num][i]); in gfs_do_config()
507 usb_put_function(f_ffs[gc->num][i]); in gfs_do_config()
514 * pointers in c->interface array. This happens every time in gfs_do_config()
520 * c->interface array. We need to make sure this is true. in gfs_do_config()
522 if (c->next_interface_id < ARRAY_SIZE(c->interface)) in gfs_do_config()
523 c->interface[c->next_interface_id] = NULL; in gfs_do_config()
527 while (--i >= 0) { in gfs_do_config()
528 if (!IS_ERR(f_ffs[gc->num][i])) in gfs_do_config()
529 usb_remove_function(c, f_ffs[gc->num][i]); in gfs_do_config()
530 usb_put_function(f_ffs[gc->num][i]); in gfs_do_config()
541 if (can_support_ecm(c->cdev->gadget)) { in eth_bind_config()