aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbmidi.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 09:08:02 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:19:55 -0500
commit86e07d34658bb85b3424f4db64fa28f884edbe8d (patch)
treeeb6a97b850d12d2f64fa13cd1c436f0735627171 /sound/usb/usbmidi.c
parentdb13154843cb2c99a93e9feed575e906f6e0e455 (diff)
[ALSA] Remove xxx_t typedefs: USB-Audio
Modules: USB generic driver Remove xxx_t typedefs from the USB-Audio driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/usbmidi.c')
-rw-r--r--sound/usb/usbmidi.c211
1 files changed, 104 insertions, 107 deletions
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index f8aa662562a0..f15b021c3ce8 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -84,39 +84,36 @@ struct usb_ms_endpoint_descriptor {
84 __u8 baAssocJackID[0]; 84 __u8 baAssocJackID[0];
85} __attribute__ ((packed)); 85} __attribute__ ((packed));
86 86
87typedef struct snd_usb_midi snd_usb_midi_t; 87struct snd_usb_midi_in_endpoint;
88typedef struct snd_usb_midi_endpoint snd_usb_midi_endpoint_t; 88struct snd_usb_midi_out_endpoint;
89typedef struct snd_usb_midi_out_endpoint snd_usb_midi_out_endpoint_t; 89struct snd_usb_midi_endpoint;
90typedef struct snd_usb_midi_in_endpoint snd_usb_midi_in_endpoint_t;
91typedef struct usbmidi_out_port usbmidi_out_port_t;
92typedef struct usbmidi_in_port usbmidi_in_port_t;
93 90
94struct usb_protocol_ops { 91struct usb_protocol_ops {
95 void (*input)(snd_usb_midi_in_endpoint_t*, uint8_t*, int); 92 void (*input)(struct snd_usb_midi_in_endpoint*, uint8_t*, int);
96 void (*output)(snd_usb_midi_out_endpoint_t*); 93 void (*output)(struct snd_usb_midi_out_endpoint*);
97 void (*output_packet)(struct urb*, uint8_t, uint8_t, uint8_t, uint8_t); 94 void (*output_packet)(struct urb*, uint8_t, uint8_t, uint8_t, uint8_t);
98 void (*init_out_endpoint)(snd_usb_midi_out_endpoint_t*); 95 void (*init_out_endpoint)(struct snd_usb_midi_out_endpoint*);
99 void (*finish_out_endpoint)(snd_usb_midi_out_endpoint_t*); 96 void (*finish_out_endpoint)(struct snd_usb_midi_out_endpoint*);
100}; 97};
101 98
102struct snd_usb_midi { 99struct snd_usb_midi {
103 snd_usb_audio_t *chip; 100 struct snd_usb_audio *chip;
104 struct usb_interface *iface; 101 struct usb_interface *iface;
105 const snd_usb_audio_quirk_t *quirk; 102 const struct snd_usb_audio_quirk *quirk;
106 snd_rawmidi_t* rmidi; 103 struct snd_rawmidi *rmidi;
107 struct usb_protocol_ops* usb_protocol_ops; 104 struct usb_protocol_ops* usb_protocol_ops;
108 struct list_head list; 105 struct list_head list;
109 struct timer_list error_timer; 106 struct timer_list error_timer;
110 107
111 struct snd_usb_midi_endpoint { 108 struct snd_usb_midi_endpoint {
112 snd_usb_midi_out_endpoint_t *out; 109 struct snd_usb_midi_out_endpoint *out;
113 snd_usb_midi_in_endpoint_t *in; 110 struct snd_usb_midi_in_endpoint *in;
114 } endpoints[MIDI_MAX_ENDPOINTS]; 111 } endpoints[MIDI_MAX_ENDPOINTS];
115 unsigned long input_triggered; 112 unsigned long input_triggered;
116}; 113};
117 114
118struct snd_usb_midi_out_endpoint { 115struct snd_usb_midi_out_endpoint {
119 snd_usb_midi_t* umidi; 116 struct snd_usb_midi* umidi;
120 struct urb* urb; 117 struct urb* urb;
121 int urb_active; 118 int urb_active;
122 int max_transfer; /* size of urb buffer */ 119 int max_transfer; /* size of urb buffer */
@@ -125,8 +122,8 @@ struct snd_usb_midi_out_endpoint {
125 spinlock_t buffer_lock; 122 spinlock_t buffer_lock;
126 123
127 struct usbmidi_out_port { 124 struct usbmidi_out_port {
128 snd_usb_midi_out_endpoint_t* ep; 125 struct snd_usb_midi_out_endpoint* ep;
129 snd_rawmidi_substream_t* substream; 126 struct snd_rawmidi_substream *substream;
130 int active; 127 int active;
131 uint8_t cable; /* cable number << 4 */ 128 uint8_t cable; /* cable number << 4 */
132 uint8_t state; 129 uint8_t state;
@@ -143,17 +140,17 @@ struct snd_usb_midi_out_endpoint {
143}; 140};
144 141
145struct snd_usb_midi_in_endpoint { 142struct snd_usb_midi_in_endpoint {
146 snd_usb_midi_t* umidi; 143 struct snd_usb_midi* umidi;
147 struct urb* urb; 144 struct urb* urb;
148 struct usbmidi_in_port { 145 struct usbmidi_in_port {
149 snd_rawmidi_substream_t* substream; 146 struct snd_rawmidi_substream *substream;
150 } ports[0x10]; 147 } ports[0x10];
151 u8 seen_f5; 148 u8 seen_f5;
152 u8 error_resubmit; 149 u8 error_resubmit;
153 int current_port; 150 int current_port;
154}; 151};
155 152
156static void snd_usbmidi_do_output(snd_usb_midi_out_endpoint_t* ep); 153static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep);
157 154
158static const uint8_t snd_usbmidi_cin_length[] = { 155static const uint8_t snd_usbmidi_cin_length[] = {
159 0, 0, 2, 3, 3, 1, 2, 3, 3, 3, 3, 3, 2, 2, 3, 1 156 0, 0, 2, 3, 3, 1, 2, 3, 3, 3, 3, 3, 2, 2, 3, 1
@@ -196,10 +193,10 @@ static int snd_usbmidi_urb_error(int status)
196/* 193/*
197 * Receives a chunk of MIDI data. 194 * Receives a chunk of MIDI data.
198 */ 195 */
199static void snd_usbmidi_input_data(snd_usb_midi_in_endpoint_t* ep, int portidx, 196static void snd_usbmidi_input_data(struct snd_usb_midi_in_endpoint* ep, int portidx,
200 uint8_t* data, int length) 197 uint8_t* data, int length)
201{ 198{
202 usbmidi_in_port_t* port = &ep->ports[portidx]; 199 struct usbmidi_in_port* port = &ep->ports[portidx];
203 200
204 if (!port->substream) { 201 if (!port->substream) {
205 snd_printd("unexpected port %d!\n", portidx); 202 snd_printd("unexpected port %d!\n", portidx);
@@ -227,7 +224,7 @@ static void dump_urb(const char *type, const u8 *data, int length)
227 */ 224 */
228static void snd_usbmidi_in_urb_complete(struct urb* urb, struct pt_regs *regs) 225static void snd_usbmidi_in_urb_complete(struct urb* urb, struct pt_regs *regs)
229{ 226{
230 snd_usb_midi_in_endpoint_t* ep = urb->context; 227 struct snd_usb_midi_in_endpoint* ep = urb->context;
231 228
232 if (urb->status == 0) { 229 if (urb->status == 0) {
233 dump_urb("received", urb->transfer_buffer, urb->actual_length); 230 dump_urb("received", urb->transfer_buffer, urb->actual_length);
@@ -251,7 +248,7 @@ static void snd_usbmidi_in_urb_complete(struct urb* urb, struct pt_regs *regs)
251 248
252static void snd_usbmidi_out_urb_complete(struct urb* urb, struct pt_regs *regs) 249static void snd_usbmidi_out_urb_complete(struct urb* urb, struct pt_regs *regs)
253{ 250{
254 snd_usb_midi_out_endpoint_t* ep = urb->context; 251 struct snd_usb_midi_out_endpoint* ep = urb->context;
255 252
256 spin_lock(&ep->buffer_lock); 253 spin_lock(&ep->buffer_lock);
257 ep->urb_active = 0; 254 ep->urb_active = 0;
@@ -272,7 +269,7 @@ static void snd_usbmidi_out_urb_complete(struct urb* urb, struct pt_regs *regs)
272 * This is called when some data should be transferred to the device 269 * This is called when some data should be transferred to the device
273 * (from one or more substreams). 270 * (from one or more substreams).
274 */ 271 */
275static void snd_usbmidi_do_output(snd_usb_midi_out_endpoint_t* ep) 272static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint* ep)
276{ 273{
277 struct urb* urb = ep->urb; 274 struct urb* urb = ep->urb;
278 unsigned long flags; 275 unsigned long flags;
@@ -297,7 +294,7 @@ static void snd_usbmidi_do_output(snd_usb_midi_out_endpoint_t* ep)
297 294
298static void snd_usbmidi_out_tasklet(unsigned long data) 295static void snd_usbmidi_out_tasklet(unsigned long data)
299{ 296{
300 snd_usb_midi_out_endpoint_t* ep = (snd_usb_midi_out_endpoint_t *) data; 297 struct snd_usb_midi_out_endpoint* ep = (struct snd_usb_midi_out_endpoint *) data;
301 298
302 snd_usbmidi_do_output(ep); 299 snd_usbmidi_do_output(ep);
303} 300}
@@ -305,11 +302,11 @@ static void snd_usbmidi_out_tasklet(unsigned long data)
305/* called after transfers had been interrupted due to some USB error */ 302/* called after transfers had been interrupted due to some USB error */
306static void snd_usbmidi_error_timer(unsigned long data) 303static void snd_usbmidi_error_timer(unsigned long data)
307{ 304{
308 snd_usb_midi_t *umidi = (snd_usb_midi_t *)data; 305 struct snd_usb_midi *umidi = (struct snd_usb_midi *)data;
309 int i; 306 int i;
310 307
311 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { 308 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
312 snd_usb_midi_in_endpoint_t *in = umidi->endpoints[i].in; 309 struct snd_usb_midi_in_endpoint *in = umidi->endpoints[i].in;
313 if (in && in->error_resubmit) { 310 if (in && in->error_resubmit) {
314 in->error_resubmit = 0; 311 in->error_resubmit = 0;
315 in->urb->dev = umidi->chip->dev; 312 in->urb->dev = umidi->chip->dev;
@@ -321,7 +318,7 @@ static void snd_usbmidi_error_timer(unsigned long data)
321} 318}
322 319
323/* helper function to send static data that may not DMA-able */ 320/* helper function to send static data that may not DMA-able */
324static int send_bulk_static_data(snd_usb_midi_out_endpoint_t* ep, 321static int send_bulk_static_data(struct snd_usb_midi_out_endpoint* ep,
325 const void *data, int len) 322 const void *data, int len)
326{ 323{
327 int err; 324 int err;
@@ -342,7 +339,7 @@ static int send_bulk_static_data(snd_usb_midi_out_endpoint_t* ep,
342 * fourth byte in each packet, and uses length instead of CIN. 339 * fourth byte in each packet, and uses length instead of CIN.
343 */ 340 */
344 341
345static void snd_usbmidi_standard_input(snd_usb_midi_in_endpoint_t* ep, 342static void snd_usbmidi_standard_input(struct snd_usb_midi_in_endpoint* ep,
346 uint8_t* buffer, int buffer_length) 343 uint8_t* buffer, int buffer_length)
347{ 344{
348 int i; 345 int i;
@@ -355,7 +352,7 @@ static void snd_usbmidi_standard_input(snd_usb_midi_in_endpoint_t* ep,
355 } 352 }
356} 353}
357 354
358static void snd_usbmidi_midiman_input(snd_usb_midi_in_endpoint_t* ep, 355static void snd_usbmidi_midiman_input(struct snd_usb_midi_in_endpoint* ep,
359 uint8_t* buffer, int buffer_length) 356 uint8_t* buffer, int buffer_length)
360{ 357{
361 int i; 358 int i;
@@ -401,7 +398,7 @@ static void snd_usbmidi_output_midiman_packet(struct urb* urb, uint8_t p0,
401/* 398/*
402 * Converts MIDI commands to USB MIDI packets. 399 * Converts MIDI commands to USB MIDI packets.
403 */ 400 */
404static void snd_usbmidi_transmit_byte(usbmidi_out_port_t* port, 401static void snd_usbmidi_transmit_byte(struct usbmidi_out_port* port,
405 uint8_t b, struct urb* urb) 402 uint8_t b, struct urb* urb)
406{ 403{
407 uint8_t p0 = port->cable; 404 uint8_t p0 = port->cable;
@@ -495,14 +492,14 @@ static void snd_usbmidi_transmit_byte(usbmidi_out_port_t* port,
495 } 492 }
496} 493}
497 494
498static void snd_usbmidi_standard_output(snd_usb_midi_out_endpoint_t* ep) 495static void snd_usbmidi_standard_output(struct snd_usb_midi_out_endpoint* ep)
499{ 496{
500 struct urb* urb = ep->urb; 497 struct urb* urb = ep->urb;
501 int p; 498 int p;
502 499
503 /* FIXME: lower-numbered ports can starve higher-numbered ports */ 500 /* FIXME: lower-numbered ports can starve higher-numbered ports */
504 for (p = 0; p < 0x10; ++p) { 501 for (p = 0; p < 0x10; ++p) {
505 usbmidi_out_port_t* port = &ep->ports[p]; 502 struct usbmidi_out_port* port = &ep->ports[p];
506 if (!port->active) 503 if (!port->active)
507 continue; 504 continue;
508 while (urb->transfer_buffer_length + 3 < ep->max_transfer) { 505 while (urb->transfer_buffer_length + 3 < ep->max_transfer) {
@@ -534,7 +531,7 @@ static struct usb_protocol_ops snd_usbmidi_midiman_ops = {
534 * at the third byte. 531 * at the third byte.
535 */ 532 */
536 533
537static void snd_usbmidi_novation_input(snd_usb_midi_in_endpoint_t* ep, 534static void snd_usbmidi_novation_input(struct snd_usb_midi_in_endpoint* ep,
538 uint8_t* buffer, int buffer_length) 535 uint8_t* buffer, int buffer_length)
539{ 536{
540 if (buffer_length < 2 || !buffer[0] || buffer_length < buffer[0] + 1) 537 if (buffer_length < 2 || !buffer[0] || buffer_length < buffer[0] + 1)
@@ -542,7 +539,7 @@ static void snd_usbmidi_novation_input(snd_usb_midi_in_endpoint_t* ep,
542 snd_usbmidi_input_data(ep, 0, &buffer[2], buffer[0] - 1); 539 snd_usbmidi_input_data(ep, 0, &buffer[2], buffer[0] - 1);
543} 540}
544 541
545static void snd_usbmidi_novation_output(snd_usb_midi_out_endpoint_t* ep) 542static void snd_usbmidi_novation_output(struct snd_usb_midi_out_endpoint* ep)
546{ 543{
547 uint8_t* transfer_buffer; 544 uint8_t* transfer_buffer;
548 int count; 545 int count;
@@ -571,13 +568,13 @@ static struct usb_protocol_ops snd_usbmidi_novation_ops = {
571 * "raw" protocol: used by the MOTU FastLane. 568 * "raw" protocol: used by the MOTU FastLane.
572 */ 569 */
573 570
574static void snd_usbmidi_raw_input(snd_usb_midi_in_endpoint_t* ep, 571static void snd_usbmidi_raw_input(struct snd_usb_midi_in_endpoint* ep,
575 uint8_t* buffer, int buffer_length) 572 uint8_t* buffer, int buffer_length)
576{ 573{
577 snd_usbmidi_input_data(ep, 0, buffer, buffer_length); 574 snd_usbmidi_input_data(ep, 0, buffer, buffer_length);
578} 575}
579 576
580static void snd_usbmidi_raw_output(snd_usb_midi_out_endpoint_t* ep) 577static void snd_usbmidi_raw_output(struct snd_usb_midi_out_endpoint* ep)
581{ 578{
582 int count; 579 int count;
583 580
@@ -602,7 +599,7 @@ static struct usb_protocol_ops snd_usbmidi_raw_ops = {
602 * Emagic USB MIDI protocol: raw MIDI with "F5 xx" port switching. 599 * Emagic USB MIDI protocol: raw MIDI with "F5 xx" port switching.
603 */ 600 */
604 601
605static void snd_usbmidi_emagic_init_out(snd_usb_midi_out_endpoint_t* ep) 602static void snd_usbmidi_emagic_init_out(struct snd_usb_midi_out_endpoint* ep)
606{ 603{
607 static const u8 init_data[] = { 604 static const u8 init_data[] = {
608 /* initialization magic: "get version" */ 605 /* initialization magic: "get version" */
@@ -619,7 +616,7 @@ static void snd_usbmidi_emagic_init_out(snd_usb_midi_out_endpoint_t* ep)
619 send_bulk_static_data(ep, init_data, sizeof(init_data)); 616 send_bulk_static_data(ep, init_data, sizeof(init_data));
620} 617}
621 618
622static void snd_usbmidi_emagic_finish_out(snd_usb_midi_out_endpoint_t* ep) 619static void snd_usbmidi_emagic_finish_out(struct snd_usb_midi_out_endpoint* ep)
623{ 620{
624 static const u8 finish_data[] = { 621 static const u8 finish_data[] = {
625 /* switch to patch mode with last preset */ 622 /* switch to patch mode with last preset */
@@ -635,7 +632,7 @@ static void snd_usbmidi_emagic_finish_out(snd_usb_midi_out_endpoint_t* ep)
635 send_bulk_static_data(ep, finish_data, sizeof(finish_data)); 632 send_bulk_static_data(ep, finish_data, sizeof(finish_data));
636} 633}
637 634
638static void snd_usbmidi_emagic_input(snd_usb_midi_in_endpoint_t* ep, 635static void snd_usbmidi_emagic_input(struct snd_usb_midi_in_endpoint* ep,
639 uint8_t* buffer, int buffer_length) 636 uint8_t* buffer, int buffer_length)
640{ 637{
641 int i; 638 int i;
@@ -679,7 +676,7 @@ static void snd_usbmidi_emagic_input(snd_usb_midi_in_endpoint_t* ep,
679 } 676 }
680} 677}
681 678
682static void snd_usbmidi_emagic_output(snd_usb_midi_out_endpoint_t* ep) 679static void snd_usbmidi_emagic_output(struct snd_usb_midi_out_endpoint* ep)
683{ 680{
684 int port0 = ep->current_port; 681 int port0 = ep->current_port;
685 uint8_t* buf = ep->urb->transfer_buffer; 682 uint8_t* buf = ep->urb->transfer_buffer;
@@ -689,7 +686,7 @@ static void snd_usbmidi_emagic_output(snd_usb_midi_out_endpoint_t* ep)
689 for (i = 0; i < 0x10; ++i) { 686 for (i = 0; i < 0x10; ++i) {
690 /* round-robin, starting at the last current port */ 687 /* round-robin, starting at the last current port */
691 int portnum = (port0 + i) & 15; 688 int portnum = (port0 + i) & 15;
692 usbmidi_out_port_t* port = &ep->ports[portnum]; 689 struct usbmidi_out_port* port = &ep->ports[portnum];
693 690
694 if (!port->active) 691 if (!port->active)
695 continue; 692 continue;
@@ -733,10 +730,10 @@ static struct usb_protocol_ops snd_usbmidi_emagic_ops = {
733}; 730};
734 731
735 732
736static int snd_usbmidi_output_open(snd_rawmidi_substream_t* substream) 733static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream)
737{ 734{
738 snd_usb_midi_t* umidi = substream->rmidi->private_data; 735 struct snd_usb_midi* umidi = substream->rmidi->private_data;
739 usbmidi_out_port_t* port = NULL; 736 struct usbmidi_out_port* port = NULL;
740 int i, j; 737 int i, j;
741 738
742 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) 739 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i)
@@ -755,14 +752,14 @@ static int snd_usbmidi_output_open(snd_rawmidi_substream_t* substream)
755 return 0; 752 return 0;
756} 753}
757 754
758static int snd_usbmidi_output_close(snd_rawmidi_substream_t* substream) 755static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream)
759{ 756{
760 return 0; 757 return 0;
761} 758}
762 759
763static void snd_usbmidi_output_trigger(snd_rawmidi_substream_t* substream, int up) 760static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream, int up)
764{ 761{
765 usbmidi_out_port_t* port = (usbmidi_out_port_t*)substream->runtime->private_data; 762 struct usbmidi_out_port* port = (struct usbmidi_out_port*)substream->runtime->private_data;
766 763
767 port->active = up; 764 port->active = up;
768 if (up) { 765 if (up) {
@@ -777,19 +774,19 @@ static void snd_usbmidi_output_trigger(snd_rawmidi_substream_t* substream, int u
777 } 774 }
778} 775}
779 776
780static int snd_usbmidi_input_open(snd_rawmidi_substream_t* substream) 777static int snd_usbmidi_input_open(struct snd_rawmidi_substream *substream)
781{ 778{
782 return 0; 779 return 0;
783} 780}
784 781
785static int snd_usbmidi_input_close(snd_rawmidi_substream_t* substream) 782static int snd_usbmidi_input_close(struct snd_rawmidi_substream *substream)
786{ 783{
787 return 0; 784 return 0;
788} 785}
789 786
790static void snd_usbmidi_input_trigger(snd_rawmidi_substream_t* substream, int up) 787static void snd_usbmidi_input_trigger(struct snd_rawmidi_substream *substream, int up)
791{ 788{
792 snd_usb_midi_t* umidi = substream->rmidi->private_data; 789 struct snd_usb_midi* umidi = substream->rmidi->private_data;
793 790
794 if (up) 791 if (up)
795 set_bit(substream->number, &umidi->input_triggered); 792 set_bit(substream->number, &umidi->input_triggered);
@@ -797,13 +794,13 @@ static void snd_usbmidi_input_trigger(snd_rawmidi_substream_t* substream, int up
797 clear_bit(substream->number, &umidi->input_triggered); 794 clear_bit(substream->number, &umidi->input_triggered);
798} 795}
799 796
800static snd_rawmidi_ops_t snd_usbmidi_output_ops = { 797static struct snd_rawmidi_ops snd_usbmidi_output_ops = {
801 .open = snd_usbmidi_output_open, 798 .open = snd_usbmidi_output_open,
802 .close = snd_usbmidi_output_close, 799 .close = snd_usbmidi_output_close,
803 .trigger = snd_usbmidi_output_trigger, 800 .trigger = snd_usbmidi_output_trigger,
804}; 801};
805 802
806static snd_rawmidi_ops_t snd_usbmidi_input_ops = { 803static struct snd_rawmidi_ops snd_usbmidi_input_ops = {
807 .open = snd_usbmidi_input_open, 804 .open = snd_usbmidi_input_open,
808 .close = snd_usbmidi_input_close, 805 .close = snd_usbmidi_input_close,
809 .trigger = snd_usbmidi_input_trigger 806 .trigger = snd_usbmidi_input_trigger
@@ -813,7 +810,7 @@ static snd_rawmidi_ops_t snd_usbmidi_input_ops = {
813 * Frees an input endpoint. 810 * Frees an input endpoint.
814 * May be called when ep hasn't been initialized completely. 811 * May be called when ep hasn't been initialized completely.
815 */ 812 */
816static void snd_usbmidi_in_endpoint_delete(snd_usb_midi_in_endpoint_t* ep) 813static void snd_usbmidi_in_endpoint_delete(struct snd_usb_midi_in_endpoint* ep)
817{ 814{
818 if (ep->urb) { 815 if (ep->urb) {
819 usb_buffer_free(ep->umidi->chip->dev, 816 usb_buffer_free(ep->umidi->chip->dev,
@@ -828,11 +825,11 @@ static void snd_usbmidi_in_endpoint_delete(snd_usb_midi_in_endpoint_t* ep)
828/* 825/*
829 * Creates an input endpoint. 826 * Creates an input endpoint.
830 */ 827 */
831static int snd_usbmidi_in_endpoint_create(snd_usb_midi_t* umidi, 828static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi* umidi,
832 snd_usb_midi_endpoint_info_t* ep_info, 829 struct snd_usb_midi_endpoint_info* ep_info,
833 snd_usb_midi_endpoint_t* rep) 830 struct snd_usb_midi_endpoint* rep)
834{ 831{
835 snd_usb_midi_in_endpoint_t* ep; 832 struct snd_usb_midi_in_endpoint* ep;
836 void* buffer; 833 void* buffer;
837 unsigned int pipe; 834 unsigned int pipe;
838 int length; 835 int length;
@@ -885,7 +882,7 @@ static unsigned int snd_usbmidi_count_bits(unsigned int x)
885 * Frees an output endpoint. 882 * Frees an output endpoint.
886 * May be called when ep hasn't been initialized completely. 883 * May be called when ep hasn't been initialized completely.
887 */ 884 */
888static void snd_usbmidi_out_endpoint_delete(snd_usb_midi_out_endpoint_t* ep) 885static void snd_usbmidi_out_endpoint_delete(struct snd_usb_midi_out_endpoint* ep)
889{ 886{
890 if (ep->urb) { 887 if (ep->urb) {
891 usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer, 888 usb_buffer_free(ep->umidi->chip->dev, ep->max_transfer,
@@ -899,11 +896,11 @@ static void snd_usbmidi_out_endpoint_delete(snd_usb_midi_out_endpoint_t* ep)
899/* 896/*
900 * Creates an output endpoint, and initializes output ports. 897 * Creates an output endpoint, and initializes output ports.
901 */ 898 */
902static int snd_usbmidi_out_endpoint_create(snd_usb_midi_t* umidi, 899static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi,
903 snd_usb_midi_endpoint_info_t* ep_info, 900 struct snd_usb_midi_endpoint_info* ep_info,
904 snd_usb_midi_endpoint_t* rep) 901 struct snd_usb_midi_endpoint* rep)
905{ 902{
906 snd_usb_midi_out_endpoint_t* ep; 903 struct snd_usb_midi_out_endpoint* ep;
907 int i; 904 int i;
908 unsigned int pipe; 905 unsigned int pipe;
909 void* buffer; 906 void* buffer;
@@ -951,12 +948,12 @@ static int snd_usbmidi_out_endpoint_create(snd_usb_midi_t* umidi,
951/* 948/*
952 * Frees everything. 949 * Frees everything.
953 */ 950 */
954static void snd_usbmidi_free(snd_usb_midi_t* umidi) 951static void snd_usbmidi_free(struct snd_usb_midi* umidi)
955{ 952{
956 int i; 953 int i;
957 954
958 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { 955 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
959 snd_usb_midi_endpoint_t* ep = &umidi->endpoints[i]; 956 struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i];
960 if (ep->out) 957 if (ep->out)
961 snd_usbmidi_out_endpoint_delete(ep->out); 958 snd_usbmidi_out_endpoint_delete(ep->out);
962 if (ep->in) 959 if (ep->in)
@@ -970,13 +967,13 @@ static void snd_usbmidi_free(snd_usb_midi_t* umidi)
970 */ 967 */
971void snd_usbmidi_disconnect(struct list_head* p) 968void snd_usbmidi_disconnect(struct list_head* p)
972{ 969{
973 snd_usb_midi_t* umidi; 970 struct snd_usb_midi* umidi;
974 int i; 971 int i;
975 972
976 umidi = list_entry(p, snd_usb_midi_t, list); 973 umidi = list_entry(p, struct snd_usb_midi, list);
977 del_timer_sync(&umidi->error_timer); 974 del_timer_sync(&umidi->error_timer);
978 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { 975 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
979 snd_usb_midi_endpoint_t* ep = &umidi->endpoints[i]; 976 struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i];
980 if (ep->out) 977 if (ep->out)
981 tasklet_kill(&ep->out->tasklet); 978 tasklet_kill(&ep->out->tasklet);
982 if (ep->out && ep->out->urb) { 979 if (ep->out && ep->out->urb) {
@@ -989,19 +986,19 @@ void snd_usbmidi_disconnect(struct list_head* p)
989 } 986 }
990} 987}
991 988
992static void snd_usbmidi_rawmidi_free(snd_rawmidi_t* rmidi) 989static void snd_usbmidi_rawmidi_free(struct snd_rawmidi *rmidi)
993{ 990{
994 snd_usb_midi_t* umidi = rmidi->private_data; 991 struct snd_usb_midi* umidi = rmidi->private_data;
995 snd_usbmidi_free(umidi); 992 snd_usbmidi_free(umidi);
996} 993}
997 994
998static snd_rawmidi_substream_t* snd_usbmidi_find_substream(snd_usb_midi_t* umidi, 995static struct snd_rawmidi_substream *snd_usbmidi_find_substream(struct snd_usb_midi* umidi,
999 int stream, int number) 996 int stream, int number)
1000{ 997{
1001 struct list_head* list; 998 struct list_head* list;
1002 999
1003 list_for_each(list, &umidi->rmidi->streams[stream].substreams) { 1000 list_for_each(list, &umidi->rmidi->streams[stream].substreams) {
1004 snd_rawmidi_substream_t* substream = list_entry(list, snd_rawmidi_substream_t, list); 1001 struct snd_rawmidi_substream *substream = list_entry(list, struct snd_rawmidi_substream, list);
1005 if (substream->number == number) 1002 if (substream->number == number)
1006 return substream; 1003 return substream;
1007 } 1004 }
@@ -1097,14 +1094,14 @@ static struct {
1097 { USB_ID(0x086a, 0x0003), 4, "%s Broadcast" }, 1094 { USB_ID(0x086a, 0x0003), 4, "%s Broadcast" },
1098}; 1095};
1099 1096
1100static void snd_usbmidi_init_substream(snd_usb_midi_t* umidi, 1097static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi,
1101 int stream, int number, 1098 int stream, int number,
1102 snd_rawmidi_substream_t** rsubstream) 1099 struct snd_rawmidi_substream ** rsubstream)
1103{ 1100{
1104 int i; 1101 int i;
1105 const char *name_format; 1102 const char *name_format;
1106 1103
1107 snd_rawmidi_substream_t* substream = snd_usbmidi_find_substream(umidi, stream, number); 1104 struct snd_rawmidi_substream *substream = snd_usbmidi_find_substream(umidi, stream, number);
1108 if (!substream) { 1105 if (!substream) {
1109 snd_printd(KERN_ERR "substream %d:%d not found\n", stream, number); 1106 snd_printd(KERN_ERR "substream %d:%d not found\n", stream, number);
1110 return; 1107 return;
@@ -1128,8 +1125,8 @@ static void snd_usbmidi_init_substream(snd_usb_midi_t* umidi,
1128/* 1125/*
1129 * Creates the endpoints and their ports. 1126 * Creates the endpoints and their ports.
1130 */ 1127 */
1131static int snd_usbmidi_create_endpoints(snd_usb_midi_t* umidi, 1128static int snd_usbmidi_create_endpoints(struct snd_usb_midi* umidi,
1132 snd_usb_midi_endpoint_info_t* endpoints) 1129 struct snd_usb_midi_endpoint_info* endpoints)
1133{ 1130{
1134 int i, j, err; 1131 int i, j, err;
1135 int out_ports = 0, in_ports = 0; 1132 int out_ports = 0, in_ports = 0;
@@ -1169,8 +1166,8 @@ static int snd_usbmidi_create_endpoints(snd_usb_midi_t* umidi,
1169/* 1166/*
1170 * Returns MIDIStreaming device capabilities. 1167 * Returns MIDIStreaming device capabilities.
1171 */ 1168 */
1172static int snd_usbmidi_get_ms_info(snd_usb_midi_t* umidi, 1169static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
1173 snd_usb_midi_endpoint_info_t* endpoints) 1170 struct snd_usb_midi_endpoint_info* endpoints)
1174{ 1171{
1175 struct usb_interface* intf; 1172 struct usb_interface* intf;
1176 struct usb_host_interface *hostif; 1173 struct usb_host_interface *hostif;
@@ -1244,7 +1241,7 @@ static int snd_usbmidi_get_ms_info(snd_usb_midi_t* umidi,
1244 * On Roland devices, use the second alternate setting to be able to use 1241 * On Roland devices, use the second alternate setting to be able to use
1245 * the interrupt input endpoint. 1242 * the interrupt input endpoint.
1246 */ 1243 */
1247static void snd_usbmidi_switch_roland_altsetting(snd_usb_midi_t* umidi) 1244static void snd_usbmidi_switch_roland_altsetting(struct snd_usb_midi* umidi)
1248{ 1245{
1249 struct usb_interface* intf; 1246 struct usb_interface* intf;
1250 struct usb_host_interface *hostif; 1247 struct usb_host_interface *hostif;
@@ -1270,8 +1267,8 @@ static void snd_usbmidi_switch_roland_altsetting(snd_usb_midi_t* umidi)
1270/* 1267/*
1271 * Try to find any usable endpoints in the interface. 1268 * Try to find any usable endpoints in the interface.
1272 */ 1269 */
1273static int snd_usbmidi_detect_endpoints(snd_usb_midi_t* umidi, 1270static int snd_usbmidi_detect_endpoints(struct snd_usb_midi* umidi,
1274 snd_usb_midi_endpoint_info_t* endpoint, 1271 struct snd_usb_midi_endpoint_info* endpoint,
1275 int max_endpoints) 1272 int max_endpoints)
1276{ 1273{
1277 struct usb_interface* intf; 1274 struct usb_interface* intf;
@@ -1318,8 +1315,8 @@ static int snd_usbmidi_detect_endpoints(snd_usb_midi_t* umidi,
1318/* 1315/*
1319 * Detects the endpoints for one-port-per-endpoint protocols. 1316 * Detects the endpoints for one-port-per-endpoint protocols.
1320 */ 1317 */
1321static int snd_usbmidi_detect_per_port_endpoints(snd_usb_midi_t* umidi, 1318static int snd_usbmidi_detect_per_port_endpoints(struct snd_usb_midi* umidi,
1322 snd_usb_midi_endpoint_info_t* endpoints) 1319 struct snd_usb_midi_endpoint_info* endpoints)
1323{ 1320{
1324 int err, i; 1321 int err, i;
1325 1322
@@ -1336,8 +1333,8 @@ static int snd_usbmidi_detect_per_port_endpoints(snd_usb_midi_t* umidi,
1336/* 1333/*
1337 * Detects the endpoints and ports of Yamaha devices. 1334 * Detects the endpoints and ports of Yamaha devices.
1338 */ 1335 */
1339static int snd_usbmidi_detect_yamaha(snd_usb_midi_t* umidi, 1336static int snd_usbmidi_detect_yamaha(struct snd_usb_midi* umidi,
1340 snd_usb_midi_endpoint_info_t* endpoint) 1337 struct snd_usb_midi_endpoint_info* endpoint)
1341{ 1338{
1342 struct usb_interface* intf; 1339 struct usb_interface* intf;
1343 struct usb_host_interface *hostif; 1340 struct usb_host_interface *hostif;
@@ -1375,10 +1372,10 @@ static int snd_usbmidi_detect_yamaha(snd_usb_midi_t* umidi,
1375/* 1372/*
1376 * Creates the endpoints and their ports for Midiman devices. 1373 * Creates the endpoints and their ports for Midiman devices.
1377 */ 1374 */
1378static int snd_usbmidi_create_endpoints_midiman(snd_usb_midi_t* umidi, 1375static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi,
1379 snd_usb_midi_endpoint_info_t* endpoint) 1376 struct snd_usb_midi_endpoint_info* endpoint)
1380{ 1377{
1381 snd_usb_midi_endpoint_info_t ep_info; 1378 struct snd_usb_midi_endpoint_info ep_info;
1382 struct usb_interface* intf; 1379 struct usb_interface* intf;
1383 struct usb_host_interface *hostif; 1380 struct usb_host_interface *hostif;
1384 struct usb_interface_descriptor* intfd; 1381 struct usb_interface_descriptor* intfd;
@@ -1458,10 +1455,10 @@ static int snd_usbmidi_create_endpoints_midiman(snd_usb_midi_t* umidi,
1458 return 0; 1455 return 0;
1459} 1456}
1460 1457
1461static int snd_usbmidi_create_rawmidi(snd_usb_midi_t* umidi, 1458static int snd_usbmidi_create_rawmidi(struct snd_usb_midi* umidi,
1462 int out_ports, int in_ports) 1459 int out_ports, int in_ports)
1463{ 1460{
1464 snd_rawmidi_t* rmidi; 1461 struct snd_rawmidi *rmidi;
1465 int err; 1462 int err;
1466 1463
1467 err = snd_rawmidi_new(umidi->chip->card, "USB MIDI", 1464 err = snd_rawmidi_new(umidi->chip->card, "USB MIDI",
@@ -1487,18 +1484,18 @@ static int snd_usbmidi_create_rawmidi(snd_usb_midi_t* umidi,
1487 */ 1484 */
1488void snd_usbmidi_input_stop(struct list_head* p) 1485void snd_usbmidi_input_stop(struct list_head* p)
1489{ 1486{
1490 snd_usb_midi_t* umidi; 1487 struct snd_usb_midi* umidi;
1491 int i; 1488 int i;
1492 1489
1493 umidi = list_entry(p, snd_usb_midi_t, list); 1490 umidi = list_entry(p, struct snd_usb_midi, list);
1494 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { 1491 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
1495 snd_usb_midi_endpoint_t* ep = &umidi->endpoints[i]; 1492 struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i];
1496 if (ep->in) 1493 if (ep->in)
1497 usb_kill_urb(ep->in->urb); 1494 usb_kill_urb(ep->in->urb);
1498 } 1495 }
1499} 1496}
1500 1497
1501static void snd_usbmidi_input_start_ep(snd_usb_midi_in_endpoint_t* ep) 1498static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep)
1502{ 1499{
1503 if (ep) { 1500 if (ep) {
1504 struct urb* urb = ep->urb; 1501 struct urb* urb = ep->urb;
@@ -1512,10 +1509,10 @@ static void snd_usbmidi_input_start_ep(snd_usb_midi_in_endpoint_t* ep)
1512 */ 1509 */
1513void snd_usbmidi_input_start(struct list_head* p) 1510void snd_usbmidi_input_start(struct list_head* p)
1514{ 1511{
1515 snd_usb_midi_t* umidi; 1512 struct snd_usb_midi* umidi;
1516 int i; 1513 int i;
1517 1514
1518 umidi = list_entry(p, snd_usb_midi_t, list); 1515 umidi = list_entry(p, struct snd_usb_midi, list);
1519 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) 1516 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i)
1520 snd_usbmidi_input_start_ep(umidi->endpoints[i].in); 1517 snd_usbmidi_input_start_ep(umidi->endpoints[i].in);
1521} 1518}
@@ -1523,12 +1520,12 @@ void snd_usbmidi_input_start(struct list_head* p)
1523/* 1520/*
1524 * Creates and registers everything needed for a MIDI streaming interface. 1521 * Creates and registers everything needed for a MIDI streaming interface.
1525 */ 1522 */
1526int snd_usb_create_midi_interface(snd_usb_audio_t* chip, 1523int snd_usb_create_midi_interface(struct snd_usb_audio* chip,
1527 struct usb_interface* iface, 1524 struct usb_interface* iface,
1528 const snd_usb_audio_quirk_t* quirk) 1525 const struct snd_usb_audio_quirk* quirk)
1529{ 1526{
1530 snd_usb_midi_t* umidi; 1527 struct snd_usb_midi* umidi;
1531 snd_usb_midi_endpoint_info_t endpoints[MIDI_MAX_ENDPOINTS]; 1528 struct snd_usb_midi_endpoint_info endpoints[MIDI_MAX_ENDPOINTS];
1532 int out_ports, in_ports; 1529 int out_ports, in_ports;
1533 int i, err; 1530 int i, err;
1534 1531
@@ -1551,7 +1548,7 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip,
1551 break; 1548 break;
1552 case QUIRK_MIDI_FIXED_ENDPOINT: 1549 case QUIRK_MIDI_FIXED_ENDPOINT:
1553 memcpy(&endpoints[0], quirk->data, 1550 memcpy(&endpoints[0], quirk->data,
1554 sizeof(snd_usb_midi_endpoint_info_t)); 1551 sizeof(struct snd_usb_midi_endpoint_info));
1555 err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); 1552 err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1);
1556 break; 1553 break;
1557 case QUIRK_MIDI_YAMAHA: 1554 case QUIRK_MIDI_YAMAHA:
@@ -1560,7 +1557,7 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip,
1560 case QUIRK_MIDI_MIDIMAN: 1557 case QUIRK_MIDI_MIDIMAN:
1561 umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops; 1558 umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops;
1562 memcpy(&endpoints[0], quirk->data, 1559 memcpy(&endpoints[0], quirk->data,
1563 sizeof(snd_usb_midi_endpoint_info_t)); 1560 sizeof(struct snd_usb_midi_endpoint_info));
1564 err = 0; 1561 err = 0;
1565 break; 1562 break;
1566 case QUIRK_MIDI_NOVATION: 1563 case QUIRK_MIDI_NOVATION:
@@ -1574,7 +1571,7 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip,
1574 case QUIRK_MIDI_EMAGIC: 1571 case QUIRK_MIDI_EMAGIC:
1575 umidi->usb_protocol_ops = &snd_usbmidi_emagic_ops; 1572 umidi->usb_protocol_ops = &snd_usbmidi_emagic_ops;
1576 memcpy(&endpoints[0], quirk->data, 1573 memcpy(&endpoints[0], quirk->data,
1577 sizeof(snd_usb_midi_endpoint_info_t)); 1574 sizeof(struct snd_usb_midi_endpoint_info));
1578 err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); 1575 err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1);
1579 break; 1576 break;
1580 case QUIRK_MIDI_MIDITECH: 1577 case QUIRK_MIDI_MIDITECH: