summaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-02 00:09:29 +0100
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 17:26:33 +0200
commite2d4096365e06b9a3799afbadc28b4519c0b3526 (patch)
tree90ec691d71f9c0309048714e359b8ba351b533f7 /drivers/isdn
parentf6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (diff)
downloadlinux-stable-e2d4096365e06b9a3799afbadc28b4519c0b3526.tar.gz
linux-stable-e2d4096365e06b9a3799afbadc28b4519c0b3526.tar.bz2
linux-stable-e2d4096365e06b9a3799afbadc28b4519c0b3526.zip
[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>
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c12
-rw-r--r--drivers/isdn/hisax/avma1_cs.c17
-rw-r--r--drivers/isdn/hisax/elsa_cs.c19
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c18
-rw-r--r--drivers/isdn/hisax/teles_cs.c19
5 files changed, 21 insertions, 64 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 28f9211726c5..7bbfd85ab793 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -127,7 +127,6 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
memset(local, 0, sizeof(local_info_t));
p_dev->priv = local;
- p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return avmcs_config(p_dev);
err:
@@ -145,10 +144,8 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
static void avmcs_detach(struct pcmcia_device *link)
{
- if (link->state & DEV_CONFIG)
avmcs_release(link);
-
- kfree(link->priv);
+ kfree(link->priv);
} /* avmcs_detach */
/*======================================================================
@@ -216,12 +213,8 @@ static int avmcs_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 {
@@ -312,8 +305,7 @@ found_port:
dev->node.major = 64;
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) {
avmcs_release(link);
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 11c7c4f09e7e..ac28e3278ad9 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -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);
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index 4856680ce761..e18e75be8ed3 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -174,7 +174,6 @@ static int elsa_cs_probe(struct pcmcia_device *link)
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
- link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return elsa_cs_config(link);
} /* elsa_cs_attach */
@@ -189,17 +188,14 @@ static int elsa_cs_probe(struct pcmcia_device *link)
static void elsa_cs_detach(struct pcmcia_device *link)
{
- local_info_t *info = link->priv;
+ local_info_t *info = link->priv;
- DEBUG(0, "elsa_cs_detach(0x%p)\n", link);
+ DEBUG(0, "elsa_cs_detach(0x%p)\n", link);
- if (link->state & DEV_CONFIG) {
- info->busy = 1;
- elsa_cs_release(link);
- }
-
- kfree(info);
+ info->busy = 1;
+ elsa_cs_release(link);
+ kfree(info);
} /* elsa_cs_detach */
/*======================================================================
@@ -263,9 +259,6 @@ static int elsa_cs_config(struct pcmcia_device *link)
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;
tuple.Attributes = 0;
@@ -329,8 +322,6 @@ static int elsa_cs_config(struct pcmcia_device *link)
link->io.BasePort2+link->io.NumPorts2-1);
printk("\n");
- link->state &= ~DEV_CONFIG_PENDING;
-
icard.para[0] = link->irq.AssignedIRQ;
icard.para[1] = link->io.BasePort1;
icard.protocol = protocol;
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index a35a29586a62..9bb18f3f7829 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -186,7 +186,6 @@ static int sedlbauer_probe(struct pcmcia_device *link)
link->conf.Attributes = 0;
link->conf.IntType = INT_MEMORY_AND_IO;
- link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return sedlbauer_config(link);
} /* sedlbauer_attach */
@@ -201,15 +200,13 @@ static int sedlbauer_probe(struct pcmcia_device *link)
static void sedlbauer_detach(struct pcmcia_device *link)
{
- DEBUG(0, "sedlbauer_detach(0x%p)\n", link);
+ DEBUG(0, "sedlbauer_detach(0x%p)\n", link);
- if (link->state & DEV_CONFIG) {
- ((local_info_t *)link->priv)->stop = 1;
- sedlbauer_release(link);
- }
+ ((local_info_t *)link->priv)->stop = 1;
+ sedlbauer_release(link);
- /* This points to the parent local_info_t struct */
- kfree(link->priv);
+ /* This points to the parent local_info_t struct */
+ kfree(link->priv);
} /* sedlbauer_detach */
/*======================================================================
@@ -250,9 +247,6 @@ static int sedlbauer_config(struct pcmcia_device *link)
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
-
- /* Configure card */
- link->state |= DEV_CONFIG;
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf));
@@ -408,8 +402,6 @@ static int sedlbauer_config(struct pcmcia_device *link)
printk(", mem 0x%06lx-0x%06lx", req.Base,
req.Base+req.Size-1);
printk("\n");
-
- link->state &= ~DEV_CONFIG_PENDING;
icard.para[0] = link->irq.AssignedIRQ;
icard.para[1] = link->io.BasePort1;
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index 7b66038096f3..afcc2aeadb34 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -164,7 +164,6 @@ static int teles_probe(struct pcmcia_device *link)
link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
- link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return teles_cs_config(link);
} /* teles_attach */
@@ -179,17 +178,14 @@ static int teles_probe(struct pcmcia_device *link)
static void teles_detach(struct pcmcia_device *link)
{
- local_info_t *info = link->priv;
+ local_info_t *info = link->priv;
- DEBUG(0, "teles_detach(0x%p)\n", link);
+ DEBUG(0, "teles_detach(0x%p)\n", link);
- if (link->state & DEV_CONFIG) {
- info->busy = 1;
- teles_cs_release(link);
- }
-
- kfree(info);
+ info->busy = 1;
+ teles_cs_release(link);
+ kfree(info);
} /* teles_detach */
/*======================================================================
@@ -253,9 +249,6 @@ static int teles_cs_config(struct pcmcia_device *link)
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;
tuple.Attributes = 0;
@@ -319,8 +312,6 @@ static int teles_cs_config(struct pcmcia_device *link)
link->io.BasePort2+link->io.NumPorts2-1);
printk("\n");
- link->state &= ~DEV_CONFIG_PENDING;
-
icard.para[0] = link->irq.AssignedIRQ;
icard.para[1] = link->io.BasePort1;
icard.protocol = protocol;