perex f6b952
From 05f78cc6811110156c701fd9a2a5d15de8b4b1c7 Mon Sep 17 00:00:00 2001
perex f6b952
From: Jaroslav Kysela <perex@perex.cz>
perex f6b952
Date: Fri, 21 Nov 2008 14:44:31 +0100
perex f6b952
Subject: [PATCH] alsactl: Fix restore / init call behaviour when driver contains more controls
perex f6b952
perex f6b952
Fix check when driver contains more controls than state file. In this case,
perex f6b952
initialization procedure should be run, too.
perex f6b952
perex f6b952
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
perex f6b952
---
perex f6b952
 alsactl/state.c |    6 +++---
perex f6b952
 1 files changed, 3 insertions(+), 3 deletions(-)
perex f6b952
perex f6b952
diff --git a/alsactl/state.c b/alsactl/state.c
perex f6b952
index 467fa93..635a999 100644
perex f6b952
--- a/alsactl/state.c
perex f6b952
+++ b/alsactl/state.c
perex f6b952
@@ -1162,7 +1162,7 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control,
perex f6b952
 		return -EINVAL;
perex f6b952
 	}
perex f6b952
 	numid = atoi(id);
perex f6b952
-	if (numid > *maxnumid)
perex f6b952
+	if ((int)numid > *maxnumid)
perex f6b952
 		*maxnumid = numid;
perex f6b952
 	snd_config_for_each(i, next, control) {
perex f6b952
 		snd_config_t *n = snd_config_iterator_entry(i);
perex f6b952
@@ -1398,7 +1398,7 @@ static int set_controls(int card, snd_config_t *top, int doit)
perex f6b952
 	snd_ctl_card_info_t *info;
perex f6b952
 	snd_config_t *control;
perex f6b952
 	snd_config_iterator_t i, next;
perex f6b952
-	int err, maxnumid;
perex f6b952
+	int err, maxnumid = -1;
perex f6b952
 	char name[32], tmpid[16];
perex f6b952
 	const char *id;
perex f6b952
 	snd_ctl_card_info_alloca(&info;;
perex f6b952
@@ -1442,7 +1442,7 @@ static int set_controls(int card, snd_config_t *top, int doit)
perex f6b952
 
perex f6b952
 	/* check if we have additional controls in driver */
perex f6b952
 	/* in this case we should go through init procedure */
perex f6b952
-	if (!doit) {
perex f6b952
+	if (!doit && maxnumid >= 0) {
perex f6b952
 		snd_ctl_elem_id_t *id;
perex f6b952
 		snd_ctl_elem_info_t *info;
perex f6b952
 		snd_ctl_elem_id_alloca(&id;;
perex f6b952
-- 
perex f6b952
1.6.0.1.217.gb4928
perex f6b952