]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/wireless/airo_cs.c
Merge master.kernel.org:/home/rmk/linux-2.6-arm
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / airo_cs.c
index 76970197f98f061c167a9e9b83be3d4ad9060d52..f12355398fe7ca19186d976374c216e07a89c6bf 100644 (file)
@@ -20,7 +20,6 @@
     
 ======================================================================*/
 
-#include <linux/config.h>
 #ifdef __IN_PCMCIA_PACKAGE__
 #include <pcmcia/k_compat.h>
 #endif
@@ -80,7 +79,7 @@ MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards");
    event handler. 
 */
 
-static void airo_config(struct pcmcia_device *link);
+static int airo_config(struct pcmcia_device *link);
 static void airo_release(struct pcmcia_device *link);
 
 /*
@@ -141,7 +140,7 @@ typedef struct local_info_t {
   
   ======================================================================*/
 
-static int airo_attach(struct pcmcia_device *p_dev)
+static int airo_probe(struct pcmcia_device *p_dev)
 {
        local_info_t *local;
 
@@ -170,10 +169,7 @@ static int airo_attach(struct pcmcia_device *p_dev)
        }
        p_dev->priv = local;
 
-       p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
-       airo_config(p_dev);
-
-       return 0;
+       return airo_config(p_dev);
 } /* airo_attach */
 
 /*======================================================================
@@ -189,8 +185,7 @@ static void airo_detach(struct pcmcia_device *link)
 {
        DEBUG(0, "airo_detach(0x%p)\n", link);
 
-       if (link->state & DEV_CONFIG)
-               airo_release(link);
+       airo_release(link);
 
        if ( ((local_info_t*)link->priv)->eth_dev ) {
                stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 );
@@ -211,7 +206,7 @@ static void airo_detach(struct pcmcia_device *link)
 #define CS_CHECK(fn, ret) \
 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
 
-static void airo_config(struct pcmcia_device *link)
+static int airo_config(struct pcmcia_device *link)
 {
        tuple_t tuple;
        cisparse_t parse;
@@ -224,25 +219,7 @@ static void airo_config(struct pcmcia_device *link)
        dev = link->priv;
 
        DEBUG(0, "airo_config(0x%p)\n", link);
-       
-       /*
-         This reads the card's CONFIG tuple to find its configuration
-         registers.
-       */
-       tuple.DesiredTuple = CISTPL_CONFIG;
-       tuple.Attributes = 0;
-       tuple.TupleData = buf;
-       tuple.TupleDataMax = sizeof(buf);
-       tuple.TupleOffset = 0;
-       CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
-       CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
-       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
@@ -255,6 +232,10 @@ static void airo_config(struct pcmcia_device *link)
          these things without consulting the CIS, and most client drivers
          will only use the CIS to fill in implementation-defined details.
        */
+       tuple.Attributes = 0;
+       tuple.TupleData = buf;
+       tuple.TupleDataMax = sizeof(buf);
+       tuple.TupleOffset = 0;
        tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
        CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
        while (1) {
@@ -384,14 +365,12 @@ static void airo_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;
-       return;
-       
+       return 0;
+
  cs_failed:
        cs_error(link, last_fn, last_ret);
        airo_release(link);
-       
+       return -ENODEV;
 } /* airo_config */
 
 /*======================================================================
@@ -412,8 +391,7 @@ static int airo_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;
 }
@@ -422,7 +400,7 @@ static int airo_resume(struct pcmcia_device *link)
 {
        local_info_t *local = link->priv;
 
-       if ((link->state & DEV_CONFIG) && (link->open)) {
+       if (link->open) {
                reset_airo_card(local->eth_dev);
                netif_device_attach(local->eth_dev);
        }
@@ -444,7 +422,7 @@ static struct pcmcia_driver airo_driver = {
        .drv            = {
                .name   = "airo_cs",
        },
-       .probe          = airo_attach,
+       .probe          = airo_probe,
        .remove         = airo_detach,
        .id_table       = airo_ids,
        .suspend        = airo_suspend,