drivers/net/wwan/iosm/iosm_ipc_imem_ops.c
Source file repositories/reference/linux-study-clean/drivers/net/wwan/iosm/iosm_ipc_imem_ops.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wwan/iosm/iosm_ipc_imem_ops.c- Extension
.c- Size
- 17943 bytes
- Lines
- 659
- Domain
- Driver Families
- Bucket
- drivers/net
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hiosm_ipc_chnl_cfg.hiosm_ipc_devlink.hiosm_ipc_imem.hiosm_ipc_imem_ops.hiosm_ipc_port.hiosm_ipc_task_queue.h
Detected Declarations
function Copyrightfunction ipc_imem_sys_wwan_closefunction ipc_imem_tq_cdev_writefunction ipc_imem_call_cdev_writefunction ipc_imem_sys_wwan_transmitfunction ipc_imem_wwan_channel_initfunction ipc_imem_map_skb_to_dmafunction ipc_imem_is_channel_activefunction ipc_imem_sys_port_closefunction ipc_imem_sys_cdev_writefunction ipc_imem_sys_devlink_closefunction ipc_imem_sys_devlink_notify_rxfunction ipc_imem_sys_psi_transferfunction ipc_imem_sys_devlink_writefunction ipc_imem_sys_devlink_read
Annotated Snippet
if (channel->state != IMEM_CHANNEL_RESERVED) {
dev_err(ipc_imem->dev,
"ch[%d]:invalid channel state %d,expected %d",
channel->channel_id, channel->state,
IMEM_CHANNEL_RESERVED);
goto channel_unavailable;
}
goto channel_available;
default:
/* Ignore uplink actions in all other phases. */
dev_err(ipc_imem->dev, "ch[%d]: confused phase %d",
channel->channel_id, phase);
goto channel_unavailable;
}
/* Check the full availability of the channel. */
if (channel->state != IMEM_CHANNEL_ACTIVE) {
dev_err(ipc_imem->dev, "ch[%d]: confused channel state %d",
channel->channel_id, channel->state);
goto channel_unavailable;
}
channel_available:
return true;
channel_unavailable:
return false;
}
/**
* ipc_imem_sys_port_close - Release a sio link to CP.
* @ipc_imem: Imem instance.
* @channel: Channel instance.
*/
void ipc_imem_sys_port_close(struct iosm_imem *ipc_imem,
struct ipc_mem_channel *channel)
{
enum ipc_phase curr_phase;
int status = 0;
u32 tail = 0;
curr_phase = ipc_imem->phase;
/* If current phase is IPC_P_OFF or SIO ID is -ve then
* channel is already freed. Nothing to do.
*/
if (curr_phase == IPC_P_OFF) {
dev_err(ipc_imem->dev,
"nothing to do. Current Phase: %s",
ipc_imem_phase_get_string(curr_phase));
return;
}
if (channel->state == IMEM_CHANNEL_FREE) {
dev_err(ipc_imem->dev, "ch[%d]: invalid channel state %d",
channel->channel_id, channel->state);
return;
}
/* If there are any pending TDs then wait for Timeout/Completion before
* closing pipe.
*/
if (channel->ul_pipe.old_tail != channel->ul_pipe.old_head) {
ipc_imem->app_notify_ul_pend = 1;
/* Suspend the user app and wait a certain time for processing
* UL Data.
*/
status = wait_for_completion_interruptible_timeout
(&ipc_imem->ul_pend_sem,
msecs_to_jiffies(IPC_PEND_DATA_TIMEOUT));
if (status == 0) {
dev_dbg(ipc_imem->dev,
"Pend data Timeout UL-Pipe:%d Head:%d Tail:%d",
channel->ul_pipe.pipe_nr,
channel->ul_pipe.old_head,
channel->ul_pipe.old_tail);
}
ipc_imem->app_notify_ul_pend = 0;
}
/* If there are any pending TDs then wait for Timeout/Completion before
* closing pipe.
*/
ipc_protocol_get_head_tail_index(ipc_imem->ipc_protocol,
&channel->dl_pipe, NULL, &tail);
if (tail != channel->dl_pipe.old_tail) {
ipc_imem->app_notify_dl_pend = 1;
Annotation
- Immediate include surface: `linux/delay.h`, `iosm_ipc_chnl_cfg.h`, `iosm_ipc_devlink.h`, `iosm_ipc_imem.h`, `iosm_ipc_imem_ops.h`, `iosm_ipc_port.h`, `iosm_ipc_task_queue.h`.
- Detected declarations: `function Copyright`, `function ipc_imem_sys_wwan_close`, `function ipc_imem_tq_cdev_write`, `function ipc_imem_call_cdev_write`, `function ipc_imem_sys_wwan_transmit`, `function ipc_imem_wwan_channel_init`, `function ipc_imem_map_skb_to_dma`, `function ipc_imem_is_channel_active`, `function ipc_imem_sys_port_close`, `function ipc_imem_sys_cdev_write`.
- Atlas domain: Driver Families / drivers/net.
- 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.