drivers/media/common/videobuf2/videobuf2-dvb.c
Source file repositories/reference/linux-study-clean/drivers/media/common/videobuf2/videobuf2-dvb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/common/videobuf2/videobuf2-dvb.c- Extension
.c- Size
- 8425 bytes
- Lines
- 343
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
linux/module.hlinux/init.hlinux/device.hlinux/slab.hmedia/videobuf2-dvb.h
Detected Declarations
function dvb_fncfunction vb2_dvb_start_feedfunction vb2_dvb_stop_feedfunction vb2_dvb_register_adapterfunction vb2_dvb_register_frontendfunction vb2_dvb_register_busfunction vb2_dvb_unregister_busfunction list_for_each_safefunction vb2_dvb_find_frontendfunction list_for_each_safefunction vb2_dvb_dealloc_frontendsexport vb2_dvb_register_busexport vb2_dvb_unregister_busexport vb2_dvb_get_frontendexport vb2_dvb_find_frontendexport vb2_dvb_alloc_frontendexport vb2_dvb_dealloc_frontends
Annotated Snippet
if (res < 0) {
pr_warn("%s: vb2_dvb_register_frontend failed (errno = %d)\n",
fe->dvb.name, res);
goto err;
}
res = dvb_create_media_graph(&f->adapter, false);
if (res < 0)
goto err;
}
mutex_unlock(&f->lock);
return 0;
err:
mutex_unlock(&f->lock);
vb2_dvb_unregister_bus(f);
return res;
}
EXPORT_SYMBOL(vb2_dvb_register_bus);
void vb2_dvb_unregister_bus(struct vb2_dvb_frontends *f)
{
vb2_dvb_dealloc_frontends(f);
dvb_unregister_adapter(&f->adapter);
}
EXPORT_SYMBOL(vb2_dvb_unregister_bus);
struct vb2_dvb_frontend *vb2_dvb_get_frontend(
struct vb2_dvb_frontends *f, int id)
{
struct list_head *list, *q;
struct vb2_dvb_frontend *fe, *ret = NULL;
mutex_lock(&f->lock);
list_for_each_safe(list, q, &f->felist) {
fe = list_entry(list, struct vb2_dvb_frontend, felist);
if (fe->id == id) {
ret = fe;
break;
}
}
mutex_unlock(&f->lock);
return ret;
}
EXPORT_SYMBOL(vb2_dvb_get_frontend);
int vb2_dvb_find_frontend(struct vb2_dvb_frontends *f,
struct dvb_frontend *p)
{
struct list_head *list, *q;
struct vb2_dvb_frontend *fe = NULL;
int ret = 0;
mutex_lock(&f->lock);
list_for_each_safe(list, q, &f->felist) {
fe = list_entry(list, struct vb2_dvb_frontend, felist);
if (fe->dvb.frontend == p) {
ret = fe->id;
break;
}
}
mutex_unlock(&f->lock);
return ret;
}
EXPORT_SYMBOL(vb2_dvb_find_frontend);
struct vb2_dvb_frontend *vb2_dvb_alloc_frontend(
struct vb2_dvb_frontends *f, int id)
{
struct vb2_dvb_frontend *fe;
fe = kzalloc_obj(struct vb2_dvb_frontend);
if (fe == NULL)
return NULL;
fe->id = id;
mutex_init(&fe->dvb.lock);
mutex_lock(&f->lock);
list_add_tail(&fe->felist, &f->felist);
mutex_unlock(&f->lock);
return fe;
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/device.h`, `linux/slab.h`, `media/videobuf2-dvb.h`.
- Detected declarations: `function dvb_fnc`, `function vb2_dvb_start_feed`, `function vb2_dvb_stop_feed`, `function vb2_dvb_register_adapter`, `function vb2_dvb_register_frontend`, `function vb2_dvb_register_bus`, `function vb2_dvb_unregister_bus`, `function list_for_each_safe`, `function vb2_dvb_find_frontend`, `function list_for_each_safe`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration 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.