public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Recurse before saving terminal properties
@ 2015-08-12 20:14 Julian Scheel
  2015-08-14 13:06 ` Takashi Iwai
  0 siblings, 1 reply; 8+ messages in thread
From: Julian Scheel @ 2015-08-12 20:14 UTC (permalink / raw)
  To: alsa-devel, tiwai; +Cc: Julian Scheel

When the descriptor parser recurses into the clock source descriptor, the
terminals properties, like name and type, are set to the values of the clock
selector as check_input_term overwrites term->name and others in the recursive
call. As we want to only fill missing values using the descriptors higher in
the recursion tree the properties taken from the actual descriptor must be
applied after recursing.

Signed-off-by: Julian Scheel <julian@jusst.de>
---
 sound/usb/mixer.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 6b3acba..4a49944 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -715,15 +715,16 @@ static int check_input_term(struct mixer_build *state, int id,
 				term->name = d->iTerminal;
 			} else { /* UAC_VERSION_2 */
 				struct uac2_input_terminal_descriptor *d = p1;
-				term->type = le16_to_cpu(d->wTerminalType);
-				term->channels = d->bNrChannels;
-				term->chconfig = le32_to_cpu(d->bmChannelConfig);
-				term->name = d->iTerminal;
 
 				/* call recursively to get the clock selectors */
 				err = check_input_term(state, d->bCSourceID, term);
 				if (err < 0)
 					return err;
+
+				term->type = le16_to_cpu(d->wTerminalType);
+				term->channels = d->bNrChannels;
+				term->chconfig = le32_to_cpu(d->bmChannelConfig);
+				term->name = d->iTerminal;
 			}
 			return 0;
 		case UAC_FEATURE_UNIT: {
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-09-06 15:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-12 20:14 [PATCH] ALSA: usb-audio: Recurse before saving terminal properties Julian Scheel
2015-08-14 13:06 ` Takashi Iwai
2015-08-14 13:25   ` Julian Scheel
2015-08-16 11:45     ` Daniel Mack
2015-08-17  5:56       ` Julian Scheel
2015-08-17  8:35       ` Julian Scheel
2015-08-18  8:09         ` Daniel Mack
2015-09-06 15:34   ` Johan Aires Rastén

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox