drivers/media/dvb-core/dvb_frontend.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-core/dvb_frontend.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-core/dvb_frontend.c- Extension
.c- Size
- 83754 bytes
- Lines
- 3108
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/string.hlinux/kernel.hlinux/sched/signal.hlinux/wait.hlinux/slab.hlinux/poll.hlinux/semaphore.hlinux/module.hlinux/nospec.hlinux/list.hlinux/freezer.hlinux/jiffies.hlinux/kthread.hlinux/ktime.hlinux/compat.hasm/processor.hmedia/dvb_frontend.hmedia/dvbdev.hlinux/dvb/version.h
Detected Declarations
struct dvb_frontend_privatestruct compat_dtv_propertystruct compat_dtv_propertiesenum dvbv3_emulation_typefunction __dvb_frontend_freefunction dvb_frontend_freefunction dvb_frontend_putfunction dvb_frontend_getfunction has_get_frontendfunction dvbv3_typefunction dvb_frontend_add_eventfunction dvb_frontend_test_eventfunction dvb_frontend_get_eventfunction dvb_frontend_clear_eventsfunction dvb_frontend_initfunction dvb_frontend_reinitialisefunction dvb_frontend_swzigzag_update_delayfunction dvb_frontend_swzigzag_autotunefunction dvb_frontend_swzigzagfunction dvb_frontend_is_exitingfunction dvb_frontend_should_wakeupfunction dvb_frontend_wakeupfunction dvb_frontend_threadfunction dvb_frontend_stopfunction dvb_frontend_sleep_untilfunction dvb_frontend_startfunction dvb_frontend_get_frequency_limitsfunction dvb_frontend_get_stepsizefunction dvb_frontend_check_parametersfunction dvb_frontend_clear_cachefunction dtv_property_cache_syncfunction dtv_property_legacy_params_syncfunction dtv_get_frontendfunction dtv_property_process_getfunction is_dvbv3_delsysfunction emulate_delivery_systemfunction dvbv5_set_delivery_systemfunction dvbv3_set_delivery_systemfunction prepare_tuning_algo_parametersfunction dtv_property_process_setfunction dvb_frontend_do_ioctlfunction dvb_frontend_ioctlfunction dvb_frontend_handle_compat_ioctlfunction dvb_frontend_compat_ioctlfunction dtv_set_frontendfunction dvb_get_propertyfunction dvb_get_frontendfunction dvb_frontend_handle_ioctl
Annotated Snippet
static const struct file_operations dvb_frontend_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = dvb_frontend_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = dvb_frontend_compat_ioctl,
#endif
.poll = dvb_frontend_poll,
.open = dvb_frontend_open,
.release = dvb_frontend_release,
.llseek = noop_llseek,
};
int dvb_frontend_suspend(struct dvb_frontend *fe)
{
int ret = 0;
dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num,
fe->id);
if (fe->ops.tuner_ops.suspend)
ret = fe->ops.tuner_ops.suspend(fe);
else if (fe->ops.tuner_ops.sleep)
ret = fe->ops.tuner_ops.sleep(fe);
if (fe->ops.suspend)
ret = fe->ops.suspend(fe);
else if (fe->ops.sleep)
ret = fe->ops.sleep(fe);
return ret;
}
EXPORT_SYMBOL(dvb_frontend_suspend);
int dvb_frontend_resume(struct dvb_frontend *fe)
{
struct dvb_frontend_private *fepriv = fe->frontend_priv;
int ret = 0;
dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num,
fe->id);
fe->exit = DVB_FE_DEVICE_RESUME;
if (fe->ops.resume)
ret = fe->ops.resume(fe);
else if (fe->ops.init)
ret = fe->ops.init(fe);
if (fe->ops.tuner_ops.resume)
ret = fe->ops.tuner_ops.resume(fe);
else if (fe->ops.tuner_ops.init)
ret = fe->ops.tuner_ops.init(fe);
if (fe->ops.set_tone && fepriv->tone != -1)
fe->ops.set_tone(fe, fepriv->tone);
if (fe->ops.set_voltage && fepriv->voltage != -1)
fe->ops.set_voltage(fe, fepriv->voltage);
fe->exit = DVB_FE_NO_EXIT;
fepriv->state = FESTATE_RETUNE;
dvb_frontend_wakeup(fe);
return ret;
}
EXPORT_SYMBOL(dvb_frontend_resume);
int dvb_register_frontend(struct dvb_adapter *dvb,
struct dvb_frontend *fe)
{
struct dvb_frontend_private *fepriv;
const struct dvb_device dvbdev_template = {
.users = ~0,
.writers = 1,
.readers = (~0) - 1,
.fops = &dvb_frontend_fops,
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
.name = fe->ops.info.name,
#endif
};
int ret;
dev_dbg(dvb->device, "%s:\n", __func__);
if (mutex_lock_interruptible(&frontend_mutex))
return -ERESTARTSYS;
fe->frontend_priv = kzalloc_obj(struct dvb_frontend_private);
if (!fe->frontend_priv) {
mutex_unlock(&frontend_mutex);
return -ENOMEM;
}
Annotation
- Immediate include surface: `linux/string.h`, `linux/kernel.h`, `linux/sched/signal.h`, `linux/wait.h`, `linux/slab.h`, `linux/poll.h`, `linux/semaphore.h`, `linux/module.h`.
- Detected declarations: `struct dvb_frontend_private`, `struct compat_dtv_property`, `struct compat_dtv_properties`, `enum dvbv3_emulation_type`, `function __dvb_frontend_free`, `function dvb_frontend_free`, `function dvb_frontend_put`, `function dvb_frontend_get`, `function has_get_frontend`, `function dvbv3_type`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.