Commit e2b6d13b authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] nm256 - Use quirk list helper function

Clean up nm256-quirk lookup using snd_pci_quirk_lookup().
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent f41bea84
...@@ -1628,23 +1628,15 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci, ...@@ -1628,23 +1628,15 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
} }
struct nm256_quirk {
unsigned short vendor;
unsigned short device;
int type;
};
enum { NM_BLACKLISTED, NM_RESET_WORKAROUND, NM_RESET_WORKAROUND_2 }; enum { NM_BLACKLISTED, NM_RESET_WORKAROUND, NM_RESET_WORKAROUND_2 };
static struct nm256_quirk nm256_quirks[] __devinitdata = { static struct snd_pci_quirk nm256_quirks[] __devinitdata = {
/* HP omnibook 4150 has cs4232 codec internally */ /* HP omnibook 4150 has cs4232 codec internally */
{ .vendor = 0x103c, .device = 0x0007, .type = NM_BLACKLISTED }, SND_PCI_QUIRK(0x103c, 0x0007, "HP omnibook 4150", NM_BLACKLISTED),
/* Sony PCG-F305 */ /* Reset workarounds to avoid lock-ups */
{ .vendor = 0x104d, .device = 0x8041, .type = NM_RESET_WORKAROUND }, SND_PCI_QUIRK(0x104d, 0x8041, "Sony PCG-F305", NM_RESET_WORKAROUND),
/* Dell Latitude LS */ SND_PCI_QUIRK(0x1028, 0x0080, "Dell Latitude LS", NM_RESET_WORKAROUND),
{ .vendor = 0x1028, .device = 0x0080, .type = NM_RESET_WORKAROUND }, SND_PCI_QUIRK(0x1028, 0x0091, "Dell Latitude CSx", NM_RESET_WORKAROUND_2),
/* Dell Latitude CSx */
{ .vendor = 0x1028, .device = 0x0091, .type = NM_RESET_WORKAROUND_2 },
{ } /* terminator */ { } /* terminator */
}; };
...@@ -1655,26 +1647,22 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci, ...@@ -1655,26 +1647,22 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci,
struct snd_card *card; struct snd_card *card;
struct nm256 *chip; struct nm256 *chip;
int err; int err;
struct nm256_quirk *q; const struct snd_pci_quirk *q;
u16 subsystem_vendor, subsystem_device;
q = snd_pci_quirk_lookup(pci, nm256_quirks);
pci_read_config_word(pci, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vendor); if (q) {
pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &subsystem_device); snd_printdd(KERN_INFO "nm256: Enabled quirk for %s.\n", q->name);
switch (q->value) {
for (q = nm256_quirks; q->vendor; q++) { case NM_BLACKLISTED:
if (q->vendor == subsystem_vendor && q->device == subsystem_device) { printk(KERN_INFO "nm256: The device is blacklisted. "
switch (q->type) { "Loading stopped\n");
case NM_BLACKLISTED: return -ENODEV;
printk(KERN_INFO "nm256: The device is blacklisted. " case NM_RESET_WORKAROUND_2:
"Loading stopped\n"); reset_workaround_2 = 1;
return -ENODEV; /* Fall-through */
case NM_RESET_WORKAROUND_2: case NM_RESET_WORKAROUND:
reset_workaround_2 = 1; reset_workaround = 1;
/* Fall-through */ break;
case NM_RESET_WORKAROUND:
reset_workaround = 1;
break;
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment