Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Kailang <kailang@realtek.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: Update patch for codecs alias name for Dell
Date: Wed, 27 Nov 2013 11:51:55 +0100	[thread overview]
Message-ID: <s5hhaay6rsk.wl%tiwai@suse.de> (raw)
In-Reply-To: <8837DB3485424EB4ADE016301C6D7DF6@realtek.com.tw>

At Wed, 27 Nov 2013 18:01:03 +0800,
Kailang wrote:
> 
> Hi Takashi,
> 
> Dell assigned more codecs for alias name.
> I update in attach patch.

It's better to handle the error immediately, i.e. put
  if (err < 0)
    goto error;
just after each alc_codec_rename() call.

Or, it's even better to introduce a table like

struct alc_codec_rename_pci_table {
	unsigned int codec_vendor;
	unsigned short pci_subvendor;
	unsigned short pci_subdevice;
	const char *name;
};

static struct alc_codec_rename_table rename_pci_tbl[] = {
	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
	{ 0x10280284, 0x1028, 0, "ALC3226" },
	.....
	{ } /* terminator */
};

Then add a check like:

static int alc_codec_rename_from_preset(struct hda_codec *codec)
{
	const struct alc_codec_rename_table *p;
	const struct alc_codec_rename_pci_table *q;

	.....

	for (q = rename_pci_tbl; q->codec_vendor; q++) {
		if (q->vendor_id != codec->vendor_id)
			continue;
		if (q->pci_subsystem != codec->bus->pci->subsystem_vendor)
			continue;
		if (!q->pci_subdevice ||
		    q->pci_subdevice == codec->bus->pci->subsystem_device)
			return alc_codec_rename(codec, q->name);
	}

	return 0;
}


thanks,

Takashi

  reply	other threads:[~2013-11-27 10:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 10:01 Update patch for codecs alias name for Dell Kailang
2013-11-27 10:51 ` Takashi Iwai [this message]
2013-11-28  7:30   ` Kailang
2013-11-28 10:56     ` Takashi Iwai
2014-02-02  0:20       ` Chris M
2014-02-18 21:31         ` Chris M
2014-02-21 14:54           ` Takashi Iwai
2014-03-05  7:16             ` Chris M

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hhaay6rsk.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=kailang@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox