]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/wireless/netwave_cs.c
[PATCH] ipw2200: Enable rtap interface for RF promiscuous mode while associated
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / netwave_cs.c
index 2a688865f777eb06526001c2e68ce58d21774e3e..9343d970537beca857ac12242580e099218d2689 100644 (file)
@@ -191,7 +191,7 @@ module_param(mem_speed, int, 0);
 
 /* PCMCIA (Card Services) related functions */
 static void netwave_release(struct pcmcia_device *link);     /* Card removal */
-static void netwave_pcmcia_config(struct pcmcia_device *arg); /* Runs after card
+static int netwave_pcmcia_config(struct pcmcia_device *arg); /* Runs after card
                                                                                                           insertion */
 static void netwave_detach(struct pcmcia_device *p_dev);    /* Destroy instance */
 
@@ -376,7 +376,7 @@ static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev)
  *     configure the card at this point -- we wait until we receive a
  *     card insertion event.
  */
-static int netwave_attach(struct pcmcia_device *link)
+static int netwave_probe(struct pcmcia_device *link)
 {
     struct net_device *dev;
     netwave_private *priv;
@@ -428,10 +428,7 @@ static int netwave_attach(struct pcmcia_device *link)
     dev->stop = &netwave_close;
     link->irq.Instance = dev;
 
-    link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
-    netwave_pcmcia_config( link);
-
-    return 0;
+    return netwave_pcmcia_config( link);
 } /* netwave_attach */
 
 /*
@@ -448,8 +445,7 @@ static void netwave_detach(struct pcmcia_device *link)
 
        DEBUG(0, "netwave_detach(0x%p)\n", link);
 
-       if (link->state & DEV_CONFIG)
-               netwave_release(link);
+       netwave_release(link);
 
        if (link->dev_node)
                unregister_netdev(dev);
@@ -737,7 +733,7 @@ static const struct iw_handler_def  netwave_handler_def =
 #define CS_CHECK(fn, ret) \
 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
 
-static void netwave_pcmcia_config(struct pcmcia_device *link) {
+static int netwave_pcmcia_config(struct pcmcia_device *link) {
     struct net_device *dev = link->priv;
     netwave_private *priv = netdev_priv(dev);
     tuple_t tuple;
@@ -765,9 +761,6 @@ static void netwave_pcmcia_config(struct pcmcia_device *link) {
     link->conf.ConfigBase = parse.config.base;
     link->conf.Present = parse.config.rmask[0];
 
-    /* Configure card */
-    link->state |= DEV_CONFIG;
-
     /*
      *  Try allocating IO ports.  This tries a few fixed addresses.
      *  If you want, you can also read the card's config table to
@@ -825,7 +818,6 @@ static void netwave_pcmcia_config(struct pcmcia_device *link) {
 
     strcpy(priv->node.dev_name, dev->name);
     link->dev_node = &priv->node;
-    link->state &= ~DEV_CONFIG_PENDING;
 
     /* Reset card before reading physical address */
     netwave_doreset(dev->base_addr, ramBase);
@@ -845,12 +837,13 @@ static void netwave_pcmcia_config(struct pcmcia_device *link) {
     printk(KERN_DEBUG "Netwave_reset: revision %04x %04x\n", 
           get_uint16(ramBase + NETWAVE_EREG_ARW),
           get_uint16(ramBase + NETWAVE_EREG_ARW+2));
-    return;
+    return 0;
 
 cs_failed:
     cs_error(link, last_fn, last_ret);
 failed:
     netwave_release(link);
+    return -ENODEV;
 } /* netwave_pcmcia_config */
 
 /*
@@ -876,7 +869,7 @@ static int netwave_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;
@@ -886,7 +879,7 @@ static int netwave_resume(struct pcmcia_device *link)
 {
        struct net_device *dev = link->priv;
 
-       if ((link->state & DEV_CONFIG) && (link->open)) {
+       if (link->open) {
                netwave_reset(dev);
                netif_device_attach(dev);
        }
@@ -1114,7 +1107,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id, struct pt_regs *regs
        
         status = inb(iobase + NETWAVE_REG_ASR);
                
-       if (!DEV_OK(link)) {
+       if (!pcmcia_dev_present(link)) {
            DEBUG(1, "netwave_interrupt: Interrupt with status 0x%x "
                  "from removed or suspended card!\n", status);
            break;
@@ -1353,7 +1346,7 @@ static int netwave_open(struct net_device *dev) {
 
     DEBUG(1, "netwave_open: starting.\n");
     
-    if (!DEV_OK(link))
+    if (!pcmcia_dev_present(link))
        return -ENODEV;
 
     link->open++;
@@ -1387,7 +1380,7 @@ static struct pcmcia_driver netwave_driver = {
        .drv            = {
                .name   = "netwave_cs",
        },
-       .probe          = netwave_attach,
+       .probe          = netwave_probe,
        .remove         = netwave_detach,
        .id_table       = netwave_ids,
        .suspend        = netwave_suspend,