Browse Source

[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>
imx_3.10.17_1.0.0_ga
Dominik Brodowski 15 years ago
parent
commit
e2d4096365
49 changed files with 335 additions and 682 deletions
  1. +3
    -11
      drivers/bluetooth/bluecard_cs.c
  2. +3
    -11
      drivers/bluetooth/bt3c_cs.c
  3. +3
    -11
      drivers/bluetooth/btuart_cs.c
  4. +3
    -10
      drivers/bluetooth/dtl1_cs.c
  5. +3
    -10
      drivers/char/pcmcia/cm4000_cs.c
  6. +4
    -12
      drivers/char/pcmcia/cm4040_cs.c
  7. +10
    -18
      drivers/char/pcmcia/synclink_cs.c
  8. +1
    -8
      drivers/ide/legacy/ide-cs.c
  9. +2
    -10
      drivers/isdn/hardware/avm/avm_cs.c
  10. +4
    -13
      drivers/isdn/hisax/avma1_cs.c
  11. +5
    -14
      drivers/isdn/hisax/elsa_cs.c
  12. +5
    -13
      drivers/isdn/hisax/sedlbauer_cs.c
  13. +5
    -14
      drivers/isdn/hisax/teles_cs.c
  14. +10
    -17
      drivers/mtd/maps/pcmciamtd.c
  15. +3
    -9
      drivers/net/pcmcia/3c574_cs.c
  16. +3
    -9
      drivers/net/pcmcia/3c589_cs.c
  17. +4
    -11
      drivers/net/pcmcia/axnet_cs.c
  18. +3
    -9
      drivers/net/pcmcia/com20020_cs.c
  19. +3
    -10
      drivers/net/pcmcia/fmvj18x_cs.c
  20. +4
    -10
      drivers/net/pcmcia/ibmtr_cs.c
  21. +3
    -10
      drivers/net/pcmcia/nmclan_cs.c
  22. +3
    -10
      drivers/net/pcmcia/pcnet_cs.c
  23. +25
    -34
      drivers/net/pcmcia/smc91c92_cs.c
  24. +5
    -13
      drivers/net/pcmcia/xirc2ps_cs.c
  25. +4
    -12
      drivers/net/wireless/airo_cs.c
  26. +8
    -17
      drivers/net/wireless/atmel_cs.c
  27. +24
    -32
      drivers/net/wireless/hostap/hostap_cs.c
  28. +3
    -9
      drivers/net/wireless/netwave_cs.c
  29. +30
    -40
      drivers/net/wireless/orinoco_cs.c
  30. +23
    -30
      drivers/net/wireless/ray_cs.c
  31. +14
    -23
      drivers/net/wireless/spectrum_cs.c
  32. +5
    -19
      drivers/net/wireless/wavelan_cs.c
  33. +6
    -13
      drivers/net/wireless/wl3501_cs.c
  34. +1
    -8
      drivers/parport/parport_cs.c
  35. +1
    -1
      drivers/pcmcia/cs_internal.h
  36. +19
    -22
      drivers/pcmcia/ds.c
  37. +3
    -1
      drivers/pcmcia/pcmcia_ioctl.c
  38. +12
    -12
      drivers/pcmcia/pcmcia_resource.c
  39. +1
    -7
      drivers/scsi/pcmcia/aha152x_stub.c
  40. +2
    -9
      drivers/scsi/pcmcia/fdomain_stub.c
  41. +2
    -21
      drivers/scsi/pcmcia/nsp_cs.c
  42. +12
    -21
      drivers/scsi/pcmcia/qlogic_stub.c
  43. +13
    -22
      drivers/scsi/pcmcia/sym53c500_cs.c
  44. +9
    -26
      drivers/serial/serial_cs.c
  45. +1
    -5
      drivers/telephony/ixj_pcmcia.c
  46. +1
    -10
      drivers/usb/host/sl811_cs.c
  47. +24
    -16
      include/pcmcia/ds.h
  48. +0
    -4
      sound/pcmcia/pdaudiocf/pdaudiocf.c
  49. +0
    -5
      sound/pcmcia/vx/vxpocket.c

+ 3
- 11
drivers/bluetooth/bluecard_cs.c View File

@ -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));


+ 3
- 11
drivers/bluetooth/bt3c_cs.c View File

@ -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);
}


+ 3
- 11
drivers/bluetooth/btuart_cs.c View File

@ -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);
}


+ 3
- 10
drivers/bluetooth/dtl1_cs.c View File

@ -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);
}


+ 3
- 10
drivers/char/pcmcia/cm4000_cs.c View File

@ -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);


+ 4
- 12
drivers/char/pcmcia/cm4040_cs.c View File

@ -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);


+ 10
- 18
drivers/char/pcmcia/synclink_cs.c View File

@ -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);


+ 1
- 8
drivers/ide/legacy/ide-cs.c View File

@ -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 */


+ 2
- 10
drivers/isdn/hardware/avm/avm_cs.c View File

@ -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);


+ 4
- 13
drivers/isdn/hisax/avma1_cs.c 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);


+ 5
- 14
drivers/isdn/hisax/elsa_cs.c View File

@ -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;


+ 5
- 13
drivers/isdn/hisax/sedlbauer_cs.c View File

@ -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;


+ 5
- 14
drivers/isdn/hisax/teles_cs.c View File

@ -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;


+ 10
- 17
drivers/mtd/maps/pcmciamtd.c View File

@ -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);
dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base;
if (dev->pcmcia_map.bankwidth == 1) {
dev->pcmcia_map.read = pcmcia_read8;
@ -673,7 +669,6 @@ static int pcmciamtd_config(struct pcmcia_device *link)
}
snprintf(dev->node.dev_name, sizeof(dev->node.dev_name), "mtd%d", mtd->index);
info("mtd%d: %s", mtd->index, mtd->name);
link->state &= ~DEV_CONFIG_PENDING;
link->dev_node = &dev->node;
return 0;
@ -712,17 +707,16 @@ static int pcmciamtd_resume(struct pcmcia_device *dev)
static void pcmciamtd_detach(struct pcmcia_device *link)
{
DEBUG(3, "link=0x%p", link);
struct pcmciamtd_dev *dev = link->priv;
if(link->state & DEV_CONFIG) {
struct pcmciamtd_dev *dev = link->priv;
if(dev->mtd_info) {
del_mtd_device(dev->mtd_info);
info("mtd%d: Removed", dev->mtd_info->index);
}
DEBUG(3, "link=0x%p", link);
pcmciamtd_release(link);
if(dev->mtd_info) {
del_mtd_device(dev->mtd_info);
info("mtd%d: Removed", dev->mtd_info->index);
}
pcmciamtd_release(link);
}
@ -747,7 +741,6 @@ static int pcmciamtd_probe(struct pcmcia_device *link)
link->conf.Attributes = 0;
link->conf.IntType = INT_MEMORY;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return pcmciamtd_config(link);
}


+ 3
- 9
drivers/net/pcmcia/3c574_cs.c View File

@ -296,7 +296,6 @@ static int tc574_probe(struct pcmcia_device *link)
dev->watchdog_timeo = TX_TIMEOUT;
#endif
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return tc574_config(link);
} /* tc574_attach */
@ -318,8 +317,7 @@ static void tc574_detach(struct pcmcia_device *link)
if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
tc574_release(link);
tc574_release(link);
free_netdev(dev);
} /* tc574_detach */
@ -363,9 +361,6 @@ static int tc574_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->io.IOAddrLines = 16;
for (i = j = 0; j < 0x400; j += 0x20) {
link->io.BasePort1 = j ^ 0x300;
@ -464,7 +459,6 @@ static int tc574_config(struct pcmcia_device *link)
}
}
link->state &= ~DEV_CONFIG_PENDING;
link->dev_node = &lp->node;
SET_NETDEV_DEV(dev, &handle_to_dev(link));
@ -509,7 +503,7 @@ static int tc574_suspend(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open))
if (link->open)
netif_device_detach(dev);
return 0;
@ -519,7 +513,7 @@ static int tc574_resume(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) {
if (link->open) {
tc574_reset(dev);
netif_device_attach(dev);
}


+ 3
- 9
drivers/net/pcmcia/3c589_cs.c View File

@ -211,7 +211,6 @@ static int tc589_probe(struct pcmcia_device *link)
#endif
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return tc589_config(link);
} /* tc589_attach */
@ -233,8 +232,7 @@ static void tc589_detach(struct pcmcia_device *link)
if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
tc589_release(link);
tc589_release(link);
free_netdev(dev);
} /* tc589_detach */
@ -285,9 +283,6 @@ static int tc589_config(struct pcmcia_device *link)
"3Com card??\n");
multi = (le16_to_cpu(buf[1]) == PRODID_3COM_3C562);
}
/* Configure card */
link->state |= DEV_CONFIG;
/* For the 3c562, the base address must be xx00-xx7f */
link->io.IOAddrLines = 16;
@ -338,7 +333,6 @@ static int tc589_config(struct pcmcia_device *link)
printk(KERN_ERR "3c589_cs: invalid if_port requested\n");
link->dev_node = &lp->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(link));
if (register_netdev(dev) != 0) {
@ -383,7 +377,7 @@ static int tc589_suspend(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open))
if (link->open)
netif_device_detach(dev);
return 0;
@ -393,7 +387,7 @@ static int tc589_resume(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) {
if (link->open) {
tc589_reset(dev);
netif_device_attach(dev);
}


+ 4
- 11
drivers/net/pcmcia/axnet_cs.c View File

@ -168,7 +168,6 @@ static int axnet_probe(struct pcmcia_device *link)
dev->do_ioctl = &axnet_ioctl;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return axnet_config(link);
} /* axnet_attach */
@ -190,8 +189,7 @@ static void axnet_detach(struct pcmcia_device *link)
if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
axnet_release(link);
axnet_release(link);
free_netdev(dev);
} /* axnet_detach */
@ -309,9 +307,6 @@ static int axnet_config(struct pcmcia_device *link)
/* don't trust the CIS on this; Linksys got it wrong */
link->conf.Present = 0x63;
/* Configure card */
link->state |= DEV_CONFIG;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
tuple.Attributes = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
@ -402,7 +397,6 @@ static int axnet_config(struct pcmcia_device *link)
info->phy_id = (i < 32) ? i : -1;
link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(link));
if (register_netdev(dev) != 0) {
@ -429,7 +423,6 @@ cs_failed:
cs_error(link, last_fn, last_ret);
failed:
axnet_release(link);
link->state &= ~DEV_CONFIG_PENDING;
return -ENODEV;
} /* axnet_config */
@ -450,8 +443,8 @@ static int axnet_suspend(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open))
netif_device_detach(dev);
if (link->open)
netif_device_detach(dev);
return 0;
}
@ -460,7 +453,7 @@ static int axnet_resume(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) {
if (link->open) {
axnet_reset_8390(dev);
AX88190_init(dev, 1);
netif_device_attach(dev);


+ 3
- 9
drivers/net/pcmcia/com20020_cs.c View File

@ -178,7 +178,6 @@ static int com20020_probe(struct pcmcia_device *p_dev)
p_dev->irq.Instance = info->dev = dev;
p_dev->priv = info;
p_dev->state |= DEV_PRESENT;
return com20020_config(p_dev);
fail_alloc_dev:
@ -218,8 +217,7 @@ static void com20020_detach(struct pcmcia_device *link)
free_irq(dev->irq, dev);
}
if (link->state & DEV_CONFIG)
com20020_release(link);
com20020_release(link);
/* Unlink device structure, free bits */
DEBUG(1,"unlinking...\n");
@ -276,9 +274,6 @@ static int com20020_config(struct pcmcia_device *link)
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
/* Configure card */
link->state |= DEV_CONFIG;
DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1);
i = !CS_SUCCESS;
if (!link->io.BasePort1)
@ -328,7 +323,6 @@ static int com20020_config(struct pcmcia_device *link)
lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */
link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(link));
i = com20020_found(dev, 0); /* calls register_netdev */
@ -372,7 +366,7 @@ static int com20020_suspend(struct pcmcia_device *link)
com20020_dev_t *info = link->priv;
struct net_device *dev = info->dev;
if ((link->state & DEV_CONFIG) && (link->open))
if (link->open)
netif_device_detach(dev);
return 0;
@ -383,7 +377,7 @@ static int com20020_resume(struct pcmcia_device *link)
com20020_dev_t *info = link->priv;
struct net_device *dev = info->dev;
if ((link->state & DEV_CONFIG) && (link->open)) {
if (link->open) {
int ioaddr = dev->base_addr;
struct arcnet_local *lp = dev->priv;
ARCRESET;


+ 3
- 10
drivers/net/pcmcia/fmvj18x_cs.c View File

@ -272,7 +272,6 @@ static int fmvj18x_probe(struct pcmcia_device *link)
#endif
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return fmvj18x_config(link);
} /* fmvj18x_attach */
@ -287,8 +286,7 @@ static void fmvj18x_detach(struct pcmcia_device *link)
if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
fmvj18x_release(link);
fmvj18x_release(link);
free_netdev(dev);
} /* fmvj18x_detach */
@ -363,9 +361,6 @@ static int fmvj18x_config(struct pcmcia_device *link)
tuple.TupleOffset = 0;
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
/* Configure card */
link->state |= DEV_CONFIG;
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
@ -532,7 +527,6 @@ static int fmvj18x_config(struct pcmcia_device *link)
lp->cardtype = cardtype;
link->dev_node = &lp->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(link));
if (register_netdev(dev) != 0) {
@ -557,7 +551,6 @@ cs_failed:
cs_error(link, last_fn, last_ret);
failed:
fmvj18x_release(link);
link->state &= ~DEV_CONFIG_PENDING;
return -ENODEV;
} /* fmvj18x_config */
/*====================================================================*/
@ -668,7 +661,7 @@ static int fmvj18x_suspend(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open))
if (link->open)
netif_device_detach(dev);
return 0;
@ -678,7 +671,7 @@ static int fmvj18x_resume(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) {
if (link->open) {
fjn_reset(dev);
netif_device_attach(dev);
}


+ 4
- 10
drivers/net/pcmcia/ibmtr_cs.c View File

@ -173,7 +173,6 @@ static int ibmtr_attach(struct pcmcia_device *link)
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
link->state |= DEV_PRESENT;
return ibmtr_config(link);
} /* ibmtr_attach */
@ -200,8 +199,8 @@ static void ibmtr_detach(struct pcmcia_device *link)
struct tok_info *ti = netdev_priv(dev);
del_timer_sync(&(ti->tr_timer));
}
if (link->state & DEV_CONFIG)
ibmtr_release(link);
ibmtr_release(link);
free_netdev(dev);
kfree(info);
@ -241,10 +240,6 @@ static int ibmtr_config(struct pcmcia_device *link)
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
/* Configure card */
link->state |= DEV_CONFIG;
link->conf.ConfigIndex = 0x61;
/* Determine if this is PRIMARY or ALTERNATE. */
@ -301,7 +296,6 @@ static int ibmtr_config(struct pcmcia_device *link)
ibmtr_hw_setup(dev, mmiobase);
link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(link));
i = ibmtr_probe_card(dev);
@ -358,7 +352,7 @@ static int ibmtr_suspend(struct pcmcia_device *link)
ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev;
if ((link->state & DEV_CONFIG) && (link->open))
if (link->open)
netif_device_detach(dev);
return 0;
@ -369,7 +363,7 @@ static int ibmtr_resume(struct pcmcia_device *link)
ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev;
if ((link->state & DEV_CONFIG) && (link->open)) {
if (link->open) {
ibmtr_probe(dev); /* really? */
netif_device_attach(dev);
}


+ 3
- 10
drivers/net/pcmcia/nmclan_cs.c View File

@ -487,7 +487,6 @@ static int nmclan_probe(struct pcmcia_device *link)
dev->watchdog_timeo = TX_TIMEOUT;
#endif
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return nmclan_config(link);
} /* nmclan_attach */
@ -508,8 +507,7 @@ static void nmclan_detach(struct pcmcia_device *link)
if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
nmclan_release(link);
nmclan_release(link);
free_netdev(dev);
} /* nmclan_detach */
@ -675,9 +673,6 @@ static int nmclan_config(struct pcmcia_device *link)
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
/* Configure card */
link->state |= DEV_CONFIG;
CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
@ -707,7 +702,6 @@ static int nmclan_config(struct pcmcia_device *link)
} else {
printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should"
" be 0x40 0x?9\n", sig[0], sig[1]);
link->state &= ~DEV_CONFIG_PENDING;
return -ENODEV;
}
}
@ -722,7 +716,6 @@ static int nmclan_config(struct pcmcia_device *link)
printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n");
link->dev_node = &lp->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(link));
i = register_netdev(dev);
@ -763,7 +756,7 @@ static int nmclan_suspend(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open))
if (link->open)
netif_device_detach(dev);
return 0;
@ -773,7 +766,7 @@ static int nmclan_resume(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
if ((link->state & DEV_CONFIG) && (link->open)) {
if (link->open) {
nmclan_reset(dev);
netif_device_attach(dev);
}


+ 3
- 10
drivers/net/pcmcia/pcnet_cs.c View File

@ -264,7 +264,6 @@ static int pcnet_probe(struct pcmcia_device *link)
dev->stop = &pcnet_close;
dev->set_config = &set_config;
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return pcnet_config(link);
} /* pcnet_attach */
@ -286,8 +285,7 @@ static void pcnet_detach(struct pcmcia_device *link)
if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
pcnet_release(link);
pcnet_release(link);
free_netdev(dev);
} /* pcnet_detach */