Skip to contentSkip to conversation

cisinfo_t removal prevents card detection

PATCH In review Marc Zyngier 2 participants 2 messages Jul 15, 2008 Pcmcia

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cisinfo_t removal prevents card detection

Dominik,

The commit

c5081d5f4775b2a3f858f91151bbf9163e473075 (pcmcia: simplify pccard_validate_cis)

that entered mainline yesterday introduced a bug that prevents card detection on my platform (PXA255 based), and possibly others :

@@ -1490,11 +1491,13 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_

              ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff)))
              reserved++;
       }

- if ((info->Chains == MAX_TUPLES) || (reserved > 5) ||
- ((!dev_ok || !ident_ok) && (info->Chains > 10)))
- info->Chains = 0;
+ if ((count) || (reserved > 5) ||
+ ((!dev_ok || !ident_ok) && (count > 10)))
+ count = 0;

Since count starts at 1, condition is now always true, and count then reset to 0. Restoring the comparaison to MAX_TUPLES makes everybody happy...

	M.
drivers/pcmcia/cistpl.c +1 -1
index 9fcff0c..65129b5 100644
@@ -1490,7 +1490,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned
 	    ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff)))
 	    reserved++;
     }
-    if ((count) || (reserved > 5) ||
+    if ((count == MAX_TUPLES) || (reserved > 5) ||
 	((!dev_ok || !ident_ok) && (count > 10)))
 	count = 0;
 
Signature · 1 line
A rat a day keeps the plague away.
#1 lore raw
Quoted 37 lines · Marc Zyngier

Dominik,

The commit

c5081d5f4775b2a3f858f91151bbf9163e473075 (pcmcia: simplify pccard_validate_cis)

that entered mainline yesterday introduced a bug that prevents card detection
on my platform (PXA255 based), and possibly others :

@@ -1490,11 +1491,13 @@ int pccard_validate_cis(struct pcmcia_socket *s,
unsigned int function, cisinfo_

              ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff)))
              reserved++;
       }

- if ((info->Chains == MAX_TUPLES) || (reserved > 5) ||
- ((!dev_ok || !ident_ok) && (info->Chains > 10)))
- info->Chains = 0;
+ if ((count) || (reserved > 5) ||
+ ((!dev_ok || !ident_ok) && (count > 10)))
+ count = 0;

Since count starts at 1, condition is now always true, and count then reset to 0. Restoring the comparaison to MAX_TUPLES makes everybody happy...

	M.
drivers/pcmcia/cistpl.c +0 -0
index 9fcff0c..65129b5 100644
@@ -1490,7 +1490,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, 

unsigned int function, unsigned

drivers/pcmcia/cistpl.c int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned · line 1495

Quoted 7 lines
drivers/pcmcia/cistpl.c +1 -1
 	    ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff)))
 	    reserved++;
     }
-    if ((count) || (reserved > 5) ||
+    if ((count == MAX_TUPLES) || (reserved > 5) ||
 	((!dev_ok || !ident_ok) && (count > 10)))
 	count = 0;

Confirmed: this fixes CF card detection on my SH and MIPS boards. Thanks!

Signature · 1 line
 Manuel Lauss