Commit e2d40963 authored by Dominik Brodowski's avatar Dominik Brodowski

[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: 's avatarDominik Brodowski <linux@dominikbrodowski.net>
parent f6fbe01a
......@@ -244,7 +244,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
clear_bit(XMIT_WAKEUP, &(info->tx_state));
if (!(info->p_dev->state & DEV_PRESENT))
if (!pcmcia_dev_present(info->p_dev))
return;
if (test_bit(XMIT_BUFFER_NUMBER, &(info->tx_state))) {
......@@ -879,7 +879,6 @@ static int bluecard_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 bluecard_config(link);
}
......@@ -888,9 +887,7 @@ static void bluecard_detach(struct pcmcia_device *link)
{
bluecard_info_t *info = link->priv;
if (link->state & DEV_CONFIG)
bluecard_release(link);
bluecard_release(link);
kfree(info);
}
......@@ -933,9 +930,6 @@ static int bluecard_config(struct pcmcia_device *link)
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
/* Configure card */
link->state |= DEV_CONFIG;
link->conf.ConfigIndex = 0x20;
link->io.NumPorts1 = 64;
link->io.IOAddrLines = 6;
......@@ -969,7 +963,6 @@ static int bluecard_config(struct pcmcia_device *link)
strcpy(info->node.dev_name, info->hdev->name);
link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
return 0;
......@@ -986,8 +979,7 @@ static void bluecard_release(struct pcmcia_device *link)
{
bluecard_info_t *info = link->priv;
if (link->state & DEV_PRESENT)
bluecard_close(info);
bluecard_close(info);
del_timer(&(info->timer));
......
......@@ -195,7 +195,7 @@ static void bt3c_write_wakeup(bt3c_info_t *info)
register struct sk_buff *skb;
register int len;
if (!(info->p_dev->state & DEV_PRESENT))
if (!pcmcia_dev_present(info->p_dev))
break;
......@@ -668,7 +668,6 @@ static int bt3c_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 bt3c_config(link);
}
......@@ -677,9 +676,7 @@ static void bt3c_detach(struct pcmcia_device *link)
{
bt3c_info_t *info = link->priv;
if (link->state & DEV_CONFIG)
bt3c_release(link);
bt3c_release(link);
kfree(info);
}
......@@ -733,9 +730,6 @@ static int bt3c_config(struct pcmcia_device *link)
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
/* Configure card */
link->state |= DEV_CONFIG;
/* First pass: look for a config entry that looks normal. */
tuple.TupleData = (cisdata_t *)buf;
tuple.TupleOffset = 0;
......@@ -805,7 +799,6 @@ found_port:
strcpy(info->node.dev_name, info->hdev->name);
link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
return 0;
......@@ -822,8 +815,7 @@ static void bt3c_release(struct pcmcia_device *link)
{
bt3c_info_t *info = link->priv;
if (link->state & DEV_PRESENT)
bt3c_close(info);
bt3c_close(info);
pcmcia_disable_device(link);
}
......
......@@ -152,7 +152,7 @@ static void btuart_write_wakeup(btuart_info_t *info)
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))))
......@@ -599,7 +599,6 @@ static int btuart_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 btuart_config(link);
}
......@@ -608,9 +607,7 @@ static void btuart_detach(struct pcmcia_device *link)
{
btuart_info_t *info = link->priv;
if (link->state & DEV_CONFIG)
btuart_release(link);
btuart_release(link);
kfree(info);
}
......@@ -664,9 +661,6 @@ static int btuart_config(struct pcmcia_device *link)
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
/* Configure card */
link->state |= DEV_CONFIG;
/* First pass: look for a config entry that looks normal. */
tuple.TupleData = (cisdata_t *) buf;
tuple.TupleOffset = 0;
......@@ -737,7 +731,6 @@ found_port:
strcpy(info->node.dev_name, info->hdev->name);
link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
return 0;
......@@ -754,8 +747,7 @@ static void btuart_release(struct pcmcia_device *link)
{
btuart_info_t *info = link->priv;
if (link->state & DEV_PRESENT)
btuart_close(info);
btuart_close(info);
pcmcia_disable_device(link);
}
......
......@@ -159,7 +159,7 @@ static void dtl1_write_wakeup(dtl1_info_t *info)
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 @@ static int dtl1_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 dtl1_config(link);
}
......@@ -587,8 +586,7 @@ static void dtl1_detach(struct pcmcia_device *link)
{
dtl1_info_t *info = link->priv;
if (link->state & DEV_CONFIG)
dtl1_release(link);
dtl1_release(link);
kfree(info);
}
......@@ -642,9 +640,6 @@ static int dtl1_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;
......@@ -689,7 +684,6 @@ static int dtl1_config(struct pcmcia_device *link)
strcpy(info->node.dev_name, info->hdev->name);
link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
return 0;
......@@ -706,8 +700,7 @@ static void dtl1_release(struct pcmcia_device *link)
{
dtl1_info_t *info = link->priv;
if (link->state & DEV_PRESENT)
dtl1_close(info);
dtl1_close(info);
pcmcia_disable_device(link);
}
......
......@@ -971,7 +971,7 @@ static ssize_t cmm_read(struct file *filp, __user char *buf, size_t count,
if (count == 0) /* according to manpage */
return 0;
if ((dev->p_dev->state & DEV_PRESENT) == 0 || /* socket removed */
if (!pcmcia_dev_present(dev->p_dev) || /* device removed */
test_bit(IS_CMM_ABSENT, &dev->flags))
return -ENODEV;
......@@ -1108,7 +1108,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
sendT0 = dev->proto ? 0 : nr > 5 ? 0x08 : 0;
if ((dev->p_dev->state & DEV_PRESENT) == 0 || /* socket removed */
if (!pcmcia_dev_present(dev->p_dev) || /* device removed */
test_bit(IS_CMM_ABSENT, &dev->flags))
return -ENODEV;
......@@ -1789,7 +1789,6 @@ static int cm4000_config(struct pcmcia_device * link, int devno)
goto cs_failed;
}
link->state |= DEV_CONFIG;
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
......@@ -1844,7 +1843,6 @@ static int cm4000_config(struct pcmcia_device * link, int devno)
dev->node.minor = devno;
dev->node.next = NULL;
link->dev_node = &dev->node;
link->state &= ~DEV_CONFIG_PENDING;
return 0;
......@@ -1852,8 +1850,6 @@ cs_failed:
cs_error(link, fail_fn, fail_rc);
cs_release:
cm4000_release(link);
link->state &= ~DEV_CONFIG_PENDING;
return -ENODEV;
}
......@@ -1913,7 +1909,6 @@ static int cm4000_probe(struct pcmcia_device *link)
init_waitqueue_head(&dev->atrq);
init_waitqueue_head(&dev->readq);
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
ret = cm4000_config(link, i);
if (ret)
return ret;
......@@ -1936,11 +1931,9 @@ static void cm4000_detach(struct pcmcia_device *link)
if (devno == CM4000_MAX_DEV)
return;
link->state &= ~DEV_PRESENT;
stop_monitor(dev);
if (link->state & DEV_CONFIG)
cm4000_release(link);
cm4000_release(link);
dev_table[devno] = NULL;
kfree(dev);
......
......@@ -246,7 +246,7 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf,
return -EAGAIN;
}
if ((dev->p_dev->state & DEV_PRESENT)==0)
if (!pcmcia_dev_present(dev->p_dev))
return -ENODEV;
for (i = 0; i < 5; i++) {
......@@ -351,7 +351,7 @@ static ssize_t cm4040_write(struct file *filp, const char __user *buf,
return -EAGAIN;
}
if ((dev->p_dev->state & DEV_PRESENT) == 0)
if (!pcmcia_dev_present(dev->p_dev))
return -ENODEV;
bytes_to_write = count;
......@@ -543,7 +543,6 @@ static int reader_config(struct pcmcia_device *link, int devno)
goto cs_failed;
}
link->state |= DEV_CONFIG;
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
......@@ -602,9 +601,7 @@ static int reader_config(struct pcmcia_device *link, int devno)
sprintf(dev->node.dev_name, DEVICE_NAME "%d", devno);
dev->node.major = major;
dev->node.minor = devno;
dev->node.next = NULL;
link->dev_node = &dev->node;
link->state &= ~DEV_CONFIG_PENDING;
dev->node.next = &dev->node;
DEBUGP(2, dev, "device " DEVICE_NAME "%d at 0x%.4x-0x%.4x\n", devno,
link->io.BasePort1, link->io.BasePort1+link->io.NumPorts1);
......@@ -616,7 +613,6 @@ cs_failed:
cs_error(link, fail_fn, fail_rc);
cs_release:
reader_release(link);
link->state &= ~DEV_CONFIG_PENDING;
return -ENODEV;
}
......@@ -659,7 +655,6 @@ static int reader_probe(struct pcmcia_device *link)
init_timer(&dev->poll_timer);
dev->poll_timer.function = &cm4040_do_poll;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
ret = reader_config(link, i);
if (ret)
return ret;
......@@ -683,10 +678,7 @@ static void reader_detach(struct pcmcia_device *link)
if (devno == CM_MAX_DEV)
return;
link->state &= ~DEV_PRESENT;
if (link->state & DEV_CONFIG)
reader_release(link);
reader_release(link);
dev_table[devno] = NULL;
kfree(dev);
......
......@@ -578,7 +578,6 @@ static int mgslpc_probe(struct pcmcia_device *link)
link->conf.Attributes = 0;
link->conf.IntType = INT_MEMORY_AND_IO;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
ret = mgslpc_config(link);
if (ret)
return ret;
......@@ -618,9 +617,6 @@ static int mgslpc_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;
/* get CIS configuration entry */
......@@ -681,8 +677,6 @@ static int mgslpc_config(struct pcmcia_device *link)
printk(", io 0x%04x-0x%04x", link->io.BasePort1,
link->io.BasePort1+link->io.NumPorts1-1);
printk("\n");
link->state &= ~DEV_CONFIG_PENDING;
return 0;
cs_failed:
......@@ -697,25 +691,23 @@ cs_failed:
*/
static void mgslpc_release(u_long arg)
{
struct pcmcia_device *link = (struct pcmcia_device *)arg;
struct pcmcia_device *link = (struct pcmcia_device *)arg;
if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgslpc_release(0x%p)\n", link);
if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgslpc_release(0x%p)\n", link);
pcmcia_disable_device(link);
pcmcia_disable_device(link);
}
static void mgslpc_detach(struct pcmcia_device *link)
{
if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgslpc_detach(0x%p)\n", link);
if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgslpc_detach(0x%p)\n", link);
if (link->state & DEV_CONFIG) {
((MGSLPC_INFO *)link->priv)->stop = 1;
mgslpc_release((u_long)link);
}
((MGSLPC_INFO *)link->priv)->stop = 1;
mgslpc_release((u_long)link);
mgslpc_remove_device((MGSLPC_INFO *)link->priv);
mgslpc_remove_device((MGSLPC_INFO *)link->priv);
}
static int mgslpc_suspend(struct pcmcia_device *link)
......@@ -1254,7 +1246,7 @@ static irqreturn_t mgslpc_isr(int irq, void *dev_id, struct pt_regs * regs)
if (!info)
return IRQ_NONE;
if (!(info->p_dev->state & DEV_CONFIG))
if (!(info->p_dev->_locked))
return IRQ_HANDLED;
spin_lock(&info->lock);
......
......@@ -125,7 +125,6 @@ static int ide_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 ide_config(link);
} /* ide_attach */
......@@ -142,8 +141,7 @@ static void ide_detach(struct pcmcia_device *link)
{
DEBUG(0, "ide_detach(0x%p)\n", link);
if (link->state & DEV_CONFIG)
ide_release(link);
ide_release(link);
kfree(link->priv);
} /* ide_detach */
......@@ -209,9 +207,6 @@ static int ide_config(struct pcmcia_device *link)
((stk->parse.manfid.card == PRODID_KME_KXLC005_A) ||
(stk->parse.manfid.card == PRODID_KME_KXLC005_B)));
/* Configure card */
link->state |= DEV_CONFIG;
/* Not sure if this is right... look up the current Vcc */
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf));
......@@ -323,7 +318,6 @@ static int ide_config(struct pcmcia_device *link)
printk(KERN_INFO "ide-cs: %s: Vpp = %d.%d\n",
info->node.dev_name, link->conf.Vpp / 10, link->conf.Vpp % 10);
link->state &= ~DEV_CONFIG_PENDING;
kfree(stk);
return 0;
......@@ -336,7 +330,6 @@ cs_failed:
failed:
kfree(stk);
ide_release(link);
link->state &= ~DEV_CONFIG_PENDING;
return -ENODEV;
} /* ide_config */
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -111,8 +111,8 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
memreq_t mrq;
int ret;
if(!(dev->p_dev->state & DEV_PRESENT)) {
DEBUG(1, "device removed state = 0x%4.4X", dev->p_dev->state);
if (!pcmcia_dev_present(dev->p_dev)) {
DEBUG(1, "device removed");
return 0;
}
......@@ -238,7 +238,7 @@ static void pcmcia_copy_to_remap(struct map_info *map, unsigned long to, const v
/* read/write{8,16} copy_{from,to} routines with direct access */
#define DEV_REMOVED(x) (!(*(u_int *)x->map_priv_1 & DEV_PRESENT))
#define DEV_REMOVED(x) (!(pcmcia_dev_present(((struct pcmciamtd_dev *)map->map_priv_1)->p_dev)))
static map_word pcmcia_read8(struct map_info *map, unsigned long ofs)
{
......@@ -503,9 +503,6 @@ static int pcmciamtd_config(struct pcmcia_device *link)
DEBUG(3, "link=0x%p", link);
/* Configure card */
link->state |= DEV_CONFIG;
DEBUG(2, "Validating CIS");
ret = pcmcia_validate_cis(link, &cisinfo);
if(ret != CS_SUCCESS) {
......@@ -651,7 +648,6 @@ static int pcmciamtd_config(struct pcmcia_device *link)
use the faster non-remapping read/write functions */
if(mtd->size <= dev->win_size) {
DEBUG(1, "Using non remapping memory functions");
dev->pcmcia_map.map_priv_1 = (unsigned long)&(dev->p_dev->state);