From: Takashi Iwai <tiwai@suse.de>
Date: Fri, 2 May 2014 16:14:42 +0000 (+0200)
Subject: ALSA: usb-audio: Save mixer status only once at suspend
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1c53e7253ed8769a00afa0f06777d731dbe1ba6f;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

ALSA: usb-audio: Save mixer status only once at suspend

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>
---

diff --git a/sound/usb/card.c b/sound/usb/card.c
index 893d5a1afc3c..e769d3977716 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -695,8 +695,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;
 }