ALSA: usb-audio: Add PM guards to US-16x08 transfers

The TASCAM control helpers submit vendor requests without preventing
runtime suspend or disconnect. This affects mixer writes and the
volatile meter path.

Protect both send and receive helpers with snd_usb_lock. Acquire the PM
guard before chip->mutex in the receive path so autoresume cannot invert
the mutex order.

Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Will Porter <mrwillporter@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260827232143.149197-3-mrwillporter@gmail.com
This commit is contained in:
Will Porter
2026-08-31 09:54:18 +02:00
committed by Takashi Iwai
parent 077304dfa7
commit 9e6c9d7531
+7
View File
@@ -151,6 +151,9 @@ static const char *const route_names[] = {
static int snd_us16x08_recv_urb(struct snd_usb_audio *chip,
unsigned char *buf, int size)
{
CLASS(snd_usb_lock, pm)(chip);
if (pm.err < 0)
return -EIO;
guard(mutex)(&chip->mutex);
snd_usb_ctl_msg(chip->dev,
@@ -165,6 +168,10 @@ static int snd_us16x08_recv_urb(struct snd_usb_audio *chip,
*/
static int snd_us16x08_send_urb(struct snd_usb_audio *chip, char *buf, int size)
{
CLASS(snd_usb_lock, pm)(chip);
if (pm.err < 0)
return -EIO;
return snd_usb_ctl_msg(chip->dev, usb_sndctrlpipe(chip->dev, 0),
SND_US16X08_URB_REQUEST, SND_US16X08_URB_REQUESTTYPE,
0, 0, buf, size);