diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-17 16:25:46 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-17 16:25:46 -0700 |
commit | 364e8dd9d636fea7def862919aac092b19b7c581 (patch) | |
tree | abc0b5859a8cea40ac2d5fbee47dfabc276036c9 /drivers/usb/gadget/configfs.c | |
parent | 48d10bda1f2c69980601a61194015bb0790fb7ab (diff) | |
parent | 1ae1602de028acaa42a0f6ff18d19756f8e825c6 (diff) |
Merge tag 'configfs-for-linus' of git://git.infradead.org/users/hch/configfs
Pull configfs updates from Christoph Hellwig:
- A large patch from me to simplify setting up the list of default
groups by actually implementing it as a list instead of an array.
- a small Y2083 prep patch from Deepa Dinamani. Probably doesn't
matter on it's own, but it seems like he is trying to get rid of all
CURRENT_TIME uses in file systems, which is a worthwhile goal.
* tag 'configfs-for-linus' of git://git.infradead.org/users/hch/configfs:
configfs: switch ->default groups to a linked list
configfs: Replace CURRENT_TIME by current_fs_time()
Diffstat (limited to 'drivers/usb/gadget/configfs.c')
-rw-r--r-- | drivers/usb/gadget/configfs.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index c6cc15ebeed6..b6f60ca8a035 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -49,7 +49,6 @@ struct gadget_info { struct config_group configs_group; struct config_group strings_group; struct config_group os_desc_group; - struct config_group *default_groups[5]; struct mutex lock; struct usb_gadget_strings *gstrings[MAX_USB_STRING_LANGS + 1]; @@ -71,7 +70,6 @@ static inline struct gadget_info *to_gadget_info(struct config_item *item) struct config_usb_cfg { struct config_group group; struct config_group strings_group; - struct config_group *default_groups[2]; struct list_head string_list; struct usb_configuration c; struct list_head func_list; @@ -666,13 +664,12 @@ static struct config_group *config_desc_make( INIT_LIST_HEAD(&cfg->string_list); INIT_LIST_HEAD(&cfg->func_list); - cfg->group.default_groups = cfg->default_groups; - cfg->default_groups[0] = &cfg->strings_group; - config_group_init_type_name(&cfg->group, name, &gadget_config_type); + config_group_init_type_name(&cfg->strings_group, "strings", &gadget_config_name_strings_type); + configfs_add_default_group(&cfg->strings_group, &cfg->group); ret = usb_add_config_only(&gi->cdev, &cfg->c); if (ret) @@ -1149,15 +1146,11 @@ int usb_os_desc_prepare_interf_dir(struct config_group *parent, char **names, struct module *owner) { - struct config_group **f_default_groups, *os_desc_group, - **interface_groups; + struct config_group *os_desc_group; struct config_item_type *os_desc_type, *interface_type; vla_group(data_chunk); - vla_item(data_chunk, struct config_group *, f_default_groups, 2); vla_item(data_chunk, struct config_group, os_desc_group, 1); - vla_item(data_chunk, struct config_group *, interface_groups, - n_interf + 1); vla_item(data_chunk, struct config_item_type, os_desc_type, 1); vla_item(data_chunk, struct config_item_type, interface_type, 1); @@ -1165,18 +1158,14 @@ int usb_os_desc_prepare_interf_dir(struct config_group *parent, if (!vlabuf) return -ENOMEM; - f_default_groups = vla_ptr(vlabuf, data_chunk, f_default_groups); os_desc_group = vla_ptr(vlabuf, data_chunk, os_desc_group); os_desc_type = vla_ptr(vlabuf, data_chunk, os_desc_type); - interface_groups = vla_ptr(vlabuf, data_chunk, interface_groups); interface_type = vla_ptr(vlabuf, data_chunk, interface_type); - parent->default_groups = f_default_groups; os_desc_type->ct_owner = owner; config_group_init_type_name(os_desc_group, "os_desc", os_desc_type); - f_default_groups[0] = os_desc_group; + configfs_add_default_group(os_desc_group, parent); - os_desc_group->default_groups = interface_groups; interface_type->ct_group_ops = &interf_grp_ops; interface_type->ct_attrs = interf_grp_attrs; interface_type->ct_owner = owner; @@ -1189,7 +1178,7 @@ int usb_os_desc_prepare_interf_dir(struct config_group *parent, config_group_init_type_name(&d->group, "", interface_type); config_item_set_name(&d->group.cg_item, "interface.%s", names[n_interf]); - interface_groups[n_interf] = &d->group; + configfs_add_default_group(&d->group, os_desc_group); } return 0; @@ -1424,20 +1413,23 @@ static struct config_group *gadgets_make( if (!gi) return ERR_PTR(-ENOMEM); - gi->group.default_groups = gi->default_groups; - gi->group.default_groups[0] = &gi->functions_group; - gi->group.default_groups[1] = &gi->configs_group; - gi->group.default_groups[2] = &gi->strings_group; - gi->group.default_groups[3] = &gi->os_desc_group; + config_group_init_type_name(&gi->group, name, &gadget_root_type); config_group_init_type_name(&gi->functions_group, "functions", &functions_type); + configfs_add_default_group(&gi->functions_group, &gi->group); + config_group_init_type_name(&gi->configs_group, "configs", &config_desc_type); + configfs_add_default_group(&gi->configs_group, &gi->group); + config_group_init_type_name(&gi->strings_group, "strings", &gadget_strings_strings_type); + configfs_add_default_group(&gi->strings_group, &gi->group); + config_group_init_type_name(&gi->os_desc_group, "os_desc", &os_desc_type); + configfs_add_default_group(&gi->os_desc_group, &gi->group); gi->composite.bind = configfs_do_nothing; gi->composite.unbind = configfs_do_nothing; @@ -1462,8 +1454,6 @@ static struct config_group *gadgets_make( if (!gi->composite.gadget_driver.function) goto err; - config_group_init_type_name(&gi->group, name, - &gadget_root_type); return &gi->group; err: kfree(gi); |