Commit c0c6da72 authored by Russell King's avatar Russell King

[PCMCIA] Fix PCMCIA behaviour on resume with different card.

PCMCIA checks the card CIS against its cached copy.  If it finds
that the card does not match, it destroys the bindings with existing
drivers, issues an remove event followed by an insert event.  However,
ds.c delays the remove event by 100ms, so cardmgr sees the insert
before remove.  It thereby ignores the new card.

Also, we ended up leaving the fake CIS intact, so the new card appears
to be described by the fake CIS.  Destroy the fake CIS in addition to
the CIS cache.
parent e13a55b1
......@@ -331,6 +331,14 @@ void destroy_cis_cache(struct pcmcia_socket *s)
list_del(&cis->node);
kfree(cis);
}
/*
* If there was a fake CIS, destroy that as well.
*/
if (s->fake_cis) {
kfree(s->fake_cis);
s->fake_cis = NULL;
}
}
/*======================================================================
......
......@@ -364,10 +364,6 @@ static void shutdown_socket(struct pcmcia_socket *s)
s->irq.AssignedIRQ = s->irq.Config = 0;
s->lock_count = 0;
destroy_cis_cache(s);
if (s->fake_cis) {
kfree(s->fake_cis);
s->fake_cis = NULL;
}
#ifdef CONFIG_CARDBUS
cb_free(s);
#endif
......@@ -613,10 +609,18 @@ static int socket_resume(struct pcmcia_socket *skt)
* FIXME: need a better check here for cardbus cards.
*/
if (verify_cis_cache(skt) != 0) {
cs_dbg(skt, 4, "cis mismatch - different card\n");
socket_remove_drivers(skt);
destroy_cis_cache(skt);
/*
* Workaround: give DS time to schedule removal.
* Remove me once the 100ms delay is eliminated
* in ds.c
*/
msleep(200);
send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
} else {
cs_dbg(skt, 4, "cis matches cache\n");
send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
}
} else {
......
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