[PATCH] pcmcia: use bitfield instead of p_state and state

Instead of the two status values struct pcmcia_device->p_state and state,
use descriptive bitfields. Most value-checking in drivers was invalid, as
the core now only calls the ->remove() (a.k.a. detach) function in case the
attachement _and_ configuration was successful.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
Dominik Brodowski
2006-03-02 00:09:29 +01:00
parent f6fbe01ac9
commit e2d4096365
49 changed files with 337 additions and 684 deletions

View File

@@ -149,7 +149,6 @@ static int avma1cs_probe(struct pcmcia_device *p_dev)
p_dev->conf.ConfigIndex = 1;
p_dev->conf.Present = PRESENT_OPTION;
p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return avma1cs_config(p_dev);
} /* avma1cs_attach */
@@ -164,12 +163,9 @@ static int avma1cs_probe(struct pcmcia_device *p_dev)
static void avma1cs_detach(struct pcmcia_device *link)
{
DEBUG(0, "avma1cs_detach(0x%p)\n", link);
if (link->state & DEV_CONFIG)
avma1cs_release(link);
kfree(link->priv);
DEBUG(0, "avma1cs_detach(0x%p)\n", link);
avma1cs_release(link);
kfree(link->priv);
} /* avma1cs_detach */
/*======================================================================
@@ -239,12 +235,8 @@ static int avma1cs_config(struct pcmcia_device *link)
} while (0);
if (i != CS_SUCCESS) {
cs_error(link, ParseTuple, i);
link->state &= ~DEV_CONFIG_PENDING;
return -ENODEV;
}
/* Configure card */
link->state |= DEV_CONFIG;
do {
@@ -318,8 +310,7 @@ found_port:
dev->node.major = 45;
dev->node.minor = 0;
link->dev_node = &dev->node;
link->state &= ~DEV_CONFIG_PENDING;
/* If any step failed, release any partially configured state */
if (i != 0) {
avma1cs_release(link);