X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fisdn%2Fhisax%2Fteles_cs.c;h=98f8e2848f37fa9579a36fc3ff24f5b0731693dd;hb=9c920a8402f2bb9bd931801d429b65f4eb6a262b;hp=74b89d8a11b37d48357bebc79d11fa1e80835845;hpb=a91482bdcc2e0f6035702e46f1b99043a0893346;p=linux-2.6.git diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 74b89d8a1..98f8e2848 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c @@ -252,6 +252,19 @@ static void teles_detach(dev_link_t *link) if (link->state & DEV_CONFIG) teles_cs_release(link); + /* + If the device is currently configured and active, we won't + actually delete it yet. Instead, it is marked so that when + the release() function is called, that will trigger a proper + detach(). + */ + if (link->state & DEV_CONFIG) { + DEBUG(0, "teles_cs: detach postponed, '%s' " + "still locked\n", link->dev->dev_name); + link->state |= DEV_STALE_LINK; + return; + } + /* Break the link with Card Services */ if (link->handle) { ret = pcmcia_deregister_client(link->handle); @@ -448,6 +461,10 @@ static void teles_cs_release(dev_link_t *link) pcmcia_release_io(link->handle, &link->io); pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; + + if (link->state & DEV_STALE_LINK) + teles_detach(link); + } /* teles_cs_release */ /*======================================================================