Skip to contentSkip to conversation

Ensure codec patch files are checked for the correct codec ID

PATCH In review David Henningsson 4 participants 6 messages Jun 2, 2010 – Jul 26, 2010 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Ensure codec patch files are checked for the correct codec ID

This one just popped out when I read the source code - or is there a reason for parsing vendorid and subid without caring about the result?

// David

Quoted 1 line

From ae4e9f41cf404d879b14be56591c4d5c6b403b71 Mon Sep 17 00:00:00 2001

From: David Henningsson <[email protected]>
Date: Wed, 2 Jun 2010 16:56:41 +0200
Subject: [PATCH] Ensure codec patch files are checked for the correct codec ID

---
 sound/pci/hda/hda_hwdep.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
sound/pci/hda/hda_hwdep.c +3 -1
index a1fc837..0e2cb27 100644
@@ -649,7 +649,9 @@ static void parse_codec_mode(char *buf, struct hda_bus *bus,
 	*codecp = NULL;
 	if (sscanf(buf, "%i %i %i", &vendorid, &subid, &caddr) == 3) {
 		list_for_each_entry(codec, &bus->codec_list, list) {
-			if (codec->addr == caddr) {
+			if (codec->vendor_id == vendorid && 
+					codec->subsystem_id == subid && 
+					codec->addr == caddr) {
 				*codecp = codec;
 				break;
 			}
Signature · 1 line
1.7.0.4

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

#1 lore raw
Quoted 2 lines · David Henningsson

This one just popped out when I read the source code - or is there a reason for parsing vendorid and subid without caring about the result?

Technically it matters little if the codec vendor_id and subsystem_id have valid values, because you can override them anyway. Codec address is the vital one.

Best,
-Dan

#2 lore raw
Quoted 8 lines · Daniel Chen
Quoted 2 lines · David Henningsson

This one just popped out when I read the source code - or is there a reason for parsing vendorid and subid without caring about the result?

Technically it matters little if the codec vendor_id and subsystem_id have valid values, because you can override them anyway. Codec address is the vital one.

In the individual case, maybe. However, assuming codec vendor and subsystem are correctly matched, a distro could make a long list of Codec SSID to model mappings, write down that in the patch file format, and supply that patch file. One could then add mappings as a minor distro update without having to recompile the kernel.

// David

#3 lore raw
Quoted 5 lines · David Henningsson

In the individual case, maybe. However, assuming codec vendor and subsystem are correctly matched, a distro could make a long list of Codec SSID to model mappings, write down that in the patch file format, and supply that patch file. One could then add mappings as a minor distro update without having to recompile the kernel.

Excellent point, although the idea of maintaining a massive "firmware" file is somewhat scary.

Best,
-Dan

#4 lore raw

PATCH 1/1 Ensure codec patch files are checked for the correct codec ID

In reply to David Henningsson

This one never got merged (and I forgot to cc Takashi...), so I'm just reposting it.

Link to original post:
http://mailman.alsa-project.org/pipermail/alsa-devel/2010-June/028302.html

Signature · 2 lines
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
Quoted 1 line

From ae4e9f41cf404d879b14be56591c4d5c6b403b71 Mon Sep 17 00:00:00 2001

From: David Henningsson <[email protected]>
Date: Wed, 2 Jun 2010 16:56:41 +0200
Subject: [PATCH] Ensure codec patch files are checked for the correct codec ID

---
 sound/pci/hda/hda_hwdep.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
sound/pci/hda/hda_hwdep.c +3 -1
index a1fc837..0e2cb27 100644
@@ -649,7 +649,9 @@ static void parse_codec_mode(char *buf, struct hda_bus *bus,
 	*codecp = NULL;
 	if (sscanf(buf, "%i %i %i", &vendorid, &subid, &caddr) == 3) {
 		list_for_each_entry(codec, &bus->codec_list, list) {
-			if (codec->addr == caddr) {
+			if (codec->vendor_id == vendorid && 
+					codec->subsystem_id == subid && 
+					codec->addr == caddr) {
 				*codecp = codec;
 				break;
 			}
Signature · 1 line
1.7.0.4

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

Applied
#5 lore raw

At Mon, 26 Jul 2010 10:22:59 +0200,

Quoted 16 lines · David Henningsson

This one never got merged (and I forgot to cc Takashi...), so I'm just reposting it.

Link to original post:
http://mailman.alsa-project.org/pipermail/alsa-devel/2010-June/028302.html

Signature · 3 lines
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
[2 0001-Ensure-codec-patch-files-are-checked-for-the-correct.patch <text/x-patch (7bit)>]
Quoted 1 line

From ae4e9f41cf404d879b14be56591c4d5c6b403b71 Mon Sep 17 00:00:00 2001

From: David Henningsson <[email protected]>
Date: Wed, 2 Jun 2010 16:56:41 +0200
Subject: [PATCH] Ensure codec patch files are checked for the correct codec ID

Thanks, applied with a slight coding style fix.

Takashi

Quoted 23 lines
---
 sound/pci/hda/hda_hwdep.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
sound/pci/hda/hda_hwdep.c +3 -1
index a1fc837..0e2cb27 100644
@@ -649,7 +649,9 @@ static void parse_codec_mode(char *buf, struct hda_bus *bus,
 	*codecp = NULL;
 	if (sscanf(buf, "%i %i %i", &vendorid, &subid, &caddr) == 3) {
 		list_for_each_entry(codec, &bus->codec_list, list) {
-			if (codec->addr == caddr) {
+			if (codec->vendor_id == vendorid && 
+					codec->subsystem_id == subid && 
+					codec->addr == caddr) {
 				*codecp = codec;
 				break;
 			}
Signature · 1 line
1.7.0.4