From: Adam Belay <ambx1@neo.rr.com>

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 |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff -puN drivers/pnp/card.c~pnp-update-matching-code drivers/pnp/card.c
--- 25/drivers/pnp/card.c~pnp-update-matching-code	2004-01-29 22:40:35.000000000 -0800
+++ 25-akpm/drivers/pnp/card.c	2004-01-29 22:40:35.000000000 -0800
@@ -26,8 +26,25 @@ static const struct pnp_card_device_id *
 {
 	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;

_