Lines Matching full:mem
71 static void cma_add_to_cma_mem_list(struct cma *cma, struct cma_mem *mem) in cma_add_to_cma_mem_list() argument
74 hlist_add_head(&mem->node, &cma->mem_head); in cma_add_to_cma_mem_list()
80 struct cma_mem *mem = NULL; in cma_get_entry_from_list() local
84 mem = hlist_entry(cma->mem_head.first, struct cma_mem, node); in cma_get_entry_from_list()
85 hlist_del_init(&mem->node); in cma_get_entry_from_list()
89 return mem; in cma_get_entry_from_list()
94 struct cma_mem *mem = NULL; in cma_free_mem() local
97 mem = cma_get_entry_from_list(cma); in cma_free_mem()
98 if (mem == NULL) in cma_free_mem()
101 if (mem->n <= count) { in cma_free_mem()
102 cma_release(cma, mem->p, mem->n); in cma_free_mem()
103 count -= mem->n; in cma_free_mem()
104 kfree(mem); in cma_free_mem()
106 cma_release(cma, mem->p, count); in cma_free_mem()
107 mem->p += count; in cma_free_mem()
108 mem->n -= count; in cma_free_mem()
110 cma_add_to_cma_mem_list(cma, mem); in cma_free_mem()
113 cma_add_to_cma_mem_list(cma, mem); in cma_free_mem()
133 struct cma_mem *mem; in cma_alloc_mem() local
136 mem = kzalloc(sizeof(*mem), GFP_KERNEL); in cma_alloc_mem()
137 if (!mem) in cma_alloc_mem()
142 kfree(mem); in cma_alloc_mem()
146 mem->p = p; in cma_alloc_mem()
147 mem->n = count; in cma_alloc_mem()
149 cma_add_to_cma_mem_list(cma, mem); in cma_alloc_mem()