diff options
Diffstat (limited to 'drivers/usb/gadget/function/uvc_configfs.c')
-rw-r--r-- | drivers/usb/gadget/function/uvc_configfs.c | 198 |
1 files changed, 79 insertions, 119 deletions
diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c index ad8c9b05572d..66753ba7a42e 100644 --- a/drivers/usb/gadget/function/uvc_configfs.c +++ b/drivers/usb/gadget/function/uvc_configfs.c @@ -272,11 +272,6 @@ static struct config_item_type uvcg_default_processing_type = { /* struct uvcg_processing {}; */ -static struct config_group *uvcg_processing_default_groups[] = { - &uvcg_default_processing.group, - NULL, -}; - /* control/processing */ static struct uvcg_processing_grp { struct config_group group; @@ -394,11 +389,6 @@ static struct config_item_type uvcg_default_camera_type = { /* struct uvcg_camera {}; */ -static struct config_group *uvcg_camera_default_groups[] = { - &uvcg_default_camera.group, - NULL, -}; - /* control/terminal/camera */ static struct uvcg_camera_grp { struct config_group group; @@ -477,11 +467,6 @@ static struct config_item_type uvcg_default_output_type = { /* struct uvcg_output {}; */ -static struct config_group *uvcg_output_default_groups[] = { - &uvcg_default_output.group, - NULL, -}; - /* control/terminal/output */ static struct uvcg_output_grp { struct config_group group; @@ -491,12 +476,6 @@ static struct config_item_type uvcg_output_grp_type = { .ct_owner = THIS_MODULE, }; -static struct config_group *uvcg_terminal_default_groups[] = { - &uvcg_camera_grp.group, - &uvcg_output_grp.group, - NULL, -}; - /* control/terminal */ static struct uvcg_terminal_grp { struct config_group group; @@ -619,12 +598,6 @@ static struct config_item_type uvcg_control_class_type = { .ct_owner = THIS_MODULE, }; -static struct config_group *uvcg_control_class_default_groups[] = { - &uvcg_control_class_fs.group, - &uvcg_control_class_ss.group, - NULL, -}; - /* control/class */ static struct uvcg_control_class_grp { struct config_group group; @@ -634,14 +607,6 @@ static struct config_item_type uvcg_control_class_grp_type = { .ct_owner = THIS_MODULE, }; -static struct config_group *uvcg_control_default_groups[] = { - &uvcg_control_header_grp.group, - &uvcg_processing_grp.group, - &uvcg_terminal_grp.group, - &uvcg_control_class_grp.group, - NULL, -}; - /* control */ static struct uvcg_control_grp { struct config_group group; @@ -1780,11 +1745,6 @@ static struct config_item_type uvcg_default_color_matching_type = { /* struct uvcg_color_matching {}; */ -static struct config_group *uvcg_color_matching_default_groups[] = { - &uvcg_default_color_matching.group, - NULL, -}; - /* streaming/color_matching */ static struct uvcg_color_matching_grp { struct config_group group; @@ -2145,13 +2105,6 @@ static struct config_item_type uvcg_streaming_class_type = { .ct_owner = THIS_MODULE, }; -static struct config_group *uvcg_streaming_class_default_groups[] = { - &uvcg_streaming_class_fs.group, - &uvcg_streaming_class_hs.group, - &uvcg_streaming_class_ss.group, - NULL, -}; - /* streaming/class */ static struct uvcg_streaming_class_grp { struct config_group group; @@ -2161,15 +2114,6 @@ static struct config_item_type uvcg_streaming_class_grp_type = { .ct_owner = THIS_MODULE, }; -static struct config_group *uvcg_streaming_default_groups[] = { - &uvcg_streaming_header_grp.group, - &uvcg_uncompressed_grp.group, - &uvcg_mjpeg_grp.group, - &uvcg_color_matching_grp.group, - &uvcg_streaming_class_grp.group, - NULL, -}; - /* streaming */ static struct uvcg_streaming_grp { struct config_group group; @@ -2179,12 +2123,6 @@ static struct config_item_type uvcg_streaming_grp_type = { .ct_owner = THIS_MODULE, }; -static struct config_group *uvcg_default_groups[] = { - &uvcg_control_grp.group, - &uvcg_streaming_grp.group, - NULL, -}; - static inline struct f_uvc_opts *to_f_uvc_opts(struct config_item *item) { return container_of(to_config_group(item), struct f_uvc_opts, @@ -2273,59 +2211,64 @@ static struct config_item_type uvc_func_type = { .ct_owner = THIS_MODULE, }; -static inline void uvcg_init_group(struct config_group *g, - struct config_group **default_groups, - const char *name, - struct config_item_type *type) -{ - g->default_groups = default_groups; - config_group_init_type_name(g, name, type); -} - int uvcg_attach_configfs(struct f_uvc_opts *opts) { config_group_init_type_name(&uvcg_control_header_grp.group, "header", &uvcg_control_header_grp_type); + config_group_init_type_name(&uvcg_default_processing.group, - "default", - &uvcg_default_processing_type); - uvcg_init_group(&uvcg_processing_grp.group, - uvcg_processing_default_groups, - "processing", - &uvcg_processing_grp_type); + "default", &uvcg_default_processing_type); + config_group_init_type_name(&uvcg_processing_grp.group, + "processing", &uvcg_processing_grp_type); + configfs_add_default_group(&uvcg_default_processing.group, + &uvcg_processing_grp.group); + config_group_init_type_name(&uvcg_default_camera.group, - "default", - &uvcg_default_camera_type); - uvcg_init_group(&uvcg_camera_grp.group, - uvcg_camera_default_groups, - "camera", - &uvcg_camera_grp_type); + "default", &uvcg_default_camera_type); + config_group_init_type_name(&uvcg_camera_grp.group, + "camera", &uvcg_camera_grp_type); + configfs_add_default_group(&uvcg_default_camera.group, + &uvcg_camera_grp.group); + config_group_init_type_name(&uvcg_default_output.group, - "default", - &uvcg_default_output_type); - uvcg_init_group(&uvcg_output_grp.group, - uvcg_output_default_groups, - "output", - &uvcg_output_grp_type); - uvcg_init_group(&uvcg_terminal_grp.group, - uvcg_terminal_default_groups, - "terminal", - &uvcg_terminal_grp_type); + "default", &uvcg_default_output_type); + config_group_init_type_name(&uvcg_output_grp.group, + "output", &uvcg_output_grp_type); + configfs_add_default_group(&uvcg_default_output.group, + &uvcg_output_grp.group); + + config_group_init_type_name(&uvcg_terminal_grp.group, + "terminal", &uvcg_terminal_grp_type); + configfs_add_default_group(&uvcg_camera_grp.group, + &uvcg_terminal_grp.group); + configfs_add_default_group(&uvcg_output_grp.group, + &uvcg_terminal_grp.group); + config_group_init_type_name(&uvcg_control_class_fs.group, - "fs", - &uvcg_control_class_type); + "fs", &uvcg_control_class_type); config_group_init_type_name(&uvcg_control_class_ss.group, - "ss", - &uvcg_control_class_type); - uvcg_init_group(&uvcg_control_class_grp.group, - uvcg_control_class_default_groups, + "ss", &uvcg_control_class_type); + config_group_init_type_name(&uvcg_control_class_grp.group, "class", &uvcg_control_class_grp_type); - uvcg_init_group(&uvcg_control_grp.group, - uvcg_control_default_groups, + configfs_add_default_group(&uvcg_control_class_fs.group, + &uvcg_control_class_grp.group); + configfs_add_default_group(&uvcg_control_class_ss.group, + &uvcg_control_class_grp.group); + + config_group_init_type_name(&uvcg_control_grp.group, "control", &uvcg_control_grp_type); + configfs_add_default_group(&uvcg_control_header_grp.group, + &uvcg_control_grp.group); + configfs_add_default_group(&uvcg_processing_grp.group, + &uvcg_control_grp.group); + configfs_add_default_group(&uvcg_terminal_grp.group, + &uvcg_control_grp.group); + configfs_add_default_group(&uvcg_control_class_grp.group, + &uvcg_control_grp.group); + config_group_init_type_name(&uvcg_streaming_header_grp.group, "header", &uvcg_streaming_header_grp_type); @@ -2338,30 +2281,47 @@ int uvcg_attach_configfs(struct f_uvc_opts *opts) config_group_init_type_name(&uvcg_default_color_matching.group, "default", &uvcg_default_color_matching_type); - uvcg_init_group(&uvcg_color_matching_grp.group, - uvcg_color_matching_default_groups, + config_group_init_type_name(&uvcg_color_matching_grp.group, "color_matching", &uvcg_color_matching_grp_type); + configfs_add_default_group(&uvcg_default_color_matching.group, + &uvcg_color_matching_grp.group); + config_group_init_type_name(&uvcg_streaming_class_fs.group, - "fs", - &uvcg_streaming_class_type); + "fs", &uvcg_streaming_class_type); config_group_init_type_name(&uvcg_streaming_class_hs.group, - "hs", - &uvcg_streaming_class_type); + "hs", &uvcg_streaming_class_type); config_group_init_type_name(&uvcg_streaming_class_ss.group, - "ss", - &uvcg_streaming_class_type); - uvcg_init_group(&uvcg_streaming_class_grp.group, - uvcg_streaming_class_default_groups, - "class", - &uvcg_streaming_class_grp_type); - uvcg_init_group(&uvcg_streaming_grp.group, - uvcg_streaming_default_groups, - "streaming", - &uvcg_streaming_grp_type); - uvcg_init_group(&opts->func_inst.group, - uvcg_default_groups, + "ss", &uvcg_streaming_class_type); + config_group_init_type_name(&uvcg_streaming_class_grp.group, + "class", &uvcg_streaming_class_grp_type); + configfs_add_default_group(&uvcg_streaming_class_fs.group, + &uvcg_streaming_class_grp.group); + configfs_add_default_group(&uvcg_streaming_class_hs.group, + &uvcg_streaming_class_grp.group); + configfs_add_default_group(&uvcg_streaming_class_ss.group, + &uvcg_streaming_class_grp.group); + + config_group_init_type_name(&uvcg_streaming_grp.group, + "streaming", &uvcg_streaming_grp_type); + configfs_add_default_group(&uvcg_streaming_header_grp.group, + &uvcg_streaming_grp.group); + configfs_add_default_group(&uvcg_uncompressed_grp.group, + &uvcg_streaming_grp.group); + configfs_add_default_group(&uvcg_mjpeg_grp.group, + &uvcg_streaming_grp.group); + configfs_add_default_group(&uvcg_color_matching_grp.group, + &uvcg_streaming_grp.group); + configfs_add_default_group(&uvcg_streaming_class_grp.group, + &uvcg_streaming_grp.group); + + config_group_init_type_name(&opts->func_inst.group, "", &uvc_func_type); + configfs_add_default_group(&uvcg_control_grp.group, + &opts->func_inst.group); + configfs_add_default_group(&uvcg_streaming_grp.group, + &opts->func_inst.group); + return 0; } |