• Home
  • Raw
  • Download

Lines Matching refs:iv

123 	struct airq_iv *iv;  in airq_iv_create()  local
126 iv = kzalloc(sizeof(*iv), GFP_KERNEL); in airq_iv_create()
127 if (!iv) in airq_iv_create()
129 iv->bits = bits; in airq_iv_create()
131 iv->vector = kzalloc(size, GFP_KERNEL); in airq_iv_create()
132 if (!iv->vector) in airq_iv_create()
135 iv->avail = kmalloc(size, GFP_KERNEL); in airq_iv_create()
136 if (!iv->avail) in airq_iv_create()
138 memset(iv->avail, 0xff, size); in airq_iv_create()
139 iv->end = 0; in airq_iv_create()
141 iv->end = bits; in airq_iv_create()
143 iv->bitlock = kzalloc(size, GFP_KERNEL); in airq_iv_create()
144 if (!iv->bitlock) in airq_iv_create()
149 iv->ptr = kzalloc(size, GFP_KERNEL); in airq_iv_create()
150 if (!iv->ptr) in airq_iv_create()
155 iv->data = kzalloc(size, GFP_KERNEL); in airq_iv_create()
156 if (!iv->data) in airq_iv_create()
159 spin_lock_init(&iv->lock); in airq_iv_create()
160 return iv; in airq_iv_create()
163 kfree(iv->ptr); in airq_iv_create()
164 kfree(iv->bitlock); in airq_iv_create()
165 kfree(iv->avail); in airq_iv_create()
166 kfree(iv->vector); in airq_iv_create()
167 kfree(iv); in airq_iv_create()
177 void airq_iv_release(struct airq_iv *iv) in airq_iv_release() argument
179 kfree(iv->data); in airq_iv_release()
180 kfree(iv->ptr); in airq_iv_release()
181 kfree(iv->bitlock); in airq_iv_release()
182 kfree(iv->vector); in airq_iv_release()
183 kfree(iv->avail); in airq_iv_release()
184 kfree(iv); in airq_iv_release()
197 unsigned long airq_iv_alloc(struct airq_iv *iv, unsigned long num) in airq_iv_alloc() argument
201 if (!iv->avail || num == 0) in airq_iv_alloc()
203 spin_lock_irqsave(&iv->lock, flags); in airq_iv_alloc()
204 bit = find_first_bit_inv(iv->avail, iv->bits); in airq_iv_alloc()
205 while (bit + num <= iv->bits) { in airq_iv_alloc()
207 if (!test_bit_inv(bit + i, iv->avail)) in airq_iv_alloc()
212 clear_bit_inv(bit + i, iv->avail); in airq_iv_alloc()
213 if (bit + num >= iv->end) in airq_iv_alloc()
214 iv->end = bit + num + 1; in airq_iv_alloc()
217 bit = find_next_bit_inv(iv->avail, iv->bits, bit + i + 1); in airq_iv_alloc()
219 if (bit + num > iv->bits) in airq_iv_alloc()
221 spin_unlock_irqrestore(&iv->lock, flags); in airq_iv_alloc()
232 void airq_iv_free(struct airq_iv *iv, unsigned long bit, unsigned long num) in airq_iv_free() argument
236 if (!iv->avail || num == 0) in airq_iv_free()
238 spin_lock_irqsave(&iv->lock, flags); in airq_iv_free()
241 clear_bit_inv(bit + i, iv->vector); in airq_iv_free()
243 set_bit_inv(bit + i, iv->avail); in airq_iv_free()
245 if (bit + num >= iv->end) { in airq_iv_free()
247 while (iv->end > 0 && !test_bit_inv(iv->end - 1, iv->avail)) in airq_iv_free()
248 iv->end--; in airq_iv_free()
250 spin_unlock_irqrestore(&iv->lock, flags); in airq_iv_free()
263 unsigned long airq_iv_scan(struct airq_iv *iv, unsigned long start, in airq_iv_scan() argument
269 bit = find_next_bit_inv(iv->vector, end, start); in airq_iv_scan()
272 clear_bit_inv(bit, iv->vector); in airq_iv_scan()