drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c- Extension
.c- Size
- 27912 bytes
- Lines
- 1128
- 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.
- 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
dvb_usb_common.hmedia/media-device.h
Detected Declarations
function dvb_usbv2_download_firmwarefunction dvb_usbv2_i2c_initfunction dvb_usbv2_i2c_exitfunction dvb_usb_read_remote_controlfunction dvb_usbv2_remote_initfunction dvb_usbv2_remote_exitfunction dvb_usb_data_completefunction dvb_usb_data_complete_204function dvb_usb_data_complete_rawfunction dvb_usbv2_adapter_stream_initfunction dvb_usbv2_adapter_stream_exitfunction dvb_usb_start_feedfunction dvb_usb_stop_feedfunction dvb_usbv2_media_device_initfunction dvb_usbv2_media_device_registerfunction dvb_usbv2_media_device_unregisterfunction dvb_usbv2_adapter_dvb_initfunction dvb_usbv2_adapter_dvb_exitfunction dvb_usbv2_device_power_ctrlfunction dvb_usb_fe_initfunction dvb_usb_fe_sleepfunction dvb_usbv2_adapter_frontend_initfunction dvb_usbv2_adapter_frontend_exitfunction dvb_usbv2_adapter_initfunction dvb_usbv2_adapter_exitfunction dvb_usbv2_exitfunction dvb_usbv2_initfunction dvb_usbv2_probefunction dvb_usbv2_disconnectfunction dvb_usbv2_suspendfunction dvb_usbv2_resume_commonfunction dvb_usbv2_resumefunction dvb_usbv2_reset_resumeexport dvb_usbv2_probeexport dvb_usbv2_disconnectexport dvb_usbv2_suspendexport dvb_usbv2_resumeexport dvb_usbv2_reset_resume
Annotated Snippet
if (d->props->power_ctrl) {
ret = d->props->power_ctrl(d, onoff);
if (ret < 0)
goto err;
}
}
return 0;
err:
dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
static int dvb_usb_fe_init(struct dvb_frontend *fe)
{
int ret;
struct dvb_usb_adapter *adap = fe->dvb->priv;
struct dvb_usb_device *d = adap_to_d(adap);
dev_dbg(&d->udev->dev, "%s: adap=%d fe=%d\n", __func__, adap->id,
fe->id);
if (!adap->suspend_resume_active) {
adap->active_fe = fe->id;
set_bit(ADAP_INIT, &adap->state_bits);
}
ret = dvb_usbv2_device_power_ctrl(d, 1);
if (ret < 0)
goto err;
if (d->props->frontend_ctrl) {
ret = d->props->frontend_ctrl(fe, 1);
if (ret < 0)
goto err;
}
if (adap->fe_init[fe->id]) {
ret = adap->fe_init[fe->id](fe);
if (ret < 0)
goto err;
}
err:
if (!adap->suspend_resume_active) {
clear_bit(ADAP_INIT, &adap->state_bits);
smp_mb__after_atomic();
wake_up_bit(&adap->state_bits, ADAP_INIT);
}
dev_dbg(&d->udev->dev, "%s: ret=%d\n", __func__, ret);
return ret;
}
static int dvb_usb_fe_sleep(struct dvb_frontend *fe)
{
int ret;
struct dvb_usb_adapter *adap = fe->dvb->priv;
struct dvb_usb_device *d = adap_to_d(adap);
dev_dbg(&d->udev->dev, "%s: adap=%d fe=%d\n", __func__, adap->id,
fe->id);
if (!adap->suspend_resume_active) {
set_bit(ADAP_SLEEP, &adap->state_bits);
wait_on_bit(&adap->state_bits, ADAP_STREAMING,
TASK_UNINTERRUPTIBLE);
}
if (adap->fe_sleep[fe->id]) {
ret = adap->fe_sleep[fe->id](fe);
if (ret < 0)
goto err;
}
if (d->props->frontend_ctrl) {
ret = d->props->frontend_ctrl(fe, 0);
if (ret < 0)
goto err;
}
ret = dvb_usbv2_device_power_ctrl(d, 0);
err:
if (!adap->suspend_resume_active) {
adap->active_fe = -1;
clear_bit(ADAP_SLEEP, &adap->state_bits);
smp_mb__after_atomic();
wake_up_bit(&adap->state_bits, ADAP_SLEEP);
}
dev_dbg(&d->udev->dev, "%s: ret=%d\n", __func__, ret);
return ret;
Annotation
- Immediate include surface: `dvb_usb_common.h`, `media/media-device.h`.
- Detected declarations: `function dvb_usbv2_download_firmware`, `function dvb_usbv2_i2c_init`, `function dvb_usbv2_i2c_exit`, `function dvb_usb_read_remote_control`, `function dvb_usbv2_remote_init`, `function dvb_usbv2_remote_exit`, `function dvb_usb_data_complete`, `function dvb_usb_data_complete_204`, `function dvb_usb_data_complete_raw`, `function dvb_usbv2_adapter_stream_init`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration 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.