aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-01-14 03:16:52 -0500
committerTakashi Iwai <tiwai@suse.de>2010-01-14 03:18:48 -0500
commitd1458279bf9c575a52fd22818ca19c463f380aba (patch)
tree4e83317ce1a574111efc319e2bb7e75003cecaef /sound/core
parent47e91348459901c30cc1bb4897e62ced21ca243a (diff)
ALSA: Add snd_pci_quirk_lookup_id()
Added a new function to look up a quirk entry with the given PCI SSID instead of a pci device pointer. This can be used when the searched ID is overridden for debugging or such a purpose. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/misc.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/sound/core/misc.c b/sound/core/misc.c
index 23a032c6d487..3da4f92427d8 100644
--- a/sound/core/misc.c
+++ b/sound/core/misc.c
@@ -101,8 +101,9 @@ EXPORT_SYMBOL_GPL(__snd_printk);
101#ifdef CONFIG_PCI 101#ifdef CONFIG_PCI
102#include <linux/pci.h> 102#include <linux/pci.h>
103/** 103/**
104 * snd_pci_quirk_lookup - look up a PCI SSID quirk list 104 * snd_pci_quirk_lookup_id - look up a PCI SSID quirk list
105 * @pci: pci_dev handle 105 * @vendor: PCI SSV id
106 * @device: PCI SSD id
106 * @list: quirk list, terminated by a null entry 107 * @list: quirk list, terminated by a null entry
107 * 108 *
108 * Look through the given quirk list and finds a matching entry 109 * Look through the given quirk list and finds a matching entry
@@ -112,18 +113,39 @@ EXPORT_SYMBOL_GPL(__snd_printk);
112 * Returns the matched entry pointer, or NULL if nothing matched. 113 * Returns the matched entry pointer, or NULL if nothing matched.
113 */ 114 */
114const struct snd_pci_quirk * 115const struct snd_pci_quirk *
115snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list) 116snd_pci_quirk_lookup_id(u16 vendor, u16 device,
117 const struct snd_pci_quirk *list)
116{ 118{
117 const struct snd_pci_quirk *q; 119 const struct snd_pci_quirk *q;
118 120
119 for (q = list; q->subvendor; q++) { 121 for (q = list; q->subvendor; q++) {
120 if (q->subvendor != pci->subsystem_vendor) 122 if (q->subvendor != vendor)
121 continue; 123 continue;
122 if (!q->subdevice || 124 if (!q->subdevice ||
123 (pci->subsystem_device & q->subdevice_mask) == q->subdevice) 125 (device & q->subdevice_mask) == q->subdevice)
124 return q; 126 return q;
125 } 127 }
126 return NULL; 128 return NULL;
127} 129}
130EXPORT_SYMBOL(snd_pci_quirk_lookup_id);
131
132/**
133 * snd_pci_quirk_lookup - look up a PCI SSID quirk list
134 * @pci: pci_dev handle
135 * @list: quirk list, terminated by a null entry
136 *
137 * Look through the given quirk list and finds a matching entry
138 * with the same PCI SSID. When subdevice is 0, all subdevice
139 * values may match.
140 *
141 * Returns the matched entry pointer, or NULL if nothing matched.
142 */
143const struct snd_pci_quirk *
144snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list)
145{
146 return snd_pci_quirk_lookup_id(pci->subsystem_vendor,
147 pci->subsystem_device,
148 list);
149}
128EXPORT_SYMBOL(snd_pci_quirk_lookup); 150EXPORT_SYMBOL(snd_pci_quirk_lookup);
129#endif 151#endif