Lines Matching refs:ib
132 struct idal_buffer *ib;
137 ib = kmalloc(struct_size(ib, data, nr_ptrs), GFP_DMA | GFP_KERNEL);
138 if (ib == NULL)
140 ib->size = size;
141 ib->page_order = page_order;
144 ib->data[i] = ib->data[i-1] + IDA_BLOCK_SIZE;
147 ib->data[i] = (void *)
149 if (ib->data[i] != NULL)
154 free_pages((unsigned long) ib->data[i],
155 ib->page_order);
157 kfree(ib);
160 return ib;
167 idal_buffer_free(struct idal_buffer *ib)
171 nr_ptrs = (ib->size + IDA_BLOCK_SIZE - 1) >> IDA_SIZE_LOG;
172 nr_chunks = (4096 << ib->page_order) >> IDA_SIZE_LOG;
174 free_pages((unsigned long) ib->data[i], ib->page_order);
175 kfree(ib);
182 __idal_buffer_is_needed(struct idal_buffer *ib)
184 return ib->size > (4096ul << ib->page_order) ||
185 idal_is_needed(ib->data[0], ib->size);
192 idal_buffer_set_cda(struct idal_buffer *ib, struct ccw1 *ccw)
194 if (__idal_buffer_is_needed(ib)) {
196 ccw->cda = (u32)(addr_t) ib->data;
200 ccw->cda = (u32)(addr_t) ib->data[0];
201 ccw->count = ib->size;
208 idal_buffer_to_user(struct idal_buffer *ib, void __user *to, size_t count)
213 BUG_ON(count > ib->size);
215 left = copy_to_user(to, ib->data[i], IDA_BLOCK_SIZE);
221 return copy_to_user(to, ib->data[i], count);
228 idal_buffer_from_user(struct idal_buffer *ib, const void __user *from, size_t count)
233 BUG_ON(count > ib->size);
235 left = copy_from_user(ib->data[i], from, IDA_BLOCK_SIZE);
241 return copy_from_user(ib->data[i], from, count);