drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c- Extension
.c- Size
- 7544 bytes
- Lines
- 321
- 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.
- 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
hmm.hia_css_rmgr.htype_support.hassert_support.hplatform_support.hia_css_debug.h
Detected Declarations
function rmgr_refcount_init_vbuffunction ia_css_rmgr_refcount_retain_vbuffunction ia_css_rmgr_refcount_release_vbuffunction ia_css_rmgr_init_vbuffunction ia_css_rmgr_uninit_vbuffunction rmgr_push_handlefunction rmgr_pop_handlefunction ia_css_rmgr_acq_vbuffunction ia_css_rmgr_rel_vbuf
Annotated Snippet
if (handle_table[i].count == 0) {
*handle = &handle_table[i];
break;
}
}
/* if the loop dus not break and *handle == NULL
* this is an error handle and report it.
*/
if (!*handle) {
ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR,
"ia_css_i_host_refcount_retain_vbuf() failed to find empty slot!\n");
return;
}
(*handle)->vptr = h->vptr;
(*handle)->size = h->size;
}
(*handle)->count++;
}
/*
* @brief Release the reference count for a handle (host, vbuf)
*
* @param handle The pointer to the handle
*/
void ia_css_rmgr_refcount_release_vbuf(struct ia_css_rmgr_vbuf_handle **handle)
{
if ((!handle) || ((*handle) == NULL) || (((*handle)->count) == 0)) {
ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR, "%s invalid arguments!\n", __func__);
return;
}
/* decrease reference count */
(*handle)->count--;
/* remove from admin */
if ((*handle)->count == 0) {
(*handle)->vptr = 0x0;
(*handle)->size = 0;
*handle = NULL;
}
}
/*
* @brief Initialize the resource pool (host, vbuf)
*
* @param pool The pointer to the pool
*/
int ia_css_rmgr_init_vbuf(struct ia_css_rmgr_vbuf_pool *pool)
{
int err = 0;
size_t bytes_needed;
rmgr_refcount_init_vbuf();
assert(pool);
if (!pool)
return -EINVAL;
/* initialize the recycle pool if used */
if (pool->recycle && pool->size) {
/* allocate memory for storing the handles */
bytes_needed =
sizeof(void *) *
pool->size;
pool->handles = kvmalloc(bytes_needed, GFP_KERNEL);
if (pool->handles)
memset(pool->handles, 0, bytes_needed);
else
err = -ENOMEM;
} else {
/* just in case, set the size to 0 */
pool->size = 0;
pool->handles = NULL;
}
return err;
}
/*
* @brief Uninitialize the resource pool (host, vbuf)
*
* @param pool The pointer to the pool
*/
void ia_css_rmgr_uninit_vbuf(struct ia_css_rmgr_vbuf_pool *pool)
{
u32 i;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "%s\n", __func__);
if (!pool) {
ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR, "%s NULL argument\n", __func__);
return;
}
if (pool->handles) {
/* free the hmm buffers */
for (i = 0; i < pool->size; i++) {
Annotation
- Immediate include surface: `hmm.h`, `ia_css_rmgr.h`, `type_support.h`, `assert_support.h`, `platform_support.h`, `ia_css_debug.h`.
- Detected declarations: `function rmgr_refcount_init_vbuf`, `function ia_css_rmgr_refcount_retain_vbuf`, `function ia_css_rmgr_refcount_release_vbuf`, `function ia_css_rmgr_init_vbuf`, `function ia_css_rmgr_uninit_vbuf`, `function rmgr_push_handle`, `function rmgr_pop_handle`, `function ia_css_rmgr_acq_vbuf`, `function ia_css_rmgr_rel_vbuf`.
- 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.