]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/net/wireless/ray_cs.c
Merge branch 'master' into tk71
[mv-sheeva.git] / drivers / net / wireless / ray_cs.c
index 88560d0ae50a2457d1373103db85b98ebb61211e..0764d1a30d13f2637ae624d43446e26a07f6ffd9 100644 (file)
 #include <linux/if_arp.h>
 #include <linux/ioport.h>
 #include <linux/skbuff.h>
-#include <linux/ethtool.h>
 #include <linux/ieee80211.h>
 
-#include <pcmcia/cs.h>
 #include <pcmcia/cistpl.h>
 #include <pcmcia/cisreg.h>
 #include <pcmcia/ds.h>
@@ -80,8 +78,6 @@ static int ray_dev_config(struct net_device *dev, struct ifmap *map);
 static struct net_device_stats *ray_get_stats(struct net_device *dev);
 static int ray_dev_init(struct net_device *dev);
 
-static const struct ethtool_ops netdev_ethtool_ops;
-
 static int ray_open(struct net_device *dev);
 static netdev_tx_t ray_dev_start_xmit(struct sk_buff *skb,
                                            struct net_device *dev);
@@ -169,13 +165,6 @@ static int bc;
  */
 static char *phy_addr = NULL;
 
-
-/* A struct pcmcia_device structure has fields for most things that are needed
-   to keep track of a socket, but there will usually be some device
-   specific information that also needs to be kept track of.  The
-   'priv' pointer in a struct pcmcia_device structure can be used to point to
-   a device-specific private data structure, like this.
-*/
 static unsigned int ray_mem_speed = 500;
 
 /* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */
@@ -197,7 +186,7 @@ module_param(bc, int, 0);
 module_param(phy_addr, charp, 0);
 module_param(ray_mem_speed, int, 0);
 
-static UCHAR b5_default_startup_parms[] = {
+static const UCHAR b5_default_startup_parms[] = {
        0, 0,                   /* Adhoc station */
        'L', 'I', 'N', 'U', 'X', 0, 0, 0,       /* 32 char ESSID */
        0, 0, 0, 0, 0, 0, 0, 0,
@@ -232,7 +221,7 @@ static UCHAR b5_default_startup_parms[] = {
        2, 0, 0, 0, 0, 0, 0, 0  /* basic rate set */
 };
 
-static UCHAR b4_default_startup_parms[] = {
+static const UCHAR b4_default_startup_parms[] = {
        0, 0,                   /* Adhoc station */
        'L', 'I', 'N', 'U', 'X', 0, 0, 0,       /* 32 char ESSID */
        0, 0, 0, 0, 0, 0, 0, 0,
@@ -264,9 +253,9 @@ static UCHAR b4_default_startup_parms[] = {
 };
 
 /*===========================================================================*/
-static unsigned char eth2_llc[] = { 0xaa, 0xaa, 3, 0, 0, 0 };
+static const u8 eth2_llc[] = { 0xaa, 0xaa, 3, 0, 0, 0 };
 
-static char hop_pattern_length[] = { 1,
+static const char hop_pattern_length[] = { 1,
        USA_HOP_MOD, EUROPE_HOP_MOD,
        JAPAN_HOP_MOD, KOREA_HOP_MOD,
        SPAIN_HOP_MOD, FRANCE_HOP_MOD,
@@ -274,7 +263,7 @@ static char hop_pattern_length[] = { 1,
        JAPAN_TEST_HOP_MOD
 };
 
-static char rcsid[] =
+static const char rcsid[] =
     "Raylink/WebGear wireless LAN - Corey <Thomas corey@world.std.com>";
 
 static const struct net_device_ops ray_netdev_ops = {
@@ -290,14 +279,6 @@ static const struct net_device_ops ray_netdev_ops = {
        .ndo_validate_addr      = eth_validate_addr,
 };
 
-/*=============================================================================
-    ray_attach() creates an "instance" of the driver, allocating
-    local data structures for one device.  The device is registered
-    with Card Services.
-    The dev_link structure is initialized, but we don't actually
-    configure the card at this point -- we wait until we receive a
-    card insertion event.
-=============================================================================*/
 static int ray_probe(struct pcmcia_device *p_dev)
 {
        ray_dev_t *local;
@@ -318,9 +299,8 @@ static int ray_probe(struct pcmcia_device *p_dev)
        p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
 
        /* General socket configuration */
-       p_dev->conf.Attributes = CONF_ENABLE_IRQ;
-       p_dev->conf.IntType = INT_MEMORY_AND_IO;
-       p_dev->conf.ConfigIndex = 1;
+       p_dev->config_flags |= CONF_ENABLE_IRQ;
+       p_dev->config_index = 1;
 
        p_dev->priv = dev;
 
@@ -333,7 +313,6 @@ static int ray_probe(struct pcmcia_device *p_dev)
 
        /* Raylink entries in the device structure */
        dev->netdev_ops = &ray_netdev_ops;
-       SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
        dev->wireless_handlers = &ray_handler_def;
 #ifdef WIRELESS_SPY
        local->wireless_data.spy_data = &local->spy_data;
@@ -353,12 +332,6 @@ fail_alloc_dev:
        return -ENOMEM;
 } /* ray_attach */
 
-/*=============================================================================
-    This deletes a driver "instance".  The device is de-registered
-    with Card Services.  If it has been released, all local data
-    structures are freed.  Otherwise, the structures will be freed
-    when the device is released.
-=============================================================================*/
 static void ray_detach(struct pcmcia_device *link)
 {
        struct net_device *dev;
@@ -381,17 +354,11 @@ static void ray_detach(struct pcmcia_device *link)
        dev_dbg(&link->dev, "ray_cs ray_detach ending\n");
 } /* ray_detach */
 
-/*=============================================================================
-    ray_config() is run after a CARD_INSERTION event
-    is received, to configure the PCMCIA socket, and to make the
-    ethernet device available to the system.
-=============================================================================*/
 #define MAX_TUPLE_SIZE 128
 static int ray_config(struct pcmcia_device *link)
 {
        int ret = 0;
        int i;
-       win_req_t req;
        struct net_device *dev = (struct net_device *)link->priv;
        ray_dev_t *local = netdev_priv(dev);
 
@@ -412,54 +379,50 @@ static int ray_config(struct pcmcia_device *link)
                goto failed;
        dev->irq = link->irq;
 
-       /* This actually configures the PCMCIA socket -- setting up
-          the I/O windows and the interrupt mapping.
-        */
-       ret = pcmcia_request_configuration(link, &link->conf);
+       ret = pcmcia_enable_device(link);
        if (ret)
                goto failed;
 
 /*** Set up 32k window for shared memory (transmit and control) ************/
-       req.Attributes =
-           WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
-       req.Base = 0;
-       req.Size = 0x8000;
-       req.AccessSpeed = ray_mem_speed;
-       ret = pcmcia_request_window(link, &req, &link->win);
+       link->resource[2]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
+       link->resource[2]->start = 0;
+       link->resource[2]->end = 0x8000;
+       ret = pcmcia_request_window(link, link->resource[2], ray_mem_speed);
        if (ret)
                goto failed;
-       ret = pcmcia_map_mem_page(link, link->win, 0);
+       ret = pcmcia_map_mem_page(link, link->resource[2], 0);
        if (ret)
                goto failed;
-       local->sram = ioremap(req.Base, req.Size);
+       local->sram = ioremap(link->resource[2]->start,
+                       resource_size(link->resource[2]));
 
 /*** Set up 16k window for shared memory (receive buffer) ***************/
-       req.Attributes =
+       link->resource[3]->flags |=
            WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
-       req.Base = 0;
-       req.Size = 0x4000;
-       req.AccessSpeed = ray_mem_speed;
-       ret = pcmcia_request_window(link, &req, &local->rmem_handle);
+       link->resource[3]->start = 0;
+       link->resource[3]->end = 0x4000;
+       ret = pcmcia_request_window(link, link->resource[3], ray_mem_speed);
        if (ret)
                goto failed;
-       ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000);
+       ret = pcmcia_map_mem_page(link, link->resource[3], 0x8000);
        if (ret)
                goto failed;
-       local->rmem = ioremap(req.Base, req.Size);
+       local->rmem = ioremap(link->resource[3]->start,
+                       resource_size(link->resource[3]));
 
 /*** Set up window for attribute memory ***********************************/
-       req.Attributes =
+       link->resource[4]->flags |=
            WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT;
-       req.Base = 0;
-       req.Size = 0x1000;
-       req.AccessSpeed = ray_mem_speed;
-       ret = pcmcia_request_window(link, &req, &local->amem_handle);
+       link->resource[4]->start = 0;
+       link->resource[4]->end = 0x1000;
+       ret = pcmcia_request_window(link, link->resource[4], ray_mem_speed);
        if (ret)
                goto failed;
-       ret = pcmcia_map_mem_page(link, local->amem_handle, 0);
+       ret = pcmcia_map_mem_page(link, link->resource[4], 0);
        if (ret)
                goto failed;
-       local->amem = ioremap(req.Base, req.Size);
+       local->amem = ioremap(link->resource[4]->start,
+                       resource_size(link->resource[4]));
 
        dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram);
        dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem);
@@ -608,7 +571,7 @@ static int dl_startup_params(struct net_device *dev)
        /* Start kernel timer to wait for dl startup to complete. */
        local->timer.expires = jiffies + HZ / 2;
        local->timer.data = (long)local;
-       local->timer.function = &verify_dl_startup;
+       local->timer.function = verify_dl_startup;
        add_timer(&local->timer);
        dev_dbg(&link->dev,
              "ray_cs dl_startup_params started timer for verify_dl_startup\n");
@@ -775,11 +738,7 @@ static void join_net(u_long data)
        local->card_status = CARD_DOING_ACQ;
 }
 
-/*============================================================================
-    After a card is removed, ray_release() will unregister the net
-    device, and release the PCMCIA configuration.  If the device is
-    still open, this will be postponed until it is closed.
-=============================================================================*/
+
 static void ray_release(struct pcmcia_device *link)
 {
        struct net_device *dev = link->priv;
@@ -1062,18 +1021,6 @@ AP to AP 1       1       dest AP         src AP          dest    source
        }
 } /* end encapsulate_frame */
 
-/*===========================================================================*/
-
-static void netdev_get_drvinfo(struct net_device *dev,
-                              struct ethtool_drvinfo *info)
-{
-       strcpy(info->driver, "ray_cs");
-}
-
-static const struct ethtool_ops netdev_ethtool_ops = {
-       .get_drvinfo = netdev_get_drvinfo,
-};
-
 /*====================================================================*/
 
 /*------------------------------------------------------------------*/
@@ -1829,11 +1776,8 @@ static void ray_update_multi_list(struct net_device *dev, int all)
                /* Copy the kernel's list of MC addresses to card */
                netdev_for_each_mc_addr(ha, dev) {
                        memcpy_toio(p, ha->addr, ETH_ALEN);
-                       dev_dbg(&link->dev,
-                             "ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n",
-                             ha->addr[0], ha->addr[1],
-                             ha->addr[2], ha->addr[3],
-                             ha->addr[4], ha->addr[5]);
+                       dev_dbg(&link->dev, "ray_update_multi add addr %pm\n",
+                               ha->addr);
                        p += ETH_ALEN;
                        i++;
                }
@@ -1997,12 +1941,12 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
                                        dev_dbg(&link->dev,
                                              "ray_cs interrupt network \"%s\" start failed\n",
                                              local->sparm.b4.a_current_ess_id);
-                                       local->timer.function = &start_net;
+                                       local->timer.function = start_net;
                                } else {
                                        dev_dbg(&link->dev,
                                              "ray_cs interrupt network \"%s\" join failed\n",
                                              local->sparm.b4.a_current_ess_id);
-                                       local->timer.function = &join_net;
+                                       local->timer.function = join_net;
                                }
                                add_timer(&local->timer);
                        }
@@ -2068,11 +2012,8 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
                                memcpy_fromio(&local->bss_id,
                                              prcs->var.rejoin_net_complete.
                                              bssid, ADDRLEN);
-                               dev_dbg(&link->dev,
-                                     "ray_cs new BSSID = %02x%02x%02x%02x%02x%02x\n",
-                                     local->bss_id[0], local->bss_id[1],
-                                     local->bss_id[2], local->bss_id[3],
-                                     local->bss_id[4], local->bss_id[5]);
+                               dev_dbg(&link->dev, "ray_cs new BSSID = %pm\n",
+                                       local->bss_id);
                                if (!sniffer)
                                        authenticate(local);
                        }
@@ -2339,8 +2280,8 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len)
        struct ethhdr *peth;
        UCHAR srcaddr[ADDRLEN];
        UCHAR destaddr[ADDRLEN];
-       static UCHAR org_bridge[3] = { 0, 0, 0xf8 };
-       static UCHAR org_1042[3] = { 0, 0, 0 };
+       static const UCHAR org_bridge[3] = { 0, 0, 0xf8 };
+       static const UCHAR org_1042[3] = { 0, 0, 0 };
 
        memcpy(destaddr, ieee80211_get_DA(pmac), ADDRLEN);
        memcpy(srcaddr, ieee80211_get_SA(pmac), ADDRLEN);
@@ -2470,9 +2411,9 @@ static void authenticate(ray_dev_t *local)
 
        del_timer(&local->timer);
        if (build_auth_frame(local, local->bss_id, OPEN_AUTH_REQUEST)) {
-               local->timer.function = &join_net;
+               local->timer.function = join_net;
        } else {
-               local->timer.function = &authenticate_timeout;
+               local->timer.function = authenticate_timeout;
        }
        local->timer.expires = jiffies + HZ * 2;
        local->timer.data = (long)local;
@@ -2557,7 +2498,7 @@ static void associate(ray_dev_t *local)
                del_timer(&local->timer);
                local->timer.expires = jiffies + HZ * 2;
                local->timer.data = (long)local;
-               local->timer.function = &join_net;
+               local->timer.function = join_net;
                add_timer(&local->timer);
                local->card_status = CARD_ASSOC_FAILED;
                return;
@@ -2591,7 +2532,7 @@ static void clear_interrupt(ray_dev_t *local)
 #ifdef CONFIG_PROC_FS
 #define MAXDATA (PAGE_SIZE - 80)
 
-static char *card_status[] = {
+static const char *card_status[] = {
        "Card inserted - uninitialized",        /* 0 */
        "Card not downloaded",                  /* 1 */
        "Waiting for download parameters",      /* 2 */
@@ -2608,8 +2549,8 @@ static char *card_status[] = {
        "Association failed"                    /* 16 */
 };
 
-static char *nettype[] = { "Adhoc", "Infra " };
-static char *framing[] = { "Encapsulation", "Translation" }
+static const char *nettype[] = { "Adhoc", "Infra " };
+static const char *framing[] = { "Encapsulation", "Translation" }
 
 ;
 /*===========================================================================*/
@@ -2802,6 +2743,7 @@ static ssize_t ray_cs_essid_proc_write(struct file *file,
 static const struct file_operations ray_cs_essid_proc_fops = {
        .owner          = THIS_MODULE,
        .write          = ray_cs_essid_proc_write,
+       .llseek         = noop_llseek,
 };
 
 static ssize_t int_proc_write(struct file *file, const char __user *buffer,
@@ -2835,6 +2777,7 @@ static ssize_t int_proc_write(struct file *file, const char __user *buffer,
 static const struct file_operations int_proc_fops = {
        .owner          = THIS_MODULE,
        .write          = int_proc_write,
+       .llseek         = noop_llseek,
 };
 #endif
 
@@ -2847,9 +2790,7 @@ MODULE_DEVICE_TABLE(pcmcia, ray_ids);
 
 static struct pcmcia_driver ray_driver = {
        .owner = THIS_MODULE,
-       .drv = {
-               .name = "ray_cs",
-               },
+       .name = "ray_cs",
        .probe = ray_probe,
        .remove = ray_detach,
        .id_table = ray_ids,