drivers/media/usb/uvc/uvc_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/uvc/uvc_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/uvc/uvc_debugfs.c- Extension
.c- Size
- 2482 bytes
- Lines
- 105
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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
linux/module.hlinux/debugfs.hlinux/slab.hlinux/usb.huvcvideo.h
Detected Declarations
struct uvc_debugfs_bufferfunction uvc_debugfs_stats_openfunction uvc_debugfs_stats_readfunction uvc_debugfs_stats_releasefunction uvc_debugfs_init_streamfunction uvc_debugfs_cleanup_streamfunction uvc_debugfs_initfunction uvc_debugfs_cleanup
Annotated Snippet
static const struct file_operations uvc_debugfs_stats_fops = {
.owner = THIS_MODULE,
.open = uvc_debugfs_stats_open,
.read = uvc_debugfs_stats_read,
.release = uvc_debugfs_stats_release,
};
/* -----------------------------------------------------------------------------
* Global and stream initialization/cleanup
*/
static struct dentry *uvc_debugfs_root_dir;
void uvc_debugfs_init_stream(struct uvc_streaming *stream)
{
struct usb_device *udev = stream->dev->udev;
char dir_name[33];
if (uvc_debugfs_root_dir == NULL)
return;
snprintf(dir_name, sizeof(dir_name), "%u-%u-%u", udev->bus->busnum,
udev->devnum, stream->intfnum);
stream->debugfs_dir = debugfs_create_dir(dir_name,
uvc_debugfs_root_dir);
debugfs_create_file("stats", 0444, stream->debugfs_dir, stream,
&uvc_debugfs_stats_fops);
}
void uvc_debugfs_cleanup_stream(struct uvc_streaming *stream)
{
debugfs_remove_recursive(stream->debugfs_dir);
stream->debugfs_dir = NULL;
}
void uvc_debugfs_init(void)
{
uvc_debugfs_root_dir = debugfs_create_dir("uvcvideo", usb_debug_root);
}
void uvc_debugfs_cleanup(void)
{
debugfs_remove_recursive(uvc_debugfs_root_dir);
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/debugfs.h`, `linux/slab.h`, `linux/usb.h`, `uvcvideo.h`.
- Detected declarations: `struct uvc_debugfs_buffer`, `function uvc_debugfs_stats_open`, `function uvc_debugfs_stats_read`, `function uvc_debugfs_stats_release`, `function uvc_debugfs_init_stream`, `function uvc_debugfs_cleanup_stream`, `function uvc_debugfs_init`, `function uvc_debugfs_cleanup`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: pattern implementation candidate.
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.