Lines Matching refs:array
108 * serialize access to the array.
113 void *mthca_array_get(struct mthca_array *array, int index)
117 if (array->page_list[p].page)
118 return array->page_list[p].page[index & MTHCA_ARRAY_MASK];
123 int mthca_array_set(struct mthca_array *array, int index, void *value)
128 if (!array->page_list[p].page)
129 array->page_list[p].page = (void **) get_zeroed_page(GFP_ATOMIC);
131 if (!array->page_list[p].page)
134 array->page_list[p].page[index & MTHCA_ARRAY_MASK] = value;
135 ++array->page_list[p].used;
140 void mthca_array_clear(struct mthca_array *array, int index)
144 if (--array->page_list[p].used == 0) {
145 free_page((unsigned long) array->page_list[p].page);
146 array->page_list[p].page = NULL;
148 array->page_list[p].page[index & MTHCA_ARRAY_MASK] = NULL;
150 if (array->page_list[p].used < 0)
152 array, index, p, array->page_list[p].used);
155 int mthca_array_init(struct mthca_array *array, int nent)
160 array->page_list = kmalloc_array(npage, sizeof(*array->page_list),
162 if (!array->page_list)
166 array->page_list[i].page = NULL;
167 array->page_list[i].used = 0;
173 void mthca_array_cleanup(struct mthca_array *array, int nent)
178 free_page((unsigned long) array->page_list[i].page);
180 kfree(array->page_list);