Lines Matching refs:f

44 	struct snd_seq_prioq *f;  in snd_seq_prioq_new()  local
46 f = kzalloc(sizeof(*f), GFP_KERNEL); in snd_seq_prioq_new()
47 if (!f) in snd_seq_prioq_new()
50 spin_lock_init(&f->lock); in snd_seq_prioq_new()
51 f->head = NULL; in snd_seq_prioq_new()
52 f->tail = NULL; in snd_seq_prioq_new()
53 f->cells = 0; in snd_seq_prioq_new()
55 return f; in snd_seq_prioq_new()
61 struct snd_seq_prioq *f = *fifo; in snd_seq_prioq_delete() local
64 if (f == NULL) { in snd_seq_prioq_delete()
72 if (f->cells > 0) { in snd_seq_prioq_delete()
74 while (f->cells > 0) in snd_seq_prioq_delete()
75 snd_seq_cell_free(snd_seq_prioq_cell_out(f, NULL)); in snd_seq_prioq_delete()
78 kfree(f); in snd_seq_prioq_delete()
131 int snd_seq_prioq_cell_in(struct snd_seq_prioq * f, in snd_seq_prioq_cell_in() argument
139 if (snd_BUG_ON(!f || !cell)) in snd_seq_prioq_cell_in()
145 spin_lock_irqsave(&f->lock, flags); in snd_seq_prioq_cell_in()
150 if (f->tail && !prior) { in snd_seq_prioq_cell_in()
151 if (compare_timestamp(&cell->event, &f->tail->event)) { in snd_seq_prioq_cell_in()
153 f->tail->next = cell; in snd_seq_prioq_cell_in()
154 f->tail = cell; in snd_seq_prioq_cell_in()
156 f->cells++; in snd_seq_prioq_cell_in()
157 spin_unlock_irqrestore(&f->lock, flags); in snd_seq_prioq_cell_in()
165 cur = f->head; /* cursor */ in snd_seq_prioq_cell_in()
182 spin_unlock_irqrestore(&f->lock, flags); in snd_seq_prioq_cell_in()
193 if (f->head == cur) /* this is the first cell, set head to it */ in snd_seq_prioq_cell_in()
194 f->head = cell; in snd_seq_prioq_cell_in()
196 f->tail = cell; in snd_seq_prioq_cell_in()
197 f->cells++; in snd_seq_prioq_cell_in()
198 spin_unlock_irqrestore(&f->lock, flags); in snd_seq_prioq_cell_in()
212 struct snd_seq_event_cell *snd_seq_prioq_cell_out(struct snd_seq_prioq *f, in snd_seq_prioq_cell_out() argument
218 if (f == NULL) { in snd_seq_prioq_cell_out()
222 spin_lock_irqsave(&f->lock, flags); in snd_seq_prioq_cell_out()
224 cell = f->head; in snd_seq_prioq_cell_out()
228 f->head = cell->next; in snd_seq_prioq_cell_out()
231 if (f->tail == cell) in snd_seq_prioq_cell_out()
232 f->tail = NULL; in snd_seq_prioq_cell_out()
235 f->cells--; in snd_seq_prioq_cell_out()
238 spin_unlock_irqrestore(&f->lock, flags); in snd_seq_prioq_cell_out()
243 int snd_seq_prioq_avail(struct snd_seq_prioq * f) in snd_seq_prioq_avail() argument
245 if (f == NULL) { in snd_seq_prioq_avail()
249 return f->cells; in snd_seq_prioq_avail()
275 void snd_seq_prioq_leave(struct snd_seq_prioq * f, int client, int timestamp) in snd_seq_prioq_leave() argument
283 spin_lock_irqsave(&f->lock, flags); in snd_seq_prioq_leave()
284 cell = f->head; in snd_seq_prioq_leave()
289 if (cell == f->head) { in snd_seq_prioq_leave()
290 f->head = cell->next; in snd_seq_prioq_leave()
294 if (cell == f->tail) in snd_seq_prioq_leave()
295 f->tail = cell->next; in snd_seq_prioq_leave()
296 f->cells--; in snd_seq_prioq_leave()
318 spin_unlock_irqrestore(&f->lock, flags); in snd_seq_prioq_leave()
384 void snd_seq_prioq_remove_events(struct snd_seq_prioq * f, int client, in snd_seq_prioq_remove_events() argument
393 spin_lock_irqsave(&f->lock, flags); in snd_seq_prioq_remove_events()
394 cell = f->head; in snd_seq_prioq_remove_events()
402 if (cell == f->head) { in snd_seq_prioq_remove_events()
403 f->head = cell->next; in snd_seq_prioq_remove_events()
408 if (cell == f->tail) in snd_seq_prioq_remove_events()
409 f->tail = cell->next; in snd_seq_prioq_remove_events()
410 f->cells--; in snd_seq_prioq_remove_events()
426 spin_unlock_irqrestore(&f->lock, flags); in snd_seq_prioq_remove_events()