From c3b297259f777e5bd6065e3e33e98da268113da0 Mon Sep 17 00:00:00 2001 From: Adam Belay Date: Sun, 8 Feb 2004 15:44:15 +0000 Subject: [PATCH] [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 . --- drivers/pnp/card.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c index 4a0cff353c466..972ddf0ba8a70 100644 --- a/drivers/pnp/card.c +++ b/drivers/pnp/card.c @@ -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; -- 2.53.0