Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
[sfrench/cifs-2.6.git] / drivers / staging / comedi / drivers / ni_daq_700.c
index 701abd9eabe6e37e9c3636eb43b7f326f21d028f..cc15666e5cc195391d5fd5093dc90f4c30169943 100644 (file)
@@ -47,7 +47,6 @@ IRQ is assigned but not used.
 
 #include <linux/ioport.h>
 
-#include <pcmcia/cs_types.h>
 #include <pcmcia/cs.h>
 #include <pcmcia/cistpl.h>
 #include <pcmcia/cisreg.h>
@@ -377,7 +376,7 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it)
                link = pcmcia_cur_dev;  /* XXX hack */
                if (!link)
                        return -EIO;
-               iobase = link->io.BasePort1;
+               iobase = link->resource[0]->start;
 #ifdef incomplete
                irq = link->irq;
 #endif
@@ -459,14 +458,6 @@ static void dio700_cs_detach(struct pcmcia_device *);
    less on other parts of the kernel.
 */
 
-/*
-   The dev_info variable is the "key" that is used to match up this
-   device driver with appropriate cards, through the card configuration
-   database.
-*/
-
-static const dev_info_t dev_info = "ni_daq_700";
-
 struct local_info_t {
        struct pcmcia_device *link;
        int stop;
@@ -555,9 +546,6 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev,
                                unsigned int vcc,
                                void *priv_data)
 {
-       win_req_t *req = priv_data;
-       memreq_t map;
-
        if (cfg->index == 0)
                return -ENODEV;
 
@@ -571,44 +559,25 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev,
        p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
 
        /* IO window settings */
-       p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
+       p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
        if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
                cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
-               p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
-               if (!(io->flags & CISTPL_IO_8BIT))
-                       p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
-               if (!(io->flags & CISTPL_IO_16BIT))
-                       p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
-               p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
-               p_dev->io.BasePort1 = io->win[0].base;
-               p_dev->io.NumPorts1 = io->win[0].len;
+               p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
+               p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
+               p_dev->resource[0]->flags |=
+                       pcmcia_io_cfg_data_width(io->flags);
+               p_dev->resource[0]->start = io->win[0].base;
+               p_dev->resource[0]->end = io->win[0].len;
                if (io->nwin > 1) {
-                       p_dev->io.Attributes2 = p_dev->io.Attributes1;
-                       p_dev->io.BasePort2 = io->win[1].base;
-                       p_dev->io.NumPorts2 = io->win[1].len;
+                       p_dev->resource[1]->flags = p_dev->resource[0]->flags;
+                       p_dev->resource[1]->start = io->win[1].base;
+                       p_dev->resource[1]->end = io->win[1].len;
                }
                /* This reserves IO space but doesn't actually enable it */
-               if (pcmcia_request_io(p_dev, &p_dev->io) != 0)
+               if (pcmcia_request_io(p_dev) != 0)
                        return -ENODEV;
        }
 
-       if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
-               cistpl_mem_t *mem =
-                       (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
-               req->Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM;
-               req->Attributes |= WIN_ENABLE;
-               req->Base = mem->win[0].host_addr;
-               req->Size = mem->win[0].len;
-               if (req->Size < 0x1000)
-                       req->Size = 0x1000;
-               req->AccessSpeed = 0;
-               if (pcmcia_request_window(p_dev, req, &p_dev->win))
-                       return -ENODEV;
-               map.Page = 0;
-               map.CardOffset = mem->win[0].card_addr;
-               if (pcmcia_map_mem_page(p_dev, p_dev->win, &map))
-                       return -ENODEV;
-       }
        /* If we got this far, we're cool! */
        return 0;
 }
@@ -622,7 +591,7 @@ static void dio700_config(struct pcmcia_device *link)
 
        dev_dbg(&link->dev, "dio700_config\n");
 
-       ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, &req);
+       ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, NULL);
        if (ret) {
                dev_warn(&link->dev, "no configuration found\n");
                goto failed;
@@ -644,15 +613,10 @@ static void dio700_config(struct pcmcia_device *link)
        dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex);
        if (link->conf.Attributes & CONF_ENABLE_IRQ)
                printk(", irq %d", link->irq);
-       if (link->io.NumPorts1)
-               printk(", io 0x%04x-0x%04x", link->io.BasePort1,
-                      link->io.BasePort1 + link->io.NumPorts1 - 1);
-       if (link->io.NumPorts2)
-               printk(" & 0x%04x-0x%04x", link->io.BasePort2,
-                      link->io.BasePort2 + link->io.NumPorts2 - 1);
-       if (link->win)
-               printk(", mem 0x%06lx-0x%06lx", req.Base,
-                      req.Base + req.Size - 1);
+       if (link->resource[0])
+               printk(", io %pR", link->resource[0]);
+       if (link->resource[1])
+               printk(" & %pR", link->resource[1]);
        printk("\n");
 
        return;
@@ -722,7 +686,7 @@ struct pcmcia_driver dio700_cs_driver = {
        .id_table = dio700_cs_ids,
        .owner = THIS_MODULE,
        .drv = {
-               .name = dev_info,
+               .name = "ni_daq_700",
                },
 };