drivers/usb/gadget/function/uvc_configfs.c
Source file repositories/reference/linux-study-clean/drivers/usb/gadget/function/uvc_configfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/gadget/function/uvc_configfs.c- Extension
.c- Size
- 104663 bytes
- Lines
- 3836
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
uvc_configfs.hlinux/hex.hlinux/sort.hlinux/usb/uvc.hlinux/usb/video.h
Detected Declarations
struct uvcg_config_group_typestruct uvcg_control_class_groupstruct uvcg_streaming_class_groupenum uvcg_strm_typefunction Copyrightfunction __uvcg_count_item_entriesfunction __uvcg_fill_item_entriesfunction __uvcg_iter_item_entriesfunction uvcg_config_item_releasefunction uvcg_config_create_childrenfunction uvcg_config_create_groupfunction uvcg_config_remove_childrenfunction list_for_each_entry_safefunction uvcg_default_processing_bm_controls_storefunction uvcg_default_processing_bm_controls_showfunction uvcg_default_camera_bm_controls_storefunction uvcg_default_camera_bm_controls_showfunction uvcg_default_output_b_source_id_showfunction uvcg_default_output_b_source_id_storefunction uvcg_extension_b_num_controls_storefunction uvcg_extension_b_nr_in_pins_storefunction uvcg_extension_b_control_size_storefunction uvcg_extension_guid_extension_code_showfunction uvcg_extension_guid_extension_code_storefunction uvcg_extension_ba_source_id_showfunction uvcg_extension_ba_source_id_storefunction uvcg_extension_bm_controls_showfunction uvcg_extension_bm_controls_storefunction uvcg_extension_releasefunction uvcg_extension_allow_linkfunction uvcg_extension_drop_linkfunction uvcg_extension_dropfunction uvcg_control_class_allow_linkfunction uvcg_control_class_drop_linkfunction uvcg_control_class_create_childrenfunction uvcg_default_control_b_interface_number_showfunction uvcg_default_control_enable_interrupt_ep_showfunction uvcg_default_control_enable_interrupt_ep_storefunction uvcg_format_get_default_color_matchfunction uvcg_format_allow_linkfunction uvcg_format_drop_linkfunction uvcg_format_bma_controls_showfunction uvcg_format_bma_controls_storefunction uvcg_streaming_header_allow_linkfunction uvcg_streaming_header_drop_linkfunction list_for_each_entry_safefunction uvcg_frame_b_frame_index_showfunction uvcg_frame_dw_frame_interval_show
Annotated Snippet
struct uvcg_config_group_type {
struct config_item_type type;
const char *name;
const struct uvcg_config_group_type **children;
int (*create_children)(struct config_group *group);
};
static void uvcg_config_item_release(struct config_item *item)
{
struct config_group *group = to_config_group(item);
kfree(group);
}
static const struct configfs_item_operations uvcg_config_item_ops = {
.release = uvcg_config_item_release,
};
static int uvcg_config_create_group(struct config_group *parent,
const struct uvcg_config_group_type *type);
static int uvcg_config_create_children(struct config_group *group,
const struct uvcg_config_group_type *type)
{
const struct uvcg_config_group_type **child;
int ret;
if (type->create_children)
return type->create_children(group);
for (child = type->children; child && *child; ++child) {
ret = uvcg_config_create_group(group, *child);
if (ret < 0)
return ret;
}
return 0;
}
static int uvcg_config_create_group(struct config_group *parent,
const struct uvcg_config_group_type *type)
{
struct config_group *group;
group = kzalloc_obj(*group);
if (!group)
return -ENOMEM;
config_group_init_type_name(group, type->name, &type->type);
configfs_add_default_group(group, parent);
return uvcg_config_create_children(group, type);
}
static void uvcg_config_remove_children(struct config_group *group)
{
struct config_group *child, *n;
list_for_each_entry_safe(child, n, &group->default_groups, group_entry) {
list_del(&child->group_entry);
uvcg_config_remove_children(child);
config_item_put(&child->cg_item);
}
}
/* -----------------------------------------------------------------------------
* control/header/<NAME>
* control/header
*/
#define UVCG_CTRL_HDR_ATTR(cname, aname, bits, limit) \
static ssize_t uvcg_control_header_##cname##_show( \
struct config_item *item, char *page) \
{ \
struct uvcg_control_header *ch = to_uvcg_control_header(item); \
struct f_uvc_opts *opts; \
struct config_item *opts_item; \
struct mutex *su_mutex = &ch->item.ci_group->cg_subsys->su_mutex;\
int result; \
\
mutex_lock(su_mutex); /* for navigating configfs hierarchy */ \
\
opts_item = ch->item.ci_parent->ci_parent->ci_parent; \
opts = to_f_uvc_opts(opts_item); \
\
mutex_lock(&opts->lock); \
result = sprintf(page, "%u\n", le##bits##_to_cpu(ch->desc.aname));\
mutex_unlock(&opts->lock); \
\
mutex_unlock(su_mutex); \
Annotation
- Immediate include surface: `uvc_configfs.h`, `linux/hex.h`, `linux/sort.h`, `linux/usb/uvc.h`, `linux/usb/video.h`.
- Detected declarations: `struct uvcg_config_group_type`, `struct uvcg_control_class_group`, `struct uvcg_streaming_class_group`, `enum uvcg_strm_type`, `function Copyright`, `function __uvcg_count_item_entries`, `function __uvcg_fill_item_entries`, `function __uvcg_iter_item_entries`, `function uvcg_config_item_release`, `function uvcg_config_create_children`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.