ALSA: usb-audio: Save mixer status only once at suspend
authorTakashi Iwai <tiwai@suse.de>
Fri, 2 May 2014 16:14:42 +0000 (18:14 +0200)
committerJiri Slaby <jslaby@suse.cz>
Tue, 4 Aug 2015 14:51:53 +0000 (16:51 +0200)
commit 1c53e7253ed8769a00afa0f06777d731dbe1ba6f upstream.

The suspend callback of usb-audio driver may be called multiple times
per suspend when multiple USB interfaces are bound to a single sound
card instance.  In such a case, it's superfluous to save the mixer
values multiple times.  This patch fixes it by checking the counter.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
sound/usb/card.c

index 3ab9fc47da09a35d934237d2268519508417e0e5..ca55e033cf9d16eac9de0a6243a70a9826925a40 100644 (file)
@@ -705,8 +705,9 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
                        chip->autosuspended = 1;
        }
 
-       list_for_each_entry(mixer, &chip->mixer_list, list)
-               snd_usb_mixer_suspend(mixer);
+       if (chip->num_suspended_intf == 1)
+               list_for_each_entry(mixer, &chip->mixer_list, list)
+                       snd_usb_mixer_suspend(mixer);
 
        return 0;
 }