[PATCH] pcmcia: remove manf_id and card_id indirection
[safe/jmp/linux-2.6] / drivers / net / wireless / hostap / hostap_cs.c
index 89b1781..8a7984b 100644 (file)
@@ -1,6 +1,5 @@
 #define PRISM2_PCCARD
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/if.h>
@@ -210,9 +209,7 @@ static int prism2_config(struct pcmcia_device *link);
 static int prism2_pccard_card_present(local_info_t *local)
 {
        struct hostap_cs_priv *hw_priv = local->hw_priv;
-       if (hw_priv != NULL && hw_priv->link != NULL &&
-           ((hw_priv->link->state & (DEV_PRESENT | DEV_CONFIG)) ==
-            (DEV_PRESENT | DEV_CONFIG)))
+       if (hw_priv != NULL && hw_priv->link != NULL && pcmcia_dev_present(hw_priv->link))
                return 1;
        return 0;
 }
@@ -296,15 +293,12 @@ static int sandisk_enable_wireless(struct net_device *dev)
                goto done;
        }
 
-       tuple.DesiredTuple = CISTPL_MANFID;
        tuple.Attributes = TUPLE_RETURN_COMMON;
        tuple.TupleData = buf;
        tuple.TupleDataMax = sizeof(buf);
        tuple.TupleOffset = 0;
-       if (pcmcia_get_first_tuple(hw_priv->link, &tuple) ||
-           pcmcia_get_tuple_data(hw_priv->link, &tuple) ||
-           pcmcia_parse_tuple(hw_priv->link, &tuple, parse) ||
-           parse->manfid.manf != 0xd601 || parse->manfid.card != 0x0101) {
+
+       if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) {
                /* No SanDisk manfid found */
                ret = -ENODEV;
                goto done;
@@ -501,16 +495,19 @@ static struct prism2_helper_functions prism2_pccard_funcs =
 
 /* allocate local data and register with CardServices
  * initialize dev_link structure, but do not configure the card yet */
-static int prism2_attach(struct pcmcia_device *p_dev)
+static int hostap_cs_probe(struct pcmcia_device *p_dev)
 {
+       int ret;
+
        PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info);
        p_dev->conf.IntType = INT_MEMORY_AND_IO;
 
-       p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
-       if (prism2_config(p_dev))
+       ret = prism2_config(p_dev);
+       if (ret) {
                PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n");
+       }
 
-       return 0;
+       return ret;
 }
 
 
@@ -518,9 +515,7 @@ static void prism2_detach(struct pcmcia_device *link)
 {
        PDEBUG(DEBUG_FLOW, "prism2_detach\n");
 
-       if (link->state & DEV_CONFIG) {
-               prism2_release((u_long)link);
-       }
+       prism2_release((u_long)link);
 
        /* release net devices */
        if (link->priv) {
@@ -742,9 +737,6 @@ static int prism2_config(struct pcmcia_device *link)
                       link->io.BasePort2+link->io.NumPorts2-1);
        printk("\n");
 
-       link->state |= DEV_CONFIG;
-       link->state &= ~DEV_CONFIG_PENDING;
-
        local->shutdown = 0;
 
        sandisk_enable_wireless(dev);
@@ -780,8 +772,7 @@ static void prism2_release(u_long arg)
                struct hostap_interface *iface;
 
                iface = netdev_priv(dev);
-               if (link->state & DEV_CONFIG)
-                       prism2_hw_shutdown(dev, 0);
+               prism2_hw_shutdown(dev, 0);
                iface->local->shutdown = 1;
        }
 
@@ -793,19 +784,19 @@ static int hostap_cs_suspend(struct pcmcia_device *link)
 {
        struct net_device *dev = (struct net_device *) link->priv;
        int dev_open = 0;
+       struct hostap_interface *iface = NULL;
 
-       PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info);
+       if (dev)
+               iface = netdev_priv(dev);
 
-       if (link->state & DEV_CONFIG) {
-               struct hostap_interface *iface = netdev_priv(dev);
-               if (iface && iface->local)
-                       dev_open = iface->local->num_dev_open > 0;
-               if (dev_open) {
-                       netif_stop_queue(dev);
-                       netif_device_detach(dev);
-               }
-               prism2_suspend(dev);
+       PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info);
+       if (iface && iface->local)
+               dev_open = iface->local->num_dev_open > 0;
+       if (dev_open) {
+               netif_stop_queue(dev);
+               netif_device_detach(dev);
        }
+       prism2_suspend(dev);
 
        return 0;
 }
@@ -814,20 +805,21 @@ static int hostap_cs_resume(struct pcmcia_device *link)
 {
        struct net_device *dev = (struct net_device *) link->priv;
        int dev_open = 0;
+       struct hostap_interface *iface = NULL;
+
+       if (dev)
+               iface = netdev_priv(dev);
 
        PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info);
 
-       if (link->state & DEV_CONFIG) {
-               struct hostap_interface *iface = netdev_priv(dev);
-               if (iface && iface->local)
-                       dev_open = iface->local->num_dev_open > 0;
+       if (iface && iface->local)
+               dev_open = iface->local->num_dev_open > 0;
 
-               prism2_hw_shutdown(dev, 1);
-               prism2_hw_config(dev, dev_open ? 0 : 1);
-               if (dev_open) {
-                       netif_device_attach(dev);
-                       netif_start_queue(dev);
-               }
+       prism2_hw_shutdown(dev, 1);
+       prism2_hw_config(dev, dev_open ? 0 : 1);
+       if (dev_open) {
+               netif_device_attach(dev);
+               netif_start_queue(dev);
        }
 
        return 0;
@@ -848,10 +840,11 @@ static struct pcmcia_device_id hostap_cs_ids[] = {
        PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001),
        PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001),
        PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
-       PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000),
+/*     PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000),    conflict with pcnet_cs */
        PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
        PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
        PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
+       PCMCIA_DEVICE_MANF_CARD(0x0126, 0x0002),
        PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "INTERSIL",
                                         0x74c5e40d),
        PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "Intersil",
@@ -885,6 +878,19 @@ static struct pcmcia_device_id hostap_cs_ids[] = {
        PCMCIA_DEVICE_PROD_ID12(
                "ZoomAir 11Mbps High", "Rate wireless Networking",
                0x273fe3db, 0x32a1eaee),
+       PCMCIA_DEVICE_PROD_ID123(
+               "Pretec", "CompactWLAN Card 802.11b", "2.5",
+               0x1cadd3e5, 0xe697636c, 0x7a5bfcf1),
+       PCMCIA_DEVICE_PROD_ID123(
+               "U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02",
+               0xc7b8df9d, 0x1700d087, 0x4b74baa0),
+       PCMCIA_DEVICE_PROD_ID123(
+               "Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio",
+               "Ver. 1.00",
+               0x5cd01705, 0x4271660f, 0x9d08ee12),
+       PCMCIA_DEVICE_PROD_ID123(
+               "corega", "WL PCCL-11", "ISL37300P",
+               0xa21501a, 0x59868926, 0xc9049a39),
        PCMCIA_DEVICE_NULL
 };
 MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
@@ -894,7 +900,7 @@ static struct pcmcia_driver hostap_driver = {
        .drv            = {
                .name   = "hostap_cs",
        },
-       .probe          = prism2_attach,
+       .probe          = hostap_cs_probe,
        .remove         = prism2_detach,
        .owner          = THIS_MODULE,
        .id_table       = hostap_cs_ids,