Lines Matching refs:midihdr
52 static void init_midi_hdr(struct midi_hdr *midihdr) in init_midi_hdr() argument
54 midihdr->bufferlength = MIDIIN_BUFLEN; in init_midi_hdr()
55 midihdr->bytesrecorded = 0; in init_midi_hdr()
56 midihdr->flags = 0; in init_midi_hdr()
61 struct midi_hdr *midihdr; in midiin_add_buffer() local
63 if ((midihdr = (struct midi_hdr *) kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) { in midiin_add_buffer()
68 init_midi_hdr(midihdr); in midiin_add_buffer()
70 if ((midihdr->data = (u8 *) kmalloc(MIDIIN_BUFLEN, GFP_KERNEL)) == NULL) { in midiin_add_buffer()
72 kfree(midihdr); in midiin_add_buffer()
76 if (emu10k1_mpuin_add_buffer(midi_dev->card->mpuin, midihdr) < 0) { in midiin_add_buffer()
78 kfree(midihdr->data); in midiin_add_buffer()
79 kfree(midihdr); in midiin_add_buffer()
83 *midihdrptr = midihdr; in midiin_add_buffer()
84 list_add_tail(&midihdr->list, &midi_dev->mid_hdrs); in midiin_add_buffer()
218 struct midi_hdr *midihdr; in emu10k1_midi_release() local
229 midihdr = list_entry(midi_dev->mid_hdrs.next, struct midi_hdr, list); in emu10k1_midi_release()
232 kfree(midihdr->data); in emu10k1_midi_release()
233 kfree(midihdr); in emu10k1_midi_release()
327 struct midi_hdr *midihdr; in emu10k1_midi_write() local
339 if ((midihdr = (struct midi_hdr *) kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) in emu10k1_midi_write()
342 midihdr->bufferlength = count; in emu10k1_midi_write()
343 midihdr->bytesrecorded = 0; in emu10k1_midi_write()
344 midihdr->flags = 0; in emu10k1_midi_write()
346 if ((midihdr->data = (u8 *) kmalloc(count, GFP_KERNEL)) == NULL) { in emu10k1_midi_write()
348 kfree(midihdr); in emu10k1_midi_write()
352 if (copy_from_user(midihdr->data, buffer, count)) { in emu10k1_midi_write()
353 kfree(midihdr->data); in emu10k1_midi_write()
354 kfree(midihdr); in emu10k1_midi_write()
360 if (emu10k1_mpuout_add_buffer(midi_dev->card, midihdr) < 0) { in emu10k1_midi_write()
362 kfree(midihdr->data); in emu10k1_midi_write()
363 kfree(midihdr); in emu10k1_midi_write()
406 struct midi_hdr *midihdr = NULL; in emu10k1_midi_callback() local
416 midihdr = (struct midi_hdr *) pmsg[2]; in emu10k1_midi_callback()
418 kfree(midihdr->data); in emu10k1_midi_callback()
419 kfree(midihdr); in emu10k1_midi_callback()
425 midihdr = (struct midi_hdr *) pmsg[2]; in emu10k1_midi_callback()
427 for (i = 0; i < midihdr->bytesrecorded; i++) { in emu10k1_midi_callback()
428 midi_dev->iBuf[midi_dev->iwr++] = midihdr->data[i]; in emu10k1_midi_callback()
432 midi_dev->icnt += midihdr->bytesrecorded; in emu10k1_midi_callback()
435 init_midi_hdr(midihdr); in emu10k1_midi_callback()
436 emu10k1_mpuin_add_buffer(midi_dev->card->mpuin, midihdr); in emu10k1_midi_callback()
544 struct midi_hdr *midihdr; in emu10k1_seq_midi_out() local
552 if ((midihdr = (struct midi_hdr *) kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) in emu10k1_seq_midi_out()
555 midihdr->bufferlength = 1; in emu10k1_seq_midi_out()
556 midihdr->bytesrecorded = 0; in emu10k1_seq_midi_out()
557 midihdr->flags = 0; in emu10k1_seq_midi_out()
559 if ((midihdr->data = (u8 *) kmalloc(1, GFP_KERNEL)) == NULL) { in emu10k1_seq_midi_out()
561 kfree(midihdr); in emu10k1_seq_midi_out()
565 *(midihdr->data) = midi_byte; in emu10k1_seq_midi_out()
569 if (emu10k1_mpuout_add_buffer(card, midihdr) < 0) { in emu10k1_seq_midi_out()
571 kfree(midihdr->data); in emu10k1_seq_midi_out()
572 kfree(midihdr); in emu10k1_seq_midi_out()