From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: Update patch for codecs alias name for Dell Date: Wed, 27 Nov 2013 11:51:55 +0100 Message-ID: References: <8837DB3485424EB4ADE016301C6D7DF6@realtek.com.tw> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 34BC72652BF for ; Wed, 27 Nov 2013 11:51:56 +0100 (CET) In-Reply-To: <8837DB3485424EB4ADE016301C6D7DF6@realtek.com.tw> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Kailang Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org 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