Commit 83bf6f11 authored by Alexander Kurz's avatar Alexander Kurz Committed by Dominik Brodowski

pcmcia: fix matching rules for pseudo-multi-function cards

Prevent PCMCIA_DEV_ID_MATCH_FUNC_ID from grabbing PFC-cards:
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.

[linux-pcmcia@lists.infradead.org: re-order commit message]
Signed-off-by: default avatarAlexander Kurz <linux@kbdbabel.org>
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent 04de0816
...@@ -820,11 +820,12 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, ...@@ -820,11 +820,12 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
} }
if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) { if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) {
if (dev->device_no != did->device_no) dev_dbg(&dev->dev, "this is a pseudo-multi-function device\n");
return 0;
mutex_lock(&dev->socket->ops_mutex); mutex_lock(&dev->socket->ops_mutex);
dev->socket->pcmcia_state.has_pfc = 1; dev->socket->pcmcia_state.has_pfc = 1;
mutex_unlock(&dev->socket->ops_mutex); 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) { if (did->match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID) {
...@@ -835,7 +836,7 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, ...@@ -835,7 +836,7 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
/* if this is a pseudo-multi-function device, /* if this is a pseudo-multi-function device,
* we need explicit matches */ * we need explicit matches */
if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) if (dev->socket->pcmcia_state.has_pfc)
return 0; return 0;
if (dev->device_no) if (dev->device_no)
return 0; return 0;
......
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