drivers/net/wwan/iosm/iosm_ipc_trace.c
Source file repositories/reference/linux-study-clean/drivers/net/wwan/iosm/iosm_ipc_trace.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wwan/iosm/iosm_ipc_trace.c- Extension
.c- Size
- 4755 bytes
- Lines
- 182
- Domain
- Driver Families
- Bucket
- drivers/net
- 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.
- 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/wwan.hiosm_ipc_trace.h
Detected Declarations
function Copyrightfunction ipc_trace_create_buf_file_handlerfunction ipc_trace_remove_buf_file_handlerfunction ipc_trace_subbuf_start_handlerfunction ipc_trace_ctrl_file_readfunction ipc_trace_ctrl_file_writefunction ipc_trace_deinit
Annotated Snippet
static const struct file_operations ipc_trace_fops = {
.open = simple_open,
.write = ipc_trace_ctrl_file_write,
.read = ipc_trace_ctrl_file_read,
};
/**
* ipc_trace_init - Create trace interface & debugfs entries
* @ipc_imem: Pointer to iosm_imem structure
*
* Returns: Pointer to trace instance on success else NULL
*/
struct iosm_trace *ipc_trace_init(struct iosm_imem *ipc_imem)
{
struct ipc_chnl_cfg chnl_cfg = { 0 };
struct iosm_trace *ipc_trace;
ipc_chnl_cfg_get(&chnl_cfg, IPC_MEM_CTRL_CHL_ID_3);
ipc_imem_channel_init(ipc_imem, IPC_CTYPE_CTRL, chnl_cfg,
IRQ_MOD_OFF);
ipc_trace = kzalloc_obj(*ipc_trace);
if (!ipc_trace)
return NULL;
ipc_trace->mode = TRACE_DISABLE;
ipc_trace->dev = ipc_imem->dev;
ipc_trace->ipc_imem = ipc_imem;
ipc_trace->chl_id = IPC_MEM_CTRL_CHL_ID_3;
mutex_init(&ipc_trace->trc_mutex);
ipc_trace->ctrl_file = debugfs_create_file(IOSM_TRC_DEBUGFS_TRACE_CTRL,
IOSM_TRC_FILE_PERM,
ipc_imem->debugfs_dir,
ipc_trace, &ipc_trace_fops);
ipc_trace->ipc_rchan = relay_open(IOSM_TRC_DEBUGFS_TRACE,
ipc_imem->debugfs_dir,
IOSM_TRC_SUB_BUFF_SIZE,
IOSM_TRC_N_SUB_BUFF,
&relay_callbacks, NULL);
return ipc_trace;
}
/**
* ipc_trace_deinit - Closing relayfs, removing debugfs entries
* @ipc_trace: Pointer to the iosm_trace data struct
*/
void ipc_trace_deinit(struct iosm_trace *ipc_trace)
{
if (!ipc_trace)
return;
debugfs_remove(ipc_trace->ctrl_file);
relay_close(ipc_trace->ipc_rchan);
mutex_destroy(&ipc_trace->trc_mutex);
kfree(ipc_trace);
}
Annotation
- Immediate include surface: `linux/wwan.h`, `iosm_ipc_trace.h`.
- Detected declarations: `function Copyright`, `function ipc_trace_create_buf_file_handler`, `function ipc_trace_remove_buf_file_handler`, `function ipc_trace_subbuf_start_handler`, `function ipc_trace_ctrl_file_read`, `function ipc_trace_ctrl_file_write`, `function ipc_trace_deinit`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.