summaryrefslogtreecommitdiffstats
path: root/sound/usb/usx2y
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2009-11-16 12:23:46 +0100
committerTakashi Iwai <tiwai@suse.de>2009-11-24 10:19:59 +0100
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 00cd54c236b..0ad061e5728 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)
struct usb_device *dev = US122L(card)->chip.dev;
struct usb_interface *iface = usb_ifnum_to_if(dev, 1);
- return snd_usb_create_midi_interface(&US122L(card)->chip,
- iface, &quirk);
+ return snd_usbmidi_create(card, iface,
+ &US122L(card)->midi_list, &quirk);
}
static int us144_create_usbmidi(struct snd_card *card)
@@ -84,8 +84,8 @@ static int us144_create_usbmidi(struct snd_card *card)
struct usb_device *dev = US122L(card)->chip.dev;
struct usb_interface *iface = usb_ifnum_to_if(dev, 0);
- return snd_usb_create_midi_interface(&US122L(card)->chip,
- iface, &quirk);
+ return snd_usbmidi_create(card, iface,
+ &US122L(card)->midi_list, &quirk);
}
/*
@@ -297,7 +297,7 @@ static unsigned int usb_stream_hwdep_poll(struct snd_hwdep *hw,
static void us122l_stop(struct us122l *us122l)
{
struct list_head *p;
- list_for_each(p, &us122l->chip.midi_list)
+ list_for_each(p, &us122l->midi_list)
snd_usbmidi_input_stop(p);
usb_stream_stop(&us122l->sk);
@@ -363,7 +363,7 @@ static bool us122l_start(struct us122l *us122l,
snd_printk(KERN_ERR "us122l_start error %i \n", err);
goto out;
}
- list_for_each(p, &us122l->chip.midi_list)
+ list_for_each(p, &us122l->midi_list)
snd_usbmidi_input_start(p);
success = true;
out:
@@ -508,7 +508,7 @@ static bool us122l_create_card(struct snd_card *card)
if (err < 0) {
/* release the midi resources */
struct list_head *p;
- list_for_each(p, &us122l->chip.midi_list)
+ list_for_each(p, &us122l->midi_list)
snd_usbmidi_disconnect(p);
us122l_stop(us122l);
@@ -546,7 +546,7 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp)
US122L(card)->chip.card = card;
mutex_init(&US122L(card)->mutex);
init_waitqueue_head(&US122L(card)->sk.sleep);
- INIT_LIST_HEAD(&US122L(card)->chip.midi_list);
+ INIT_LIST_HEAD(&US122L(card)->midi_list);
strcpy(card->driver, "USB "NAME_ALLCAPS"");
sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");
sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)",
@@ -638,7 +638,7 @@ static void snd_us122l_disconnect(struct usb_interface *intf)
us122l->chip.shutdown = 1;
/* release the midi resources */
- list_for_each(p, &us122l->chip.midi_list) {
+ list_for_each(p, &us122l->midi_list) {
snd_usbmidi_disconnect(p);
}
@@ -667,7 +667,7 @@ static int snd_us122l_suspend(struct usb_interface *intf, pm_message_t message)
if (!us122l)
return 0;
- list_for_each(p, &us122l->chip.midi_list)
+ list_for_each(p, &us122l->midi_list)
snd_usbmidi_input_stop(p);
mutex_lock(&us122l->mutex);
@@ -720,7 +720,7 @@ static int snd_us122l_resume(struct usb_interface *intf)
if (err)
goto unlock;
- list_for_each(p, &us122l->chip.midi_list)
+ list_for_each(p, &us122l->midi_list)
snd_usbmidi_input_start(p);
unlock:
mutex_unlock(&us122l->mutex);
diff --git a/sound/usb/usx2y/us122l.h b/sound/usb/usx2y/us122l.h
index 3d10c4b2a0f..61ce5d7de0b 100644
--- a/sound/usb/usx2y/us122l.h
+++ b/sound/usb/usx2y/us122l.h
@@ -12,6 +12,7 @@ struct us122l {
unsigned second_periods_polled;
struct file *master;
struct file *slave;
+ struct list_head midi_list;
atomic_t mmap_count;
};
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c
index 52e04b2f35d..f96ab86259d 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)
&quirk_2 : &quirk_1;
snd_printdd("usX2Y_create_usbmidi \n");
- return snd_usb_create_midi_interface(&usX2Y(card)->chip, iface, quirk);
+ return snd_usbmidi_create(card, iface, &usX2Y(card)->midi_list, quirk);
}
static int usX2Y_create_alsa_devices(struct snd_card *card)
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index cb4bb8373ca..181337090e4 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)
usX2Y(card)->chip.card = card;
init_waitqueue_head(&usX2Y(card)->prepare_wait_queue);
mutex_init(&usX2Y(card)->prepare_mutex);
- INIT_LIST_HEAD(&usX2Y(card)->chip.midi_list);
+ INIT_LIST_HEAD(&usX2Y(card)->midi_list);
strcpy(card->driver, "USB "NAME_ALLCAPS"");
sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");
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)
usb_kill_urb(usX2Y->In04urb);
snd_card_disconnect(card);
/* release the midi resources */
- list_for_each(p, &usX2Y->chip.midi_list) {
+ list_for_each(p, &usX2Y->midi_list) {
snd_usbmidi_disconnect(p);
}
if (usX2Y->us428ctls_sharedmem)
diff --git a/sound/usb/usx2y/usbusx2y.h b/sound/usb/usx2y/usbusx2y.h
index 456b5fdbc33..231866ea349 100644
--- a/sound/usb/usx2y/usbusx2y.h
+++ b/sound/usb/usx2y/usbusx2y.h
@@ -42,6 +42,7 @@ struct usX2Ydev {
struct snd_usX2Y_substream *subs[4];
struct snd_usX2Y_substream * volatile prepare_subs;
wait_queue_head_t prepare_wait_queue;
+ struct list_head midi_list;
};
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index 9efd27f6b52..b8e2f469149 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)
alternate = 1;
usX2Y->stride = 4;
}
- list_for_each(p, &usX2Y->chip.midi_list) {
+ list_for_each(p, &usX2Y->midi_list) {
snd_usbmidi_input_stop(p);
}
usb_kill_urb(usX2Y->In04urb);
@@ -750,7 +750,7 @@ static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format)
}
usX2Y->In04urb->dev = usX2Y->chip.dev;
err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL);
- list_for_each(p, &usX2Y->chip.midi_list) {
+ list_for_each(p, &usX2Y->midi_list) {
snd_usbmidi_input_start(p);
}
usX2Y->format = format;