Commit c3b29725 authored by Adam Belay's avatar Adam Belay

[PNP]: Card matching code fix

This patch updates the matching code to ensure that all requested
devices are present on the card, even if they are in use.  It is
necessary for some ALSA drivers to work properly because early vendors
would have different sets of devices on the same card ids.  It is from
Takashi Iwai <tiwai@suse.de>.
parent 9afb885b
...@@ -26,8 +26,25 @@ static const struct pnp_card_device_id * match_card(struct pnp_card_driver * drv ...@@ -26,8 +26,25 @@ static const struct pnp_card_device_id * match_card(struct pnp_card_driver * drv
{ {
const struct pnp_card_device_id * drv_id = drv->id_table; const struct pnp_card_device_id * drv_id = drv->id_table;
while (*drv_id->id){ while (*drv_id->id){
if (compare_pnp_id(card->id,drv_id->id)) if (compare_pnp_id(card->id,drv_id->id)) {
return drv_id; int i = 0;
for (;;) {
int found;
struct pnp_dev *dev;
if (i == PNP_MAX_DEVICES || ! *drv_id->devs[i].id)
return drv_id;
found = 0;
card_for_each_dev(card, dev) {
if (compare_pnp_id(dev->id, drv_id->devs[i].id)) {
found = 1;
break;
}
}
if (! found)
break;
i++;
}
}
drv_id++; drv_id++;
} }
return NULL; return NULL;
......
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