Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2529bba7 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela
Browse files

[ALSA] Fix substream selection in PCM and rawmidi



The PCM and rawmidi substreams can be selected explicitly by opening
control handle and set via *_PREFER_SUBDEVICE ioctl.  But, when
multiple controls are opened, the driver gets confused.
The patch fixes the initialization of prefer_*_subdevice and the
check of multiple controls.  The first set subdevice is picked up
as the valid one.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent f03d68fe
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -75,6 +75,8 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
	init_waitqueue_head(&ctl->change_sleep);
	spin_lock_init(&ctl->read_lock);
	ctl->card = card;
	ctl->prefer_pcm_subdevice = -1;
	ctl->prefer_rawmidi_subdevice = -1;
	ctl->pid = current->pid;
	file->private_data = ctl;
	write_lock_irqsave(&card->ctl_files_rwlock, flags);
+2 −1
Original line number Diff line number Diff line
@@ -792,6 +792,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
		kctl = snd_ctl_file(list);
		if (kctl->pid == current->pid) {
			prefer_subdevice = kctl->prefer_pcm_subdevice;
			if (prefer_subdevice != -1)
				break;
		}
	}
+2 −1
Original line number Diff line number Diff line
@@ -430,6 +430,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
			kctl = snd_ctl_file(list);
			if (kctl->pid == current->pid) {
				subdevice = kctl->prefer_rawmidi_subdevice;
				if (subdevice != -1)
					break;
			}
		}