Hi Dominik,
here is a fix for the rule to prevent PCMCIA_DEV_ID_MATCH_FUNC_ID entries 
to match on PFC-cards. e.g. serial_cs PCMCIA_DEVICE_FUNC_ID(2)
will match on device 0 of a xircom CEM33 card resulting in a
failure in xirc2ps_cs.
I changed the code, so that the first matching struct pcmcia_device_id
_PFC_ entry will mark the card has_pfc, preventing 
PCMCIA_DEV_ID_MATCH_FUNC_ID to match.

Cheers, Alexander

>From adea8dbc5de871f72572bb0ae5158e91051f6ed5 Mon Sep 17 00:00:00 2001
From: Alexander Kurz <li...@kbdbabel.org>
Date: Sat, 24 Apr 2010 09:49:43 +0200
Subject: [PATCH] pcmcia: fix matching rules for pseudo-multi-function cards,
 prevent PCMCIA_DEV_ID_MATCH_FUNC_ID from grabbing PFC-cards.

Signed-off-by: Alexander Kurz <li...@kbdbabel.org>
CC: linux-pcmcia@lists.infradead.org
---
 drivers/pcmcia/ds.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 4014cf8..6ae35b3 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -828,11 +828,12 @@ static inline int pcmcia_devmatch(struct pcmcia_device 
*dev,
        }
 
        if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) {
-               if (dev->device_no != did->device_no)
-                       return 0;
+               dev_dbg(&dev->dev, "this is a pseudo-multi-function device\n");
                mutex_lock(&dev->socket->ops_mutex);
                dev->socket->pcmcia_state.has_pfc = 1;
                mutex_unlock(&dev->socket->ops_mutex);
+               if (dev->device_no != did->device_no)
+                       return 0;
        }
 
        if (did->match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID) {
@@ -843,7 +844,7 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
 
                /* if this is a pseudo-multi-function device,
                 * we need explicit matches */
-               if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO)
+               if (dev->socket->pcmcia_state.has_pfc)
                        return 0;
                if (dev->device_no)
                        return 0;
-- 
1.7.0


_______________________________________________
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia

Reply via email to