drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c- Extension
.c- Size
- 10036 bytes
- Lines
- 393
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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.
Dependency Surface
ia_css_queue.hmath_support.hia_css_circbuf.hia_css_circbuf_desc.hqueue_access.h
Detected Declarations
function Copyrightfunction ia_css_queue_remote_initfunction ia_css_queue_uninitfunction ia_css_queue_enqueuefunction ia_css_queue_dequeuefunction ia_css_queue_is_fullfunction ia_css_queue_get_free_spacefunction ia_css_queue_get_used_spacefunction ia_css_queue_peekfunction ia_css_queue_is_emptyfunction ia_css_queue_get_size
Annotated Snippet
if (ia_css_circbuf_is_full(&qhandle->desc.cb_local)) {
/* Cannot push the element. Return*/
return -ENOBUFS;
}
/* Push the element*/
ia_css_circbuf_push(&qhandle->desc.cb_local, item);
} else if (qhandle->type == IA_CSS_QUEUE_TYPE_REMOTE) {
ia_css_circbuf_desc_t cb_desc;
ia_css_circbuf_elem_t cb_elem;
u32 ignore_desc_flags = QUEUE_IGNORE_STEP_FLAG;
/* a. Load the queue cb_desc from remote */
QUEUE_CB_DESC_INIT(&cb_desc);
error = ia_css_queue_load(qhandle, &cb_desc, ignore_desc_flags);
if (error != 0)
return error;
/* b. Operate on the queue */
if (ia_css_circbuf_desc_is_full(&cb_desc))
return -ENOBUFS;
cb_elem.val = item;
error = ia_css_queue_item_store(qhandle, cb_desc.end, &cb_elem);
if (error != 0)
return error;
cb_desc.end = (cb_desc.end + 1) % cb_desc.size;
/* c. Store the queue object */
/* Set only fields requiring update with
* valid value. Avoids unnecessary calls
* to load/store functions
*/
ignore_desc_flags = QUEUE_IGNORE_SIZE_START_STEP_FLAGS;
error = ia_css_queue_store(qhandle, &cb_desc, ignore_desc_flags);
if (error != 0)
return error;
}
return 0;
}
int ia_css_queue_dequeue(ia_css_queue_t *qhandle, uint32_t *item)
{
int error;
if (!qhandle || NULL == item)
return -EINVAL;
/* 1. Load the required queue object */
if (qhandle->type == IA_CSS_QUEUE_TYPE_LOCAL) {
/* Directly de-ref the object and
* operate on the queue
*/
if (ia_css_circbuf_is_empty(&qhandle->desc.cb_local)) {
/* Nothing to pop. Return empty queue*/
return -ENODATA;
}
*item = ia_css_circbuf_pop(&qhandle->desc.cb_local);
} else if (qhandle->type == IA_CSS_QUEUE_TYPE_REMOTE) {
/* a. Load the queue from remote */
ia_css_circbuf_desc_t cb_desc;
ia_css_circbuf_elem_t cb_elem;
u32 ignore_desc_flags = QUEUE_IGNORE_STEP_FLAG;
QUEUE_CB_DESC_INIT(&cb_desc);
error = ia_css_queue_load(qhandle, &cb_desc, ignore_desc_flags);
if (error != 0)
return error;
/* b. Operate on the queue */
if (ia_css_circbuf_desc_is_empty(&cb_desc))
return -ENODATA;
error = ia_css_queue_item_load(qhandle, cb_desc.start, &cb_elem);
if (error != 0)
return error;
*item = cb_elem.val;
cb_desc.start = (cb_desc.start + 1) % cb_desc.size;
/* c. Store the queue object */
/* Set only fields requiring update with
* valid value. Avoids unnecessary calls
Annotation
- Immediate include surface: `ia_css_queue.h`, `math_support.h`, `ia_css_circbuf.h`, `ia_css_circbuf_desc.h`, `queue_access.h`.
- Detected declarations: `function Copyright`, `function ia_css_queue_remote_init`, `function ia_css_queue_uninit`, `function ia_css_queue_enqueue`, `function ia_css_queue_dequeue`, `function ia_css_queue_is_full`, `function ia_css_queue_get_free_space`, `function ia_css_queue_get_used_space`, `function ia_css_queue_peek`, `function ia_css_queue_is_empty`.
- Atlas domain: Driver Families / drivers/staging.
- 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.