Lines Matching refs:bm_pool
13 void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) in hwbm_buf_free() argument
15 if (likely(bm_pool->frag_size <= PAGE_SIZE)) in hwbm_buf_free()
23 int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) in hwbm_pool_refill() argument
25 int frag_size = bm_pool->frag_size; in hwbm_pool_refill()
36 if (bm_pool->construct) in hwbm_pool_refill()
37 if (bm_pool->construct(bm_pool, buf)) { in hwbm_pool_refill()
38 hwbm_buf_free(bm_pool, buf); in hwbm_pool_refill()
46 int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num) in hwbm_pool_add() argument
50 mutex_lock(&bm_pool->buf_lock); in hwbm_pool_add()
51 if (bm_pool->buf_num == bm_pool->size) { in hwbm_pool_add()
53 mutex_unlock(&bm_pool->buf_lock); in hwbm_pool_add()
54 return bm_pool->buf_num; in hwbm_pool_add()
57 if (buf_num + bm_pool->buf_num > bm_pool->size) { in hwbm_pool_add()
60 mutex_unlock(&bm_pool->buf_lock); in hwbm_pool_add()
64 if ((buf_num + bm_pool->buf_num) < bm_pool->buf_num) { in hwbm_pool_add()
66 buf_num, bm_pool->buf_num); in hwbm_pool_add()
67 mutex_unlock(&bm_pool->buf_lock); in hwbm_pool_add()
72 err = hwbm_pool_refill(bm_pool, GFP_KERNEL); in hwbm_pool_add()
78 bm_pool->buf_num += i; in hwbm_pool_add()
81 mutex_unlock(&bm_pool->buf_lock); in hwbm_pool_add()