aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c4
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c2
-rw-r--r--drivers/net/pcmcia/3c574_cs.c4
-rw-r--r--drivers/net/pcmcia/3c589_cs.c8
-rw-r--r--drivers/net/pcmcia/axnet_cs.c2
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c2
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c2
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c2
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c2
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c2
-rw-r--r--drivers/net/wireless/atmel_cs.c9
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c2
-rw-r--r--drivers/net/wireless/netwave_cs.c4
-rw-r--r--drivers/net/wireless/ray_cs.c2
-rw-r--r--drivers/net/wireless/wl3501_cs.c2
-rw-r--r--drivers/pcmcia/ds.c27
-rw-r--r--drivers/serial/serial_cs.c2
17 files changed, 52 insertions, 26 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 16e105d8d70c..02114a0bd0d9 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1458,7 +1458,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1458 iminor(inode), ioctl_names[_IOC_NR(cmd)]); 1458 iminor(inode), ioctl_names[_IOC_NR(cmd)]);
1459 1459
1460 link = dev_table[iminor(inode)]; 1460 link = dev_table[iminor(inode)];
1461 if (!(DEV_OK(link))) { 1461 if (!pcmcia_dev_present(link)) {
1462 DEBUGP(4, dev, "DEV_OK false\n"); 1462 DEBUGP(4, dev, "DEV_OK false\n");
1463 return -ENODEV; 1463 return -ENODEV;
1464 } 1464 }
@@ -1667,7 +1667,7 @@ static int cmm_open(struct inode *inode, struct file *filp)
1667 return -ENODEV; 1667 return -ENODEV;
1668 1668
1669 link = dev_table[minor]; 1669 link = dev_table[minor];
1670 if (link == NULL || !(DEV_OK(link))) 1670 if (link == NULL || !pcmcia_dev_present(link))
1671 return -ENODEV; 1671 return -ENODEV;
1672 1672
1673 if (link->open) 1673 if (link->open)
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 74609c3b2b5f..29efa64580a8 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -452,7 +452,7 @@ static int cm4040_open(struct inode *inode, struct file *filp)
452 return -ENODEV; 452 return -ENODEV;
453 453
454 link = dev_table[minor]; 454 link = dev_table[minor];
455 if (link == NULL || !(DEV_OK(link))) 455 if (link == NULL || !pcmcia_dev_present(link))
456 return -ENODEV; 456 return -ENODEV;
457 457
458 if (link->open) 458 if (link->open)
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 70e3cca09787..fab93360f017 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -728,7 +728,7 @@ static int el3_open(struct net_device *dev)
728 struct el3_private *lp = netdev_priv(dev); 728 struct el3_private *lp = netdev_priv(dev);
729 struct pcmcia_device *link = lp->p_dev; 729 struct pcmcia_device *link = lp->p_dev;
730 730
731 if (!DEV_OK(link)) 731 if (!pcmcia_dev_present(link))
732 return -ENODEV; 732 return -ENODEV;
733 733
734 link->open++; 734 link->open++;
@@ -1176,7 +1176,7 @@ static int el3_close(struct net_device *dev)
1176 1176
1177 DEBUG(2, "%s: shutting down ethercard.\n", dev->name); 1177 DEBUG(2, "%s: shutting down ethercard.\n", dev->name);
1178 1178
1179 if (DEV_OK(link)) { 1179 if (pcmcia_dev_present(link)) {
1180 unsigned long flags; 1180 unsigned long flags;
1181 1181
1182 /* Turn off statistics ASAP. We update lp->stats below. */ 1182 /* Turn off statistics ASAP. We update lp->stats below. */
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 3d05f66e9c70..875a0fe251e7 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -557,7 +557,7 @@ static int el3_open(struct net_device *dev)
557 struct el3_private *lp = netdev_priv(dev); 557 struct el3_private *lp = netdev_priv(dev);
558 struct pcmcia_device *link = lp->p_dev; 558 struct pcmcia_device *link = lp->p_dev;
559 559
560 if (!DEV_OK(link)) 560 if (!pcmcia_dev_present(link))
561 return -ENODEV; 561 return -ENODEV;
562 562
563 link->open++; 563 link->open++;
@@ -818,7 +818,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev)
818 unsigned long flags; 818 unsigned long flags;
819 struct pcmcia_device *link = lp->p_dev; 819 struct pcmcia_device *link = lp->p_dev;
820 820
821 if (DEV_OK(link)) { 821 if (pcmcia_dev_present(link)) {
822 spin_lock_irqsave(&lp->lock, flags); 822 spin_lock_irqsave(&lp->lock, flags);
823 update_stats(dev); 823 update_stats(dev);
824 spin_unlock_irqrestore(&lp->lock, flags); 824 spin_unlock_irqrestore(&lp->lock, flags);
@@ -922,7 +922,7 @@ static void set_multicast_list(struct net_device *dev)
922 kio_addr_t ioaddr = dev->base_addr; 922 kio_addr_t ioaddr = dev->base_addr;
923 u16 opts = SetRxFilter | RxStation | RxBroadcast; 923 u16 opts = SetRxFilter | RxStation | RxBroadcast;
924 924
925 if (!(DEV_OK(link))) return; 925 if (!pcmcia_dev_present(link)) return;
926 if (dev->flags & IFF_PROMISC) 926 if (dev->flags & IFF_PROMISC)
927 opts |= RxMulticast | RxProm; 927 opts |= RxMulticast | RxProm;
928 else if (dev->mc_count || (dev->flags & IFF_ALLMULTI)) 928 else if (dev->mc_count || (dev->flags & IFF_ALLMULTI))
@@ -938,7 +938,7 @@ static int el3_close(struct net_device *dev)
938 938
939 DEBUG(1, "%s: shutting down ethercard.\n", dev->name); 939 DEBUG(1, "%s: shutting down ethercard.\n", dev->name);
940 940
941 if (DEV_OK(link)) { 941 if (pcmcia_dev_present(link)) {
942 /* Turn off statistics ASAP. We update lp->stats below. */ 942 /* Turn off statistics ASAP. We update lp->stats below. */
943 outw(StatsDisable, ioaddr + EL3_CMD); 943 outw(StatsDisable, ioaddr + EL3_CMD);
944 944
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 0f1219c11853..56233afcb2b3 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -530,7 +530,7 @@ static int axnet_open(struct net_device *dev)
530 530
531 DEBUG(2, "axnet_open('%s')\n", dev->name); 531 DEBUG(2, "axnet_open('%s')\n", dev->name);
532 532
533 if (!DEV_OK(link)) 533 if (!pcmcia_dev_present(link))
534 return -ENODEV; 534 return -ENODEV;
535 535
536 link->open++; 536 link->open++;
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 7cb20b6b9348..09b11761cdfa 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -1112,7 +1112,7 @@ static int fjn_open(struct net_device *dev)
1112 1112
1113 DEBUG(4, "fjn_open('%s').\n", dev->name); 1113 DEBUG(4, "fjn_open('%s').\n", dev->name);
1114 1114
1115 if (!DEV_OK(link)) 1115 if (!pcmcia_dev_present(link))
1116 return -ENODEV; 1116 return -ENODEV;
1117 1117
1118 link->open++; 1118 link->open++;
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index fd191143cb2f..4260c2128f47 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -853,7 +853,7 @@ static int mace_open(struct net_device *dev)
853 mace_private *lp = netdev_priv(dev); 853 mace_private *lp = netdev_priv(dev);
854 struct pcmcia_device *link = lp->p_dev; 854 struct pcmcia_device *link = lp->p_dev;
855 855
856 if (!DEV_OK(link)) 856 if (!pcmcia_dev_present(link))
857 return -ENODEV; 857 return -ENODEV;
858 858
859 link->open++; 859 link->open++;
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index d9661410f2ff..506e777c5f06 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -992,7 +992,7 @@ static int pcnet_open(struct net_device *dev)
992 992
993 DEBUG(2, "pcnet_open('%s')\n", dev->name); 993 DEBUG(2, "pcnet_open('%s')\n", dev->name);
994 994
995 if (!DEV_OK(link)) 995 if (!pcmcia_dev_present(link))
996 return -ENODEV; 996 return -ENODEV;
997 997
998 link->open++; 998 link->open++;
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 7d565f26a3bf..e74bf5014ef6 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -1259,7 +1259,7 @@ static int smc_open(struct net_device *dev)
1259#endif 1259#endif
1260 1260
1261 /* Check that the PCMCIA card is still here. */ 1261 /* Check that the PCMCIA card is still here. */
1262 if (!DEV_OK(link)) 1262 if (!pcmcia_dev_present(link))
1263 return -ENODEV; 1263 return -ENODEV;
1264 /* Physical device present signature. */ 1264 /* Physical device present signature. */
1265 if (check_sig(link) < 0) { 1265 if (check_sig(link) < 0) {
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 0141c5037f41..a92a3134c833 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -1525,7 +1525,7 @@ do_open(struct net_device *dev)
1525 1525
1526 /* Check that the PCMCIA card is still here. */ 1526 /* Check that the PCMCIA card is still here. */
1527 /* Physical device present signature. */ 1527 /* Physical device present signature. */
1528 if (!DEV_OK(link)) 1528 if (!pcmcia_dev_present(link))
1529 return -ENODEV; 1529 return -ENODEV;
1530 1530
1531 /* okay */ 1531 /* okay */
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 25fb919b3791..26bf1127524d 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -216,13 +216,12 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
216/* Call-back function to interrogate PCMCIA-specific information 216/* Call-back function to interrogate PCMCIA-specific information
217 about the current existance of the card */ 217 about the current existance of the card */
218static int card_present(void *arg) 218static int card_present(void *arg)
219{ 219{
220 struct pcmcia_device *link = (struct pcmcia_device *)arg; 220 struct pcmcia_device *link = (struct pcmcia_device *)arg;
221 if (link->suspended) 221
222 return 0; 222 if (pcmcia_dev_present(link))
223 else if (pcmcia_dev_present(link))
224 return 1; 223 return 1;
225 224
226 return 0; 225 return 0;
227} 226}
228 227
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index a2cb9b0fa3d6..55bed923fbe9 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -210,7 +210,7 @@ static int prism2_config(struct pcmcia_device *link);
210static int prism2_pccard_card_present(local_info_t *local) 210static int prism2_pccard_card_present(local_info_t *local)
211{ 211{
212 struct hostap_cs_priv *hw_priv = local->hw_priv; 212 struct hostap_cs_priv *hw_priv = local->hw_priv;
213 if (hw_priv != NULL && hw_priv->link != NULL && DEV_OK(hw_priv->link)) 213 if (hw_priv != NULL && hw_priv->link != NULL && pcmcia_dev_present(hw_priv->link))
214 return 1; 214 return 1;
215 return 0; 215 return 0;
216} 216}
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index fbc8595cde39..9343d970537b 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -1107,7 +1107,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id, struct pt_regs *regs
1107 1107
1108 status = inb(iobase + NETWAVE_REG_ASR); 1108 status = inb(iobase + NETWAVE_REG_ASR);
1109 1109
1110 if (!DEV_OK(link)) { 1110 if (!pcmcia_dev_present(link)) {
1111 DEBUG(1, "netwave_interrupt: Interrupt with status 0x%x " 1111 DEBUG(1, "netwave_interrupt: Interrupt with status 0x%x "
1112 "from removed or suspended card!\n", status); 1112 "from removed or suspended card!\n", status);
1113 break; 1113 break;
@@ -1346,7 +1346,7 @@ static int netwave_open(struct net_device *dev) {
1346 1346
1347 DEBUG(1, "netwave_open: starting.\n"); 1347 DEBUG(1, "netwave_open: starting.\n");
1348 1348
1349 if (!DEV_OK(link)) 1349 if (!pcmcia_dev_present(link))
1350 return -ENODEV; 1350 return -ENODEV;
1351 1351
1352 link->open++; 1352 link->open++;
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 85712ffb842a..879eb427607c 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -1961,7 +1961,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1961 1961
1962 local = (ray_dev_t *)dev->priv; 1962 local = (ray_dev_t *)dev->priv;
1963 link = (struct pcmcia_device *)local->finder; 1963 link = (struct pcmcia_device *)local->finder;
1964 if (!(pcmcia_dev_present(link)) || link->suspended ) { 1964 if (!pcmcia_dev_present(link)) {
1965 DEBUG(2,"ray_cs interrupt from device not present or suspended.\n"); 1965 DEBUG(2,"ray_cs interrupt from device not present or suspended.\n");
1966 return IRQ_NONE; 1966 return IRQ_NONE;
1967 } 1967 }
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index b6578059de34..e52a650f6737 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -1387,7 +1387,7 @@ static int wl3501_open(struct net_device *dev)
1387 link = this->p_dev; 1387 link = this->p_dev;
1388 1388
1389 spin_lock_irqsave(&this->lock, flags); 1389 spin_lock_irqsave(&this->lock, flags);
1390 if (!DEV_OK(link)) 1390 if (!pcmcia_dev_present(link))
1391 goto out; 1391 goto out;
1392 netif_device_attach(dev); 1392 netif_device_attach(dev);
1393 link->open++; 1393 link->open++;
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 8c87343707cf..677105e35759 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -469,6 +469,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s)
469 } 469 }
470 p_dev = list_entry((&s->devices_list)->next, struct pcmcia_device, socket_device_list); 470 p_dev = list_entry((&s->devices_list)->next, struct pcmcia_device, socket_device_list);
471 list_del(&p_dev->socket_device_list); 471 list_del(&p_dev->socket_device_list);
472 p_dev->_removed=1;
472 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 473 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
473 474
474 device_unregister(&p_dev->dev); 475 device_unregister(&p_dev->dev);
@@ -1163,6 +1164,32 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
1163} /* ds_event */ 1164} /* ds_event */
1164 1165
1165 1166
1167struct pcmcia_device * pcmcia_dev_present(struct pcmcia_device *_p_dev)
1168{
1169 struct pcmcia_device *p_dev;
1170 struct pcmcia_device *ret = NULL;
1171
1172 p_dev = pcmcia_get_dev(_p_dev);
1173 if (!p_dev)
1174 return NULL;
1175
1176 if (!p_dev->socket->pcmcia_state.present)
1177 goto out;
1178
1179 if (p_dev->_removed)
1180 goto out;
1181
1182 if (p_dev->suspended)
1183 goto out;
1184
1185 ret = p_dev;
1186 out:
1187 pcmcia_put_dev(p_dev);
1188 return ret;
1189}
1190EXPORT_SYMBOL(pcmcia_dev_present);
1191
1192
1166static struct pcmcia_callback pcmcia_bus_callback = { 1193static struct pcmcia_callback pcmcia_bus_callback = {
1167 .owner = THIS_MODULE, 1194 .owner = THIS_MODULE,
1168 .event = ds_event, 1195 .event = ds_event,
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index eec05a0a86f6..389d847cd1b4 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -155,7 +155,7 @@ static int serial_suspend(struct pcmcia_device *link)
155 155
156static int serial_resume(struct pcmcia_device *link) 156static int serial_resume(struct pcmcia_device *link)
157{ 157{
158 if (DEV_OK(link)) { 158 if (pcmcia_dev_present(link)) {
159 struct serial_info *info = link->priv; 159 struct serial_info *info = link->priv;
160 int i; 160 int i;
161 161