drivers/media/usb/pvrusb2/pvrusb2-sysfs.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/pvrusb2/pvrusb2-sysfs.c- Extension
.c- Size
- 22403 bytes
- Lines
- 812
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- 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/string.hlinux/slab.hpvrusb2-sysfs.hpvrusb2-hdw.hpvrusb2-debug.hpvrusb2-debugifc.h
Detected Declarations
struct pvr2_sysfsstruct pvr2_sysfs_debugifcstruct pvr2_sysfs_ctl_itemfunction show_namefunction show_typefunction show_minfunction show_maxfunction show_deffunction show_val_normfunction show_val_customfunction show_enumfunction show_bitsfunction store_val_anyfunction store_val_normfunction store_val_customfunction pvr2_sysfs_add_controlfunction pvr2_sysfs_add_debugifcfunction pvr2_sysfs_tear_down_debugifcfunction pvr2_sysfs_add_controlsfunction pvr2_sysfs_tear_down_controlsfunction pvr2_sysfs_releasefunction class_dev_destroyfunction v4l_minor_number_showfunction bus_info_showfunction hdw_name_showfunction hdw_desc_showfunction v4l_radio_minor_number_showfunction unit_number_showfunction class_dev_createfunction pvr2_sysfs_internal_checkfunction pvr2_sysfs_createfunction pvr2_sysfs_class_createfunction pvr2_sysfs_class_destroyfunction debuginfo_showfunction debugcmd_showfunction debugcmd_store
Annotated Snippet
struct pvr2_sysfs {
struct pvr2_channel channel;
struct device *class_dev;
#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
struct pvr2_sysfs_debugifc *debugifc;
#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
struct pvr2_sysfs_ctl_item *item_first;
struct pvr2_sysfs_ctl_item *item_last;
struct device_attribute attr_v4l_minor_number;
struct device_attribute attr_v4l_radio_minor_number;
struct device_attribute attr_unit_number;
struct device_attribute attr_bus_info;
struct device_attribute attr_hdw_name;
struct device_attribute attr_hdw_desc;
int v4l_minor_number_created_ok;
int v4l_radio_minor_number_created_ok;
int unit_number_created_ok;
int bus_info_created_ok;
int hdw_name_created_ok;
int hdw_desc_created_ok;
};
#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
struct pvr2_sysfs_debugifc {
struct device_attribute attr_debugcmd;
struct device_attribute attr_debuginfo;
int debugcmd_created_ok;
int debuginfo_created_ok;
};
#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
struct pvr2_sysfs_ctl_item {
struct device_attribute attr_name;
struct device_attribute attr_type;
struct device_attribute attr_min;
struct device_attribute attr_max;
struct device_attribute attr_def;
struct device_attribute attr_enum;
struct device_attribute attr_bits;
struct device_attribute attr_val;
struct device_attribute attr_custom;
struct pvr2_ctrl *cptr;
int ctl_id;
struct pvr2_sysfs *chptr;
struct pvr2_sysfs_ctl_item *item_next;
struct attribute *attr_gen[8];
struct attribute_group grp;
int created_ok;
char name[80];
};
static ssize_t show_name(struct device *class_dev,
struct device_attribute *attr,
char *buf)
{
struct pvr2_sysfs_ctl_item *cip;
const char *name;
cip = container_of(attr, struct pvr2_sysfs_ctl_item, attr_name);
name = pvr2_ctrl_get_desc(cip->cptr);
pvr2_sysfs_trace("pvr2_sysfs(%p) show_name(cid=%d) is %s",
cip->chptr, cip->ctl_id, name);
if (!name) return -EINVAL;
return sysfs_emit(buf, "%s\n", name);
}
static ssize_t show_type(struct device *class_dev,
struct device_attribute *attr,
char *buf)
{
struct pvr2_sysfs_ctl_item *cip;
const char *name;
enum pvr2_ctl_type tp;
cip = container_of(attr, struct pvr2_sysfs_ctl_item, attr_type);
tp = pvr2_ctrl_get_type(cip->cptr);
switch (tp) {
case pvr2_ctl_int: name = "integer"; break;
case pvr2_ctl_enum: name = "enum"; break;
case pvr2_ctl_bitmask: name = "bitmask"; break;
case pvr2_ctl_bool: name = "boolean"; break;
default: name = "?"; break;
}
pvr2_sysfs_trace("pvr2_sysfs(%p) show_type(cid=%d) is %s",
cip->chptr, cip->ctl_id, name);
return sysfs_emit(buf, "%s\n", name);
}
static ssize_t show_min(struct device *class_dev,
struct device_attribute *attr,
char *buf)
{
Annotation
- Immediate include surface: `linux/string.h`, `linux/slab.h`, `pvrusb2-sysfs.h`, `pvrusb2-hdw.h`, `pvrusb2-debug.h`, `pvrusb2-debugifc.h`.
- Detected declarations: `struct pvr2_sysfs`, `struct pvr2_sysfs_debugifc`, `struct pvr2_sysfs_ctl_item`, `function show_name`, `function show_type`, `function show_min`, `function show_max`, `function show_def`, `function show_val_norm`, `function show_val_custom`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source 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.