All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Ensure codec patch files are checked for the correct codec ID
@ 2010-06-02 15:02 David Henningsson
  2010-06-02 16:03 ` Daniel Chen
  2010-07-26  8:22 ` David Henningsson
  0 siblings, 2 replies; 6+ messages in thread
From: David Henningsson @ 2010-06-02 15:02 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 150 bytes --]

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

[-- Attachment #2: 0001-Ensure-codec-patch-files-are-checked-for-the-correct.patch --]
[-- Type: text/x-patch, Size: 955 bytes --]

>From ae4e9f41cf404d879b14be56591c4d5c6b403b71 Mon Sep 17 00:00:00 2001
From: David Henningsson <diwic@ubuntu.com>
Date: Wed, 2 Jun 2010 16:56:41 +0200
Subject: [PATCH] Ensure codec patch files are checked for the correct codec ID
 Signed-off-by: David Henningsson <diwic@ubuntu.com>

---
 sound/pci/hda/hda_hwdep.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index a1fc837..0e2cb27 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -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;
 			}
-- 
1.7.0.4


[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH] Ensure codec patch files are checked for the correct codec ID
  2010-06-02 15:02 [PATCH] Ensure codec patch files are checked for the correct codec ID David Henningsson
@ 2010-06-02 16:03 ` Daniel Chen
  2010-06-02 16:40   ` David Henningsson
  2010-07-26  8:22 ` David Henningsson
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel Chen @ 2010-06-02 16:03 UTC (permalink / raw)
  To: David Henningsson; +Cc: alsa-devel

On Wed, Jun 2, 2010 at 11:02 AM, David Henningsson
<launchpad.web@epost.diwic.se> wrote:
> 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

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

* Re: [PATCH] Ensure codec patch files are checked for the correct codec ID
  2010-06-02 16:03 ` Daniel Chen
@ 2010-06-02 16:40   ` David Henningsson
  2010-06-02 17:30     ` Daniel Chen
  0 siblings, 1 reply; 6+ messages in thread
From: David Henningsson @ 2010-06-02 16:40 UTC (permalink / raw)
  To: Daniel Chen; +Cc: alsa-devel

On 2010-06-02 18:03, Daniel Chen wrote:
> On Wed, Jun 2, 2010 at 11:02 AM, David Henningsson
> <launchpad.web@epost.diwic.se> wrote:
>> 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

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

* Re: [PATCH] Ensure codec patch files are checked for the correct codec ID
  2010-06-02 16:40   ` David Henningsson
@ 2010-06-02 17:30     ` Daniel Chen
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Chen @ 2010-06-02 17:30 UTC (permalink / raw)
  To: David Henningsson; +Cc: alsa-devel

On Wed, Jun 2, 2010 at 12:40 PM, David Henningsson
<launchpad.web@epost.diwic.se> wrote:
> 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

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

* [PATCH] Ensure codec patch files are checked for the correct codec ID
  2010-06-02 15:02 [PATCH] Ensure codec patch files are checked for the correct codec ID David Henningsson
  2010-06-02 16:03 ` Daniel Chen
@ 2010-07-26  8:22 ` David Henningsson
  2010-07-26  8:34   ` Takashi Iwai
  1 sibling, 1 reply; 6+ messages in thread
From: David Henningsson @ 2010-07-26  8:22 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

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

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

[-- Attachment #2: 0001-Ensure-codec-patch-files-are-checked-for-the-correct.patch --]
[-- Type: text/x-patch, Size: 955 bytes --]

>From ae4e9f41cf404d879b14be56591c4d5c6b403b71 Mon Sep 17 00:00:00 2001
From: David Henningsson <diwic@ubuntu.com>
Date: Wed, 2 Jun 2010 16:56:41 +0200
Subject: [PATCH] Ensure codec patch files are checked for the correct codec ID
 Signed-off-by: David Henningsson <diwic@ubuntu.com>

---
 sound/pci/hda/hda_hwdep.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index a1fc837..0e2cb27 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -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;
 			}
-- 
1.7.0.4


[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH] Ensure codec patch files are checked for the correct codec ID
  2010-07-26  8:22 ` David Henningsson
@ 2010-07-26  8:34   ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2010-07-26  8:34 UTC (permalink / raw)
  To: David Henningsson; +Cc: alsa-devel

At Mon, 26 Jul 2010 10:22:59 +0200,
David Henningsson wrote:
> 
> 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
> 
> -- 
> David Henningsson, Canonical Ltd.
> http://launchpad.net/~diwic
> [2 0001-Ensure-codec-patch-files-are-checked-for-the-correct.patch <text/x-patch (7bit)>]
> >From ae4e9f41cf404d879b14be56591c4d5c6b403b71 Mon Sep 17 00:00:00 2001
> From: David Henningsson <diwic@ubuntu.com>
> Date: Wed, 2 Jun 2010 16:56:41 +0200
> Subject: [PATCH] Ensure codec patch files are checked for the correct codec ID
>  Signed-off-by: David Henningsson <diwic@ubuntu.com>

Thanks, applied with a slight coding style fix.


Takashi

> 
> ---
>  sound/pci/hda/hda_hwdep.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
> index a1fc837..0e2cb27 100644
> --- a/sound/pci/hda/hda_hwdep.c
> +++ b/sound/pci/hda/hda_hwdep.c
> @@ -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;
>  			}
> -- 
> 1.7.0.4
> 

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

end of thread, other threads:[~2010-07-26  8:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-02 15:02 [PATCH] Ensure codec patch files are checked for the correct codec ID David Henningsson
2010-06-02 16:03 ` Daniel Chen
2010-06-02 16:40   ` David Henningsson
2010-06-02 17:30     ` Daniel Chen
2010-07-26  8:22 ` David Henningsson
2010-07-26  8:34   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.