[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>

diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 0ec7fd4..a71a240 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -159,7 +159,7 @@
 
 		clear_bit(XMIT_WAKEUP, &(info->tx_state));
 
-		if (!(info->p_dev->state & DEV_PRESENT))
+		if (!pcmcia_dev_present(info->p_dev))
 			return;
 
 		if (!(skb = skb_dequeue(&(info->txq))))
@@ -578,7 +578,6 @@
 	link->conf.Attributes = CONF_ENABLE_IRQ;
 	link->conf.IntType = INT_MEMORY_AND_IO;
 
-	link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
 	return dtl1_config(link);
 }
 
@@ -587,8 +586,7 @@
 {
 	dtl1_info_t *info = link->priv;
 
-	if (link->state & DEV_CONFIG)
-		dtl1_release(link);
+	dtl1_release(link);
 
 	kfree(info);
 }
@@ -642,9 +640,6 @@
 	link->conf.ConfigBase = parse.config.base;
 	link->conf.Present = parse.config.rmask[0];
 
-	/* Configure card */
-	link->state |= DEV_CONFIG;
-
 	tuple.TupleData = (cisdata_t *)buf;
 	tuple.TupleOffset = 0;
 	tuple.TupleDataMax = 255;
@@ -689,7 +684,6 @@
 
 	strcpy(info->node.dev_name, info->hdev->name);
 	link->dev_node = &info->node;
-	link->state &= ~DEV_CONFIG_PENDING;
 
 	return 0;
 
@@ -706,8 +700,7 @@
 {
 	dtl1_info_t *info = link->priv;
 
-	if (link->state & DEV_PRESENT)
-		dtl1_close(info);
+	dtl1_close(info);
 
 	pcmcia_disable_device(link);
 }