]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/wireless/atmel_cs.c
[PATCH] orinoco: bump version to 0.15
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / atmel_cs.c
index 843dd1a036d2083c362c636ff3d4fda593d1ab67..26bf1127524df2f147f5e517d87a3e8101d58949 100644 (file)
@@ -91,7 +91,7 @@ MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards");
    event handler. 
 */
 
-static void atmel_config(struct pcmcia_device *link);
+static int atmel_config(struct pcmcia_device *link);
 static void atmel_release(struct pcmcia_device *link);
 
 /*
@@ -152,7 +152,7 @@ typedef struct local_info_t {
   
   ======================================================================*/
 
-static int atmel_attach(struct pcmcia_device *p_dev)
+static int atmel_probe(struct pcmcia_device *p_dev)
 {
        local_info_t *local;
 
@@ -181,10 +181,7 @@ static int atmel_attach(struct pcmcia_device *p_dev)
        }
        p_dev->priv = local;
 
-       p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
-       atmel_config(p_dev);
-
-       return 0;
+       return atmel_config(p_dev);
 } /* atmel_attach */
 
 /*======================================================================
@@ -200,8 +197,7 @@ static void atmel_detach(struct pcmcia_device *link)
 {
        DEBUG(0, "atmel_detach(0x%p)\n", link);
 
-       if (link->state & DEV_CONFIG)
-               atmel_release(link);
+       atmel_release(link);
 
        kfree(link->priv);
 }
@@ -220,17 +216,16 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
 /* Call-back function to interrogate PCMCIA-specific information
    about the current existance of the card */
 static int card_present(void *arg)
-{ 
+{
        struct pcmcia_device *link = (struct pcmcia_device *)arg;
-       if (link->state & DEV_SUSPEND)
-               return 0;
-       else if (link->state & DEV_PRESENT)
+
+       if (pcmcia_dev_present(link))
                return 1;
-       
+
        return 0;
 }
 
-static void atmel_config(struct pcmcia_device *link)
+static int atmel_config(struct pcmcia_device *link)
 {
        tuple_t tuple;
        cisparse_t parse;
@@ -259,10 +254,7 @@ static void atmel_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;
-       
+
        /*
          In this loop, we scan the CIS for configuration table entries,
          each of which describes a valid card configuration, including
@@ -375,13 +367,13 @@ static void atmel_config(struct pcmcia_device *link)
        strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name );
        dev->node.major = dev->node.minor = 0;
        link->dev_node = &dev->node;
-                       
-       link->state &= ~DEV_CONFIG_PENDING;
-       return;
-       
+
+       return 0;
+
  cs_failed:
        cs_error(link, last_fn, last_ret);
        atmel_release(link);
+       return -ENODEV;
 }
 
 /*======================================================================
@@ -409,8 +401,7 @@ static int atmel_suspend(struct pcmcia_device *link)
 {
        local_info_t *local = link->priv;
 
-       if (link->state & DEV_CONFIG)
-               netif_device_detach(local->eth_dev);
+       netif_device_detach(local->eth_dev);
 
        return 0;
 }
@@ -419,10 +410,8 @@ static int atmel_resume(struct pcmcia_device *link)
 {
        local_info_t *local = link->priv;
 
-       if (link->state & DEV_CONFIG) {
-               atmel_open(local->eth_dev);
-               netif_device_attach(local->eth_dev);
-       }
+       atmel_open(local->eth_dev);
+       netif_device_attach(local->eth_dev);
 
        return 0;
 }
@@ -476,7 +465,7 @@ static struct pcmcia_driver atmel_driver = {
        .drv            = {
                .name   = "atmel_cs",
         },
-       .probe          = atmel_attach,
+       .probe          = atmel_probe,
        .remove         = atmel_detach,
        .id_table       = atmel_ids,
        .suspend        = atmel_suspend,