Lines Matching defs:iv

130 	struct airq_iv *iv;
133 iv = kzalloc(sizeof(*iv), GFP_KERNEL);
134 if (!iv)
136 iv->bits = bits;
137 iv->flags = flags;
145 iv->vector = dma_pool_zalloc(airq_iv_cache, GFP_KERNEL,
146 &iv->vector_dma);
147 if (!iv->vector)
150 iv->vector = vec;
152 iv->vector = cio_dma_zalloc(size);
153 if (!iv->vector)
157 iv->avail = kmalloc(size, GFP_KERNEL);
158 if (!iv->avail)
160 memset(iv->avail, 0xff, size);
161 iv->end = 0;
163 iv->end = bits;
165 iv->bitlock = kzalloc(size, GFP_KERNEL);
166 if (!iv->bitlock)
171 iv->ptr = kzalloc(size, GFP_KERNEL);
172 if (!iv->ptr)
177 iv->data = kzalloc(size, GFP_KERNEL);
178 if (!iv->data)
181 spin_lock_init(&iv->lock);
182 return iv;
185 kfree(iv->ptr);
186 kfree(iv->bitlock);
187 kfree(iv->avail);
188 if (iv->flags & AIRQ_IV_CACHELINE && iv->vector)
189 dma_pool_free(airq_iv_cache, iv->vector, iv->vector_dma);
190 else if (!(iv->flags & AIRQ_IV_GUESTVEC))
191 cio_dma_free(iv->vector, size);
192 kfree(iv);
200 * @iv: pointer to interrupt vector structure
202 void airq_iv_release(struct airq_iv *iv)
204 kfree(iv->data);
205 kfree(iv->ptr);
206 kfree(iv->bitlock);
207 if (iv->flags & AIRQ_IV_CACHELINE)
208 dma_pool_free(airq_iv_cache, iv->vector, iv->vector_dma);
209 else if (!(iv->flags & AIRQ_IV_GUESTVEC))
210 cio_dma_free(iv->vector, iv_size(iv->bits));
211 kfree(iv->avail);
212 kfree(iv);
218 * @iv: pointer to an interrupt vector structure
225 unsigned long airq_iv_alloc(struct airq_iv *iv, unsigned long num)
229 if (!iv->avail || num == 0)
231 spin_lock_irqsave(&iv->lock, flags);
232 bit = find_first_bit_inv(iv->avail, iv->bits);
233 while (bit + num <= iv->bits) {
235 if (!test_bit_inv(bit + i, iv->avail))
240 clear_bit_inv(bit + i, iv->avail);
241 if (bit + num >= iv->end)
242 iv->end = bit + num + 1;
245 bit = find_next_bit_inv(iv->avail, iv->bits, bit + i + 1);
247 if (bit + num > iv->bits)
249 spin_unlock_irqrestore(&iv->lock, flags);
256 * @iv: pointer to interrupt vector structure
260 void airq_iv_free(struct airq_iv *iv, unsigned long bit, unsigned long num)
264 if (!iv->avail || num == 0)
266 spin_lock_irqsave(&iv->lock, flags);
269 clear_bit_inv(bit + i, iv->vector);
271 set_bit_inv(bit + i, iv->avail);
273 if (bit + num >= iv->end) {
275 while (iv->end > 0 && !test_bit_inv(iv->end - 1, iv->avail))
276 iv->end--;
278 spin_unlock_irqrestore(&iv->lock, flags);
284 * @iv: pointer to interrupt vector structure
291 unsigned long airq_iv_scan(struct airq_iv *iv, unsigned long start,
297 bit = find_next_bit_inv(iv->vector, end, start);
300 clear_bit_inv(bit, iv->vector);