diff options
author | Takashi Iwai <tiwai@suse.de> | 2021-10-27 14:36:21 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2021-10-27 14:36:21 +0200 |
commit | d43839d46fb24a61d246e168918e2d9025d9fea3 (patch) | |
tree | 1de5b9756033bfa6853c0a938ebba1ad3625f072 | |
parent | 473b6d86baaebfae7e92ddac236011c1dc21f696 (diff) | |
download | hda-emu-d43839d46fb24a61d246e168918e2d9025d9fea3.tar.gz |
Add snd_pci_quirk_lookup_id() wrapper
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | include/sound/core.h | 3 | ||||
-rw-r--r-- | snd-wrapper.c | 35 |
2 files changed, 29 insertions, 9 deletions
diff --git a/include/sound/core.h b/include/sound/core.h index 99ace6d..e7b7813 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -163,6 +163,9 @@ struct snd_pci_quirk { const struct snd_pci_quirk * snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list); +const struct snd_pci_quirk * +snd_pci_quirk_lookup_id(u16 vendor, u16 device, + const struct snd_pci_quirk *list); #define snd_component_add(x,y) diff --git a/snd-wrapper.c b/snd-wrapper.c index 2d2c63c..4863f31 100644 --- a/snd-wrapper.c +++ b/snd-wrapper.c @@ -237,27 +237,44 @@ void snd_iprintf(struct snd_info_buffer *buf, const char *fmt, ...) /* * quirk lookup */ +/** + * snd_pci_quirk_lookup_id - look up a PCI SSID quirk list + * @vendor: PCI SSV id + * @device: PCI SSD id + * @list: quirk list, terminated by a null entry + * + * Look through the given quirk list and finds a matching entry + * with the same PCI SSID. When subdevice is 0, all subdevice + * values may match. + * + * Returns the matched entry pointer, or NULL if nothing matched. + */ const struct snd_pci_quirk * -snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list) +snd_pci_quirk_lookup_id(u16 vendor, u16 device, + const struct snd_pci_quirk *list) { const struct snd_pci_quirk *q; for (q = list; q->subvendor; q++) { - if (q->subvendor != pci->subsystem_vendor) + if (q->subvendor != vendor) continue; -#ifdef NEW_QUIRK_LIST - if (!q->subdevice || - (pci->subsystem_device & q->subdevice_mask) == q->subdevice) - return q; -#else if (!q->subdevice || - q->subdevice == pci->subsystem_device) + (device & q->subdevice_mask) == q->subdevice) return q; -#endif } return NULL; } +const struct snd_pci_quirk * +snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list) +{ + if (!pci) + return NULL; + return snd_pci_quirk_lookup_id(pci->subsystem_vendor, + pci->subsystem_device, + list); +} + #endif /* snd_pci_quirk_lookup */ /* malloc debug */ |