Skip to contentSkip to conversation

ALSA: core: Allow card id change to the same string

PATCH Applied Peter Ujfalusi 2 participants 2 messages Sep 16, 2010 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: core: Allow card id change to the same string

When user want to change the card id to the same string on the card via /sys/class/sound/cardX/id, do not report error. Instead return with success without doing anything.

---
 sound/core/init.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
sound/core/init.c +7 -2
index ec4a50c..2de45fb 100644
@@ -607,11 +607,16 @@ card_id_store_attr(struct device *dev, struct device_attribute *attr,
 		return -EEXIST;
 	}
 	for (idx = 0; idx < snd_ecards_limit; idx++) {
-		if (snd_cards[idx] && !strcmp(snd_cards[idx]->id, buf1))
-			goto __exist;
+		if (snd_cards[idx] && !strcmp(snd_cards[idx]->id, buf1)) {
+			if (card == snd_cards[idx])
+				goto __ok;
+			else
+				goto __exist;
+		}
 	}
 	strcpy(card->id, buf1);
 	snd_info_card_id_change(card);
+__ok:
 	mutex_unlock(&snd_card_mutex);
 
 	return count;
Signature · 1 line
1.7.2.2
Applied
#1 lore raw

At Thu, 16 Sep 2010 10:26:54 +0300,

Quoted 7 lines · Peter Ujfalusi

When user want to change the card id to the same string on the card via /sys/class/sound/cardX/id, do not report error. Instead return with success without doing anything.

Thanks, applied now.

Takashi

Quoted 35 lines
---
 sound/core/init.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
sound/core/init.c +7 -2
index ec4a50c..2de45fb 100644
@@ -607,11 +607,16 @@ card_id_store_attr(struct device *dev, struct device_attribute *attr,
 		return -EEXIST;
 	}
 	for (idx = 0; idx < snd_ecards_limit; idx++) {
-		if (snd_cards[idx] && !strcmp(snd_cards[idx]->id, buf1))
-			goto __exist;
+		if (snd_cards[idx] && !strcmp(snd_cards[idx]->id, buf1)) {
+			if (card == snd_cards[idx])
+				goto __ok;
+			else
+				goto __exist;
+		}
 	}
 	strcpy(card->id, buf1);
 	snd_info_card_id_change(card);
+__ok:
 	mutex_unlock(&snd_card_mutex);
 
 	return count;
Signature · 6 lines
1.7.2.2

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel