aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2014-12-10 10:07:14 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-01-12 08:04:12 -0500
commit1c6c9b1d9d2530c346910329751e7fd1a02dc2bd (patch)
tree5a6a4211df883f2891c9fd242d92ac96c87ae103 /drivers/pcmcia
parent8402641b2dc73748dde81e3513ac61c8436be3cb (diff)
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 <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/cistpl.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 8b3b49217287..64d0515b76bd 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -1451,10 +1451,26 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
1451done: 1451done:
1452 /* invalidate CIS cache on failure */ 1452 /* invalidate CIS cache on failure */
1453 if (!dev_ok || !ident_ok || !count) { 1453 if (!dev_ok || !ident_ok || !count) {
1454 mutex_lock(&s->ops_mutex); 1454#if defined(CONFIG_MTD_PCMCIA_ANONYMOUS)
1455 destroy_cis_cache(s); 1455 /* Set up as an anonymous card. If we don't have anonymous
1456 mutex_unlock(&s->ops_mutex); 1456 memory support then just error the card as there is no
1457 ret = -EIO; 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 }
1458 } 1474 }
1459 1475
1460 if (info) 1476 if (info)