Skip to content

Commit 1c6c9b1

Browse files
Alan Coxgregkh
authored andcommitted
pcmcia: handle anonymous cards by generating a fake CIS
The core pcmcia code blows up all over the place if it allowed a card without a valid CIS. We need to allow such cards as the CIS stuff is not on the older flash, ROM and SRAM cards. In order to minimise the risk of misidentifying junk and feeding it to the wrong thing we only fix up apparently anonymous cards if the driver for them has been enabled. Signed-off-by: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8402641 commit 1c6c9b1

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

drivers/pcmcia/cistpl.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,10 +1451,26 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
14511451
done:
14521452
/* invalidate CIS cache on failure */
14531453
if (!dev_ok || !ident_ok || !count) {
1454-
mutex_lock(&s->ops_mutex);
1455-
destroy_cis_cache(s);
1456-
mutex_unlock(&s->ops_mutex);
1457-
ret = -EIO;
1454+
#if defined(CONFIG_MTD_PCMCIA_ANONYMOUS)
1455+
/* Set up as an anonymous card. If we don't have anonymous
1456+
memory support then just error the card as there is no
1457+
point trying to second guess.
1458+
1459+
Note: some cards have just a device entry, it may be
1460+
worth extending support to cover these in future */
1461+
if (!dev_ok || !ident_ok) {
1462+
dev_info(&s->dev, "no CIS, assuming an anonymous memory card.\n");
1463+
pcmcia_replace_cis(s, "\xFF", 1);
1464+
count = 1;
1465+
ret = 0;
1466+
} else
1467+
#endif
1468+
{
1469+
mutex_lock(&s->ops_mutex);
1470+
destroy_cis_cache(s);
1471+
mutex_unlock(&s->ops_mutex);
1472+
ret = -EIO;
1473+
}
14581474
}
14591475

14601476
if (info)

0 commit comments

Comments
 (0)