Lines Matching refs:array
113 * serialize access to the array.
118 void *mthca_array_get(struct mthca_array *array, int index)
122 if (array->page_list[p].page)
123 return array->page_list[p].page[index & MTHCA_ARRAY_MASK];
128 int mthca_array_set(struct mthca_array *array, int index, void *value)
133 if (!array->page_list[p].page)
134 array->page_list[p].page = (void **) get_zeroed_page(GFP_ATOMIC);
136 if (!array->page_list[p].page)
139 array->page_list[p].page[index & MTHCA_ARRAY_MASK] = value;
140 ++array->page_list[p].used;
145 void mthca_array_clear(struct mthca_array *array, int index)
149 if (--array->page_list[p].used == 0) {
150 free_page((unsigned long) array->page_list[p].page);
151 array->page_list[p].page = NULL;
153 array->page_list[p].page[index & MTHCA_ARRAY_MASK] = NULL;
155 if (array->page_list[p].used < 0)
157 array, index, p, array->page_list[p].used);
160 int mthca_array_init(struct mthca_array *array, int nent)
165 array->page_list = kmalloc(npage * sizeof *array->page_list, GFP_KERNEL);
166 if (!array->page_list)
170 array->page_list[i].page = NULL;
171 array->page_list[i].used = 0;
177 void mthca_array_cleanup(struct mthca_array *array, int nent)
182 free_page((unsigned long) array->page_list[i].page);
184 kfree(array->page_list);