Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: OS descriptors: provide interface directory names

Function's interface directories need to be created when the function
directory is created, but interface numbers are not known until
the gadget is ready and bound to udc, so we cannot use numbers
as part of interface directory names.
Let the client decide what names to use.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Andrzej Pietrasiewicz and committed by
Felipe Balbi
14574b54 fe00b138

+7 -3
+3 -2
drivers/usb/gadget/configfs.c
··· 1216 1216 int usb_os_desc_prepare_interf_dir(struct config_group *parent, 1217 1217 int n_interf, 1218 1218 struct usb_os_desc **desc, 1219 + char **names, 1219 1220 struct module *owner) 1220 1221 { 1221 1222 struct config_group **f_default_groups, *os_desc_group, ··· 1258 1257 d = desc[n_interf]; 1259 1258 d->owner = owner; 1260 1259 config_group_init_type_name(&d->group, "", interface_type); 1261 - config_item_set_name(&d->group.cg_item, "interface.%d", 1262 - n_interf); 1260 + config_item_set_name(&d->group.cg_item, "interface.%s", 1261 + names[n_interf]); 1263 1262 interface_groups[n_interf] = &d->group; 1264 1263 } 1265 1264
+1
drivers/usb/gadget/configfs.h
··· 8 8 int usb_os_desc_prepare_interf_dir(struct config_group *parent, 9 9 int n_interf, 10 10 struct usb_os_desc **desc, 11 + char **names, 11 12 struct module *owner); 12 13 13 14 static inline struct usb_os_desc *to_usb_os_desc(struct config_item *item)
+3 -1
drivers/usb/gadget/f_rndis.c
··· 905 905 { 906 906 struct f_rndis_opts *opts; 907 907 struct usb_os_desc *descs[1]; 908 + char *names[1]; 908 909 909 910 opts = kzalloc(sizeof(*opts), GFP_KERNEL); 910 911 if (!opts) ··· 923 922 INIT_LIST_HEAD(&opts->rndis_os_desc.ext_prop); 924 923 925 924 descs[0] = &opts->rndis_os_desc; 925 + names[0] = "rndis"; 926 926 usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs, 927 - THIS_MODULE); 927 + names, THIS_MODULE); 928 928 config_group_init_type_name(&opts->func_inst.group, "", 929 929 &rndis_func_type); 930 930