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,
193 ret = -ENOMEM; in gfs_init()
201 ret = -ENOMEM; in gfs_init()
209 --i; in gfs_init()
214 ret = ffs_single_dev(opts->dev); in gfs_init()
216 ret = ffs_name_dev(opts->dev, func_names[i]); in gfs_init()
219 opts->dev->ffs_ready_callback = functionfs_ready_callback; in gfs_init()
220 opts->dev->ffs_closed_callback = functionfs_closed_callback; in gfs_init()
221 opts->dev->ffs_acquire_dev_callback = functionfs_acquire_dev; in gfs_init()
222 opts->dev->ffs_release_dev_callback = functionfs_release_dev; in gfs_init()
223 opts->no_configfs = true; in gfs_init()
231 usb_put_function_instance(fi_ffs[i--]); in gfs_init()
259 return ERR_PTR(-ENOENT); in functionfs_acquire_dev()
276 if (--missing_funcs) in functionfs_ready_callback()
280 return -EBUSY; in functionfs_ready_callback()
316 return -ENODEV; in gfs_bind()
318 if (can_support_ecm(cdev->gadget)) { in gfs_bind()
325 net = ecm_opts->net; in gfs_bind()
334 net = geth_opts->net; in gfs_bind()
347 func_inst)->net; in gfs_bind()
361 gether_set_gadget(net, cdev->gadget); in gfs_bind()
366 if (can_support_ecm(cdev->gadget)) { in gfs_bind()
370 ecm_opts->bound = true; in gfs_bind()
376 geth_opts->bound = true; in gfs_bind()
388 if (gadget_is_otg(cdev->gadget) && !gfs_otg_desc[0]) { in gfs_bind()
391 usb_desc = usb_otg_descriptor_alloc(cdev->gadget); in gfs_bind()
393 ret = -ENOMEM; in gfs_bind()
396 usb_otg_descriptor_init(cdev->gadget, usb_desc); in gfs_bind()
405 c->c.label = gfs_strings[sid].s; in gfs_bind()
406 c->c.iConfiguration = gfs_strings[sid].id; in gfs_bind()
407 c->c.bConfigurationValue = 1 + i; in gfs_bind()
408 c->c.bmAttributes = USB_CONFIG_ATT_SELFPOWER; in gfs_bind()
410 c->num = i; in gfs_bind()
412 ret = usb_add_config(cdev, &c->c, gfs_do_config); in gfs_bind()
429 if (can_support_ecm(cdev->gadget)) in gfs_bind()
450 if (can_support_ecm(cdev->gadget)) { in gfs_unbind()
479 return -ENODEV; in gfs_do_config()
481 if (gadget_is_otg(c->cdev->gadget)) { in gfs_do_config()
482 c->descriptors = gfs_otg_desc; in gfs_do_config()
483 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; in gfs_do_config()
486 if (gc->eth) { in gfs_do_config()
487 ret = gc->eth(c); in gfs_do_config()
493 f_ffs[gc->num][i] = usb_get_function(fi_ffs[i]); in gfs_do_config()
494 if (IS_ERR(f_ffs[gc->num][i])) { in gfs_do_config()
495 ret = PTR_ERR(f_ffs[gc->num][i]); in gfs_do_config()
498 ret = usb_add_function(c, f_ffs[gc->num][i]); in gfs_do_config()
500 usb_put_function(f_ffs[gc->num][i]); in gfs_do_config()
507 * pointers in c->interface array. This happens every time in gfs_do_config()
513 * c->interface array. We need to make sure this is true. in gfs_do_config()
515 if (c->next_interface_id < ARRAY_SIZE(c->interface)) in gfs_do_config()
516 c->interface[c->next_interface_id] = NULL; in gfs_do_config()
520 while (--i >= 0) { in gfs_do_config()
521 if (!IS_ERR(f_ffs[gc->num][i])) in gfs_do_config()
522 usb_remove_function(c, f_ffs[gc->num][i]); in gfs_do_config()
523 usb_put_function(f_ffs[gc->num][i]); in gfs_do_config()
534 if (can_support_ecm(c->cdev->gadget)) { in eth_bind_config()