drivers/net/wwan/iosm/iosm_ipc_task_queue.c
Source file repositories/reference/linux-study-clean/drivers/net/wwan/iosm/iosm_ipc_task_queue.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wwan/iosm/iosm_ipc_task_queue.c- Extension
.c- Size
- 5223 bytes
- Lines
- 202
- 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.
- 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
iosm_ipc_imem.hiosm_ipc_task_queue.h
Detected Declarations
function Copyrightfunction ipc_task_queue_cleanupfunction ipc_task_queue_add_taskfunction ipc_task_queue_send_taskfunction ipc_task_initfunction ipc_task_deinit
Annotated Snippet
if (wait) {
wait_for_completion(&completion);
result = ipc_task->args[pos].response;
}
} else {
dev_err(ipc_imem->ipc_task->dev, "queue is full");
}
return result;
}
int ipc_task_queue_send_task(struct iosm_imem *imem,
int (*func)(struct iosm_imem *ipc_imem, int arg,
void *msg, size_t size),
int arg, void *msg, size_t size, bool wait)
{
bool is_copy = false;
void *copy = msg;
int ret = -ENOMEM;
if (size > 0) {
copy = kmemdup(msg, size, GFP_ATOMIC);
if (!copy)
goto out;
is_copy = true;
}
ret = ipc_task_queue_add_task(imem, arg, copy, func,
size, is_copy, wait);
if (ret < 0) {
dev_err(imem->ipc_task->dev,
"add task failed for %ps %d, %p, %zu, %d", func, arg,
copy, size, is_copy);
if (is_copy)
kfree(copy);
goto out;
}
ret = 0;
out:
return ret;
}
int ipc_task_init(struct ipc_task *ipc_task)
{
struct ipc_task_queue *ipc_queue = &ipc_task->ipc_queue;
ipc_task->ipc_tasklet = kzalloc_obj(*ipc_task->ipc_tasklet);
if (!ipc_task->ipc_tasklet)
return -ENOMEM;
/* Initialize the spinlock needed to protect the message queue of the
* ipc_task
*/
spin_lock_init(&ipc_queue->q_lock);
tasklet_init(ipc_task->ipc_tasklet, ipc_task_queue_handler,
(unsigned long)ipc_queue);
return 0;
}
void ipc_task_deinit(struct ipc_task *ipc_task)
{
tasklet_kill(ipc_task->ipc_tasklet);
kfree(ipc_task->ipc_tasklet);
/* This will free/complete any outstanding messages,
* without calling the actual handler
*/
ipc_task_queue_cleanup(&ipc_task->ipc_queue);
}
Annotation
- Immediate include surface: `iosm_ipc_imem.h`, `iosm_ipc_task_queue.h`.
- Detected declarations: `function Copyright`, `function ipc_task_queue_cleanup`, `function ipc_task_queue_add_task`, `function ipc_task_queue_send_task`, `function ipc_task_init`, `function ipc_task_deinit`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.