Lines Matching refs:ib
120 struct idal_buffer *ib;
125 ib = kmalloc(struct_size(ib, data, nr_ptrs), GFP_DMA | GFP_KERNEL);
126 if (ib == NULL)
128 ib->size = size;
129 ib->page_order = page_order;
132 ib->data[i] = ib->data[i-1] + IDA_BLOCK_SIZE;
135 ib->data[i] = (void *)
137 if (ib->data[i] != NULL)
142 free_pages((unsigned long) ib->data[i],
143 ib->page_order);
145 kfree(ib);
148 return ib;
155 idal_buffer_free(struct idal_buffer *ib)
159 nr_ptrs = (ib->size + IDA_BLOCK_SIZE - 1) >> IDA_SIZE_LOG;
160 nr_chunks = (4096 << ib->page_order) >> IDA_SIZE_LOG;
162 free_pages((unsigned long) ib->data[i], ib->page_order);
163 kfree(ib);
170 __idal_buffer_is_needed(struct idal_buffer *ib)
172 return ib->size > (4096ul << ib->page_order) ||
173 idal_is_needed(ib->data[0], ib->size);
180 idal_buffer_set_cda(struct idal_buffer *ib, struct ccw1 *ccw)
182 if (__idal_buffer_is_needed(ib)) {
184 ccw->cda = (u32)(addr_t) ib->data;
188 ccw->cda = (u32)(addr_t) ib->data[0];
189 ccw->count = ib->size;
196 idal_buffer_to_user(struct idal_buffer *ib, void __user *to, size_t count)
201 BUG_ON(count > ib->size);
203 left = copy_to_user(to, ib->data[i], IDA_BLOCK_SIZE);
209 return copy_to_user(to, ib->data[i], count);
216 idal_buffer_from_user(struct idal_buffer *ib, const void __user *from, size_t count)
221 BUG_ON(count > ib->size);
223 left = copy_from_user(ib->data[i], from, IDA_BLOCK_SIZE);
229 return copy_from_user(ib->data[i], from, count);