drivers/staging/media/ipu3/ipu3-css-pool.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/ipu3/ipu3-css-pool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/ipu3/ipu3-css-pool.c- Extension
.c- Size
- 2250 bytes
- Lines
- 101
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hipu3.hipu3-css-pool.hipu3-dmamap.h
Detected Declarations
function imgu_css_dma_buffer_resizefunction imgu_css_pool_cleanupfunction imgu_css_pool_initfunction imgu_css_pool_getfunction imgu_css_pool_putfunction imgu_css_pool_last
Annotated Snippet
if (size == 0) {
pool->entry[i].param.vaddr = NULL;
continue;
}
if (!imgu_dmamap_alloc(imgu, &pool->entry[i].param, size))
goto fail;
}
pool->last = IPU3_CSS_POOL_SIZE;
return 0;
fail:
imgu_css_pool_cleanup(imgu, pool);
return -ENOMEM;
}
/*
* Allocate a new parameter via recycling the oldest entry in the pool.
*/
void imgu_css_pool_get(struct imgu_css_pool *pool)
{
/* Get the oldest entry */
u32 n = (pool->last + 1) % IPU3_CSS_POOL_SIZE;
pool->entry[n].valid = true;
pool->last = n;
}
/*
* Undo, for all practical purposes, the effect of pool_get().
*/
void imgu_css_pool_put(struct imgu_css_pool *pool)
{
pool->entry[pool->last].valid = false;
pool->last = (pool->last + IPU3_CSS_POOL_SIZE - 1) % IPU3_CSS_POOL_SIZE;
}
/**
* imgu_css_pool_last - Retrieve the nth pool entry from last
*
* @pool: a pointer to &struct imgu_css_pool.
* @n: the distance to the last index.
*
* Returns:
* The nth entry from last or null map to indicate no frame stored.
*/
const struct imgu_css_map *
imgu_css_pool_last(struct imgu_css_pool *pool, unsigned int n)
{
static const struct imgu_css_map null_map = { 0 };
int i = (pool->last + IPU3_CSS_POOL_SIZE - n) % IPU3_CSS_POOL_SIZE;
WARN_ON(n >= IPU3_CSS_POOL_SIZE);
if (!pool->entry[i].valid)
return &null_map;
return &pool->entry[i].param;
}
Annotation
- Immediate include surface: `linux/device.h`, `ipu3.h`, `ipu3-css-pool.h`, `ipu3-dmamap.h`.
- Detected declarations: `function imgu_css_dma_buffer_resize`, `function imgu_css_pool_cleanup`, `function imgu_css_pool_init`, `function imgu_css_pool_get`, `function imgu_css_pool_put`, `function imgu_css_pool_last`.
- 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.