From: Takashi Iwai <tiwai@suse.de> To: alsa-devel@alsa-project.org Subject: [PATCH 2/3] ALSA: hda/realtek - Allow NULL bus->pci Date: Sat, 15 Feb 2014 10:17:34 +0100 [thread overview] Message-ID: <1392455855-10594-2-git-send-email-tiwai@suse.de> (raw) In-Reply-To: <1392455855-10594-1-git-send-email-tiwai@suse.de> Realtek codec driver contains some codes referring to the PCI subdevice IDs, but most of them are optional, typically for checking the codec name variants. Add NULL checks appropriately so that it can work without PCI assignment. Signed-off-by: Takashi Iwai <tiwai@suse.de> --- sound/pci/hda/patch_realtek.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 86857b674302..c5405f319cfe 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -395,6 +395,8 @@ static int alc_auto_parse_customize_define(struct hda_codec *codec) goto do_sku; } + if (!codec->bus->pci) + return -1; ass = codec->subsystem_id & 0xffff; if (ass != codec->bus->pci->subsystem_device && (ass & 1)) goto do_sku; @@ -483,7 +485,8 @@ static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) } ass = codec->subsystem_id & 0xffff; - if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) + if (codec->bus->pci && + ass != codec->bus->pci->subsystem_device && (ass & 1)) goto do_sku; /* invalid SSID, check the special NID pin defcfg instead */ @@ -966,6 +969,8 @@ static int alc_codec_rename_from_preset(struct hda_codec *codec) return alc_codec_rename(codec, p->name); } + if (!codec->bus->pci) + return 0; for (q = rename_pci_tbl; q->codec_vendor_id; q++) { if (q->codec_vendor_id != codec->vendor_id) continue; @@ -4502,13 +4507,15 @@ static int patch_alc269(struct hda_codec *codec) spec->codec_variant = ALC269_TYPE_ALC269VA; switch (alc_get_coef0(codec) & 0x00f0) { case 0x0010: - if (codec->bus->pci->subsystem_vendor == 0x1025 && + if (codec->bus->pci && + codec->bus->pci->subsystem_vendor == 0x1025 && spec->cdefine.platform_type == 1) err = alc_codec_rename(codec, "ALC271X"); spec->codec_variant = ALC269_TYPE_ALC269VB; break; case 0x0020: - if (codec->bus->pci->subsystem_vendor == 0x17aa && + if (codec->bus->pci && + codec->bus->pci->subsystem_vendor == 0x17aa && codec->bus->pci->subsystem_device == 0x21f3) err = alc_codec_rename(codec, "ALC3202"); spec->codec_variant = ALC269_TYPE_ALC269VC; @@ -5309,7 +5316,7 @@ static int patch_alc662(struct hda_codec *codec) spec->gen.beep_nid = 0x01; if ((alc_get_coef0(codec) & (1 << 14)) && - codec->bus->pci->subsystem_vendor == 0x1025 && + codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && spec->cdefine.platform_type == 1) { err = alc_codec_rename(codec, "ALC272X"); if (err < 0) -- 1.8.5.2
next prev parent reply other threads:[~2014-02-15 9:17 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-02-15 9:17 [PATCH 1/3] ALSA: hda - Remove dependency on bus->pci in hda_beep.c Takashi Iwai 2014-02-15 9:17 ` Takashi Iwai [this message] 2014-02-15 9:17 ` [PATCH 3/3] ALSA: hda - Remove superfluous inclusion of linux/pci.h Takashi Iwai 2014-02-15 9:22 ` [PATCH 1/3] ALSA: hda - Remove dependency on bus->pci in hda_beep.c Takashi Iwai 2014-02-18 18:04 ` Stephen Warren 2014-02-18 18:20 ` Dylan Reid 2014-02-19 8:33 ` Takashi Iwai 2014-02-19 15:16 ` Dylan Reid 2014-02-27 12:03 ` Takashi Iwai 2014-02-27 16:44 ` Dylan Reid 2014-02-27 16:57 ` Takashi Iwai 2014-02-27 17:32 ` Dylan Reid 2014-02-27 20:10 ` Takashi Iwai 2014-02-27 20:41 ` Dylan Reid
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=1392455855-10594-2-git-send-email-tiwai@suse.de \ --to=tiwai@suse.de \ --cc=alsa-devel@alsa-project.org \ --subject='Re: [PATCH 2/3] ALSA: hda/realtek - Allow NULL bus->pci' \ /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
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.