FreeBSD/sys/dev/bhnd/bhndb/bhndb_subr.c
/**
 * Retain a reference to @p dwa for use by @p res.
 * 
 * @param br The resource state owning @p dwa.
 * @param dwa The allocation record to be retained.
 * @param res The resource that will own a reference to @p dwa.
 * 
 * @retval 0 success
 * @retval ENOMEM Failed to allocate a new reference structure.
 */
Retain a reference to @p dwa for use by @p res.

@param br The resource state owning @p dwa.
@param dwa The allocation record to be retained.
@param res The resource that will own a reference to @p dwa.

@retval 0 success
@retval ENOMEM Failed to allocate a new reference structure.
Retain a reference to @p dwa for use by @p res . @param br The resource state owning @p dwa . @param dwa The allocation record to be retained . @param res The resource that will own a reference to @p dwa . @retval 0 success @retval ENOMEM Failed to allocate a new reference structure .
int
bhndb_dw_retain(struct bhndb_resources *br, struct bhndb_dw_alloc *dwa,
    struct resource *res)
{
	struct bhndb_dw_rentry *rentry;
	KASSERT(bhndb_dw_find_resource_entry(dwa, res) == NULL,
	    ("double-retain of dynamic window for same resource"));
	rentry = malloc(sizeof(*rentry), M_BHND, M_NOWAIT);
	if (rentry == NULL)
		return (ENOMEM);
	rentry->dw_res = res;
	LIST_INSERT_HEAD(&dwa->refs, rentry, dw_link);
	br->dwa_freelist &= ~(1 << (dwa->rnid));
	return (0);
}
int bhndb_dw_retain ( struct bhndb_resources * br , struct bhndb_dw_alloc * dwa , struct resource * res ) { struct bhndb_dw_rentry * rentry ; KASSERT ( bhndb_dw_find_resource_entry ( dwa , res ) == NULL , ( " " ) ) ; rentry = malloc ( sizeof ( * rentry ) , M_BHND , M_NOWAIT ) ; if ( rentry == NULL ) return ( ENOMEM ) ; rentry -> dw_res = res ; LIST_INSERT_HEAD ( & dwa -> refs , rentry , dw_link ) ; br -> dwa_freelist &= ~ ( 1 << ( dwa -> rnid ) ) ; return ( 0 ) ; }
Retain a reference to @p dwa for use by @p res.
Retain a reference to @p dwa for use by @p res .
/* Insert a reference entry; we use M_NOWAIT to allow use from
	 * within a non-sleepable lock */ /* Update the free list */