]> git.hungrycats.org Git - linux/commitdiff
[PNP]: Card matching code fix
authorAdam Belay <ambx1@neo.rr.com>
Sun, 8 Feb 2004 15:44:15 +0000 (15:44 +0000)
committerAdam Belay <ambx1@neo.rr.com>
Sun, 8 Feb 2004 15:44:15 +0000 (15:44 +0000)
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>.

drivers/pnp/card.c

index 4a0cff353c4661047ede1dec68b9e6bf96bcf269..972ddf0ba8a7093c6a384a63acc131198dcec8b0 100644 (file)
@@ -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;
        while (*drv_id->id){
-               if (compare_pnp_id(card->id,drv_id->id))
-                       return drv_id;
+               if (compare_pnp_id(card->id,drv_id->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++;
        }
        return NULL;