All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG][PATCH][pcmcia] cisinfo_t removal prevents card detection
@ 2008-07-15 13:26 Marc Zyngier
  2008-07-15 13:36 ` Manuel Lauss
  0 siblings, 1 reply; 2+ messages in thread
From: Marc Zyngier @ 2008-07-15 13:26 UTC (permalink / raw)
  To: Dominik Brodowski, linux-kernel

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.

Signed-off-by: Marc Zyngier <marc.zyngier@altran.com>

diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 9fcff0c..65129b5 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -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;

-- 
A rat a day keeps the plague away.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [BUG][PATCH][pcmcia] cisinfo_t removal prevents card detection
  2008-07-15 13:26 [BUG][PATCH][pcmcia] cisinfo_t removal prevents card detection Marc Zyngier
@ 2008-07-15 13:36 ` Manuel Lauss
  0 siblings, 0 replies; 2+ messages in thread
From: Manuel Lauss @ 2008-07-15 13:36 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: Dominik Brodowski, linux-kernel

On Tue, Jul 15, 2008 at 03:26:15PM +0200, Marc Zyngier wrote:
> 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.
>
> Signed-off-by: Marc Zyngier <marc.zyngier@altran.com>
>
> diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
> index 9fcff0c..65129b5 100644
> --- a/drivers/pcmcia/cistpl.c
> +++ b/drivers/pcmcia/cistpl.c
> @@ -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;

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

-- 
 Manuel Lauss

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-15 13:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-15 13:26 [BUG][PATCH][pcmcia] cisinfo_t removal prevents card detection Marc Zyngier
2008-07-15 13:36 ` Manuel Lauss

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.