aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usx2y
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2009-11-16 06:23:46 -0500
committerTakashi Iwai <tiwai@suse.de>2009-11-24 04:19:59 -0500
commitd82af9f9aab69e82b86450272588c861364f8879 (patch)
tree725374db87473b6ae0e2ac6f41ca44866affa37b /sound/usb/usx2y
parent96f61d9ade82f3e9503df36809175325e8f5eaca (diff)
sound: usb: make the USB MIDI module more independent
Remove the dependecy from the USB MIDI code on the snd_usb_audio structure. This allows using the USB MIDI module from another driver without having to pretend to be the generic USB audio driver. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/usx2y')
-rw-r--r--sound/usb/usx2y/us122l.c22
-rw-r--r--sound/usb/usx2y/us122l.h1
-rw-r--r--sound/usb/usx2y/usX2Yhwdep.c2
-rw-r--r--sound/usb/usx2y/usbusx2y.c4
-rw-r--r--sound/usb/usx2y/usbusx2y.h1
-rw-r--r--sound/usb/usx2y/usbusx2yaudio.c4
6 files changed, 18 insertions, 16 deletions
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c
index 00cd54c236b4..0ad061e5728b 100644
--- a/sound/usb/usx2y/us122l.c
+++ b/sound/usb/usx2y/us122l.c
@@ -62,8 +62,8 @@ static int us122l_create_usbmidi(struct snd_card *card)
62 struct usb_device *dev = US122L(card)->chip.dev; 62 struct usb_device *dev = US122L(card)->chip.dev;
63 struct usb_interface *iface = usb_ifnum_to_if(dev, 1); 63 struct usb_interface *iface = usb_ifnum_to_if(dev, 1);
64 64
65 return snd_usb_create_midi_interface(&US122L(card)->chip, 65 return snd_usbmidi_create(card, iface,
66 iface, &quirk); 66 &US122L(card)->midi_list, &quirk);
67} 67}
68 68
69static int us144_create_usbmidi(struct snd_card *card) 69static int us144_create_usbmidi(struct snd_card *card)
@@ -84,8 +84,8 @@ static int us144_create_usbmidi(struct snd_card *card)
84 struct usb_device *dev = US122L(card)->chip.dev; 84 struct usb_device *dev = US122L(card)->chip.dev;
85 struct usb_interface *iface = usb_ifnum_to_if(dev, 0); 85 struct usb_interface *iface = usb_ifnum_to_if(dev, 0);
86 86
87 return snd_usb_create_midi_interface(&US122L(card)->chip, 87 return snd_usbmidi_create(card, iface,
88 iface, &quirk); 88 &US122L(card)->midi_list, &quirk);
89} 89}
90 90
91/* 91/*
@@ -297,7 +297,7 @@ static unsigned int usb_stream_hwdep_poll(struct snd_hwdep *hw,
297static void us122l_stop(struct us122l *us122l) 297static void us122l_stop(struct us122l *us122l)
298{ 298{
299 struct list_head *p; 299 struct list_head *p;
300 list_for_each(p, &us122l->chip.midi_list) 300 list_for_each(p, &us122l->midi_list)
301 snd_usbmidi_input_stop(p); 301 snd_usbmidi_input_stop(p);
302 302
303 usb_stream_stop(&us122l->sk); 303 usb_stream_stop(&us122l->sk);
@@ -363,7 +363,7 @@ static bool us122l_start(struct us122l *us122l,
363 snd_printk(KERN_ERR "us122l_start error %i \n", err); 363 snd_printk(KERN_ERR "us122l_start error %i \n", err);
364 goto out; 364 goto out;
365 } 365 }
366 list_for_each(p, &us122l->chip.midi_list) 366 list_for_each(p, &us122l->midi_list)
367 snd_usbmidi_input_start(p); 367 snd_usbmidi_input_start(p);
368 success = true; 368 success = true;
369out: 369out:
@@ -508,7 +508,7 @@ static bool us122l_create_card(struct snd_card *card)
508 if (err < 0) { 508 if (err < 0) {
509/* release the midi resources */ 509/* release the midi resources */
510 struct list_head *p; 510 struct list_head *p;
511 list_for_each(p, &us122l->chip.midi_list) 511 list_for_each(p, &us122l->midi_list)
512 snd_usbmidi_disconnect(p); 512 snd_usbmidi_disconnect(p);
513 513
514 us122l_stop(us122l); 514 us122l_stop(us122l);
@@ -546,7 +546,7 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp)
546 US122L(card)->chip.card = card; 546 US122L(card)->chip.card = card;
547 mutex_init(&US122L(card)->mutex); 547 mutex_init(&US122L(card)->mutex);
548 init_waitqueue_head(&US122L(card)->sk.sleep); 548 init_waitqueue_head(&US122L(card)->sk.sleep);
549 INIT_LIST_HEAD(&US122L(card)->chip.midi_list); 549 INIT_LIST_HEAD(&US122L(card)->midi_list);
550 strcpy(card->driver, "USB "NAME_ALLCAPS""); 550 strcpy(card->driver, "USB "NAME_ALLCAPS"");
551 sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); 551 sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");
552 sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", 552 sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)",
@@ -638,7 +638,7 @@ static void snd_us122l_disconnect(struct usb_interface *intf)
638 us122l->chip.shutdown = 1; 638 us122l->chip.shutdown = 1;
639 639
640/* release the midi resources */ 640/* release the midi resources */
641 list_for_each(p, &us122l->chip.midi_list) { 641 list_for_each(p, &us122l->midi_list) {
642 snd_usbmidi_disconnect(p); 642 snd_usbmidi_disconnect(p);
643 } 643 }
644 644
@@ -667,7 +667,7 @@ static int snd_us122l_suspend(struct usb_interface *intf, pm_message_t message)
667 if (!us122l) 667 if (!us122l)
668 return 0; 668 return 0;
669 669
670 list_for_each(p, &us122l->chip.midi_list) 670 list_for_each(p, &us122l->midi_list)
671 snd_usbmidi_input_stop(p); 671 snd_usbmidi_input_stop(p);
672 672
673 mutex_lock(&us122l->mutex); 673 mutex_lock(&us122l->mutex);
@@ -720,7 +720,7 @@ static int snd_us122l_resume(struct usb_interface *intf)
720 if (err) 720 if (err)
721 goto unlock; 721 goto unlock;
722 722
723 list_for_each(p, &us122l->chip.midi_list) 723 list_for_each(p, &us122l->midi_list)
724 snd_usbmidi_input_start(p); 724 snd_usbmidi_input_start(p);
725unlock: 725unlock:
726 mutex_unlock(&us122l->mutex); 726 mutex_unlock(&us122l->mutex);
diff --git a/sound/usb/usx2y/us122l.h b/sound/usb/usx2y/us122l.h
index 3d10c4b2a0f5..61ce5d7de0b9 100644
--- a/sound/usb/usx2y/us122l.h
+++ b/sound/usb/usx2y/us122l.h
@@ -12,6 +12,7 @@ struct us122l {
12 unsigned second_periods_polled; 12 unsigned second_periods_polled;
13 struct file *master; 13 struct file *master;
14 struct file *slave; 14 struct file *slave;
15 struct list_head midi_list;
15 16
16 atomic_t mmap_count; 17 atomic_t mmap_count;
17}; 18};
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c
index 52e04b2f35d3..f96ab86259d0 100644
--- a/sound/usb/usx2y/usX2Yhwdep.c
+++ b/sound/usb/usx2y/usX2Yhwdep.c
@@ -171,7 +171,7 @@ static int usX2Y_create_usbmidi(struct snd_card *card)
171 &quirk_2 : &quirk_1; 171 &quirk_2 : &quirk_1;
172 172
173 snd_printdd("usX2Y_create_usbmidi \n"); 173 snd_printdd("usX2Y_create_usbmidi \n");
174 return snd_usb_create_midi_interface(&usX2Y(card)->chip, iface, quirk); 174 return snd_usbmidi_create(card, iface, &usX2Y(card)->midi_list, quirk);
175} 175}
176 176
177static int usX2Y_create_alsa_devices(struct snd_card *card) 177static int usX2Y_create_alsa_devices(struct snd_card *card)
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index cb4bb8373ca2..181337090e48 100644
--- a/sound/usb/usx2y/usbusx2y.c
+++ b/sound/usb/usx2y/usbusx2y.c
@@ -354,7 +354,7 @@ static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp)
354 usX2Y(card)->chip.card = card; 354 usX2Y(card)->chip.card = card;
355 init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); 355 init_waitqueue_head(&usX2Y(card)->prepare_wait_queue);
356 mutex_init(&usX2Y(card)->prepare_mutex); 356 mutex_init(&usX2Y(card)->prepare_mutex);
357 INIT_LIST_HEAD(&usX2Y(card)->chip.midi_list); 357 INIT_LIST_HEAD(&usX2Y(card)->midi_list);
358 strcpy(card->driver, "USB "NAME_ALLCAPS""); 358 strcpy(card->driver, "USB "NAME_ALLCAPS"");
359 sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); 359 sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");
360 sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", 360 sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)",
@@ -451,7 +451,7 @@ static void usX2Y_usb_disconnect(struct usb_device *device, void* ptr)
451 usb_kill_urb(usX2Y->In04urb); 451 usb_kill_urb(usX2Y->In04urb);
452 snd_card_disconnect(card); 452 snd_card_disconnect(card);
453 /* release the midi resources */ 453 /* release the midi resources */
454 list_for_each(p, &usX2Y->chip.midi_list) { 454 list_for_each(p, &usX2Y->midi_list) {
455 snd_usbmidi_disconnect(p); 455 snd_usbmidi_disconnect(p);
456 } 456 }
457 if (usX2Y->us428ctls_sharedmem) 457 if (usX2Y->us428ctls_sharedmem)
diff --git a/sound/usb/usx2y/usbusx2y.h b/sound/usb/usx2y/usbusx2y.h
index 456b5fdbc339..231866ea3491 100644
--- a/sound/usb/usx2y/usbusx2y.h
+++ b/sound/usb/usx2y/usbusx2y.h
@@ -42,6 +42,7 @@ struct usX2Ydev {
42 struct snd_usX2Y_substream *subs[4]; 42 struct snd_usX2Y_substream *subs[4];
43 struct snd_usX2Y_substream * volatile prepare_subs; 43 struct snd_usX2Y_substream * volatile prepare_subs;
44 wait_queue_head_t prepare_wait_queue; 44 wait_queue_head_t prepare_wait_queue;
45 struct list_head midi_list;
45}; 46};
46 47
47 48
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index 9efd27f6b52f..b8e2f4691493 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -740,7 +740,7 @@ static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format)
740 alternate = 1; 740 alternate = 1;
741 usX2Y->stride = 4; 741 usX2Y->stride = 4;
742 } 742 }
743 list_for_each(p, &usX2Y->chip.midi_list) { 743 list_for_each(p, &usX2Y->midi_list) {
744 snd_usbmidi_input_stop(p); 744 snd_usbmidi_input_stop(p);
745 } 745 }
746 usb_kill_urb(usX2Y->In04urb); 746 usb_kill_urb(usX2Y->In04urb);
@@ -750,7 +750,7 @@ static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format)
750 } 750 }
751 usX2Y->In04urb->dev = usX2Y->chip.dev; 751 usX2Y->In04urb->dev = usX2Y->chip.dev;
752 err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); 752 err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL);
753 list_for_each(p, &usX2Y->chip.midi_list) { 753 list_for_each(p, &usX2Y->midi_list) {
754 snd_usbmidi_input_start(p); 754 snd_usbmidi_input_start(p);
755 } 755 }
756 usX2Y->format = format; 756 usX2Y->format = format;