summaryrefslogtreecommitdiff
path: root/sound/usb/midi.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2023-05-23 10:53:28 +0300
committerTakashi Iwai <tiwai@suse.de>2023-05-23 13:11:00 +0300
commitbb1bf4fa5953418c131796ee745c59899d34a149 (patch)
tree51bad5d210ae18dee1dbbda7bf9d3704eaa21ae6 /sound/usb/midi.c
parentfa030f666d2431be5310c0c0fef254e2e205d4cc (diff)
downloadlinux-bb1bf4fa5953418c131796ee745c59899d34a149.tar.xz
ALSA: usb-audio: Manage number of rawmidis globally
We're going to create rawmidi objects for MIDI 2.0 in a different code from the current code for USB-MIDI 1.0. As a preliminary work, this patch adds the number of rawmidi objects to keep globally in a USB-audio card instance, so that it can be referred from both MIDI 1.0 and 2.0 code. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20230523075358.9672-8-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/midi.c')
-rw-r--r--sound/usb/midi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 2839f6b6f09b..6b0993258e03 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -2461,7 +2461,8 @@ int __snd_usbmidi_create(struct snd_card *card,
struct usb_interface *iface,
struct list_head *midi_list,
const struct snd_usb_audio_quirk *quirk,
- unsigned int usb_id)
+ unsigned int usb_id,
+ unsigned int *num_rawmidis)
{
struct snd_usb_midi *umidi;
struct snd_usb_midi_endpoint_info endpoints[MIDI_MAX_ENDPOINTS];
@@ -2476,6 +2477,8 @@ int __snd_usbmidi_create(struct snd_card *card,
umidi->iface = iface;
umidi->quirk = quirk;
umidi->usb_protocol_ops = &snd_usbmidi_standard_ops;
+ if (num_rawmidis)
+ umidi->next_midi_device = *num_rawmidis;
spin_lock_init(&umidi->disc_lock);
init_rwsem(&umidi->disc_rwsem);
mutex_init(&umidi->mutex);
@@ -2595,6 +2598,8 @@ int __snd_usbmidi_create(struct snd_card *card,
usb_autopm_get_interface_no_resume(umidi->iface);
list_add_tail(&umidi->list, midi_list);
+ if (num_rawmidis)
+ *num_rawmidis = umidi->next_midi_device;
return 0;
free_midi: