pcmcia: introduce autoconfiguration feature
[linux-2.6.git] / drivers / parport / parport_cs.c
index fd8cfe9..8c2a473 100644 (file)
@@ -48,8 +48,6 @@
 #include <linux/parport.h>
 #include <linux/parport_pc.h>
 
-#include <pcmcia/cs_types.h>
-#include <pcmcia/cs.h>
 #include <pcmcia/cistpl.h>
 #include <pcmcia/ds.h>
 #include <pcmcia/cisreg.h>
@@ -102,10 +100,9 @@ static int parport_probe(struct pcmcia_device *link)
     link->priv = info;
     info->p_dev = link;
 
-    link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
-    link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
-    link->conf.Attributes = CONF_ENABLE_IRQ;
-    link->conf.IntType = INT_MEMORY_AND_IO;
+    link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
+    link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
+    link->config_flags |= CONF_ENABLE_IRQ;
 
     return parport_config(link);
 } /* parport_attach */
@@ -139,21 +136,20 @@ static void parport_detach(struct pcmcia_device *link)
 static int parport_config_check(struct pcmcia_device *p_dev,
                                cistpl_cftable_entry_t *cfg,
                                cistpl_cftable_entry_t *dflt,
-                               unsigned int vcc,
                                void *priv_data)
 {
        if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
                cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
+               p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
                if (epp_mode)
-                       p_dev->conf.ConfigIndex |= FORCE_EPP_MODE;
-               p_dev->io.BasePort1 = io->win[0].base;
-               p_dev->io.NumPorts1 = io->win[0].len;
-               p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
+                       p_dev->config_index |= FORCE_EPP_MODE;
+               p_dev->resource[0]->start = io->win[0].base;
+               p_dev->resource[0]->end = io->win[0].len;
                if (io->nwin == 2) {
-                       p_dev->io.BasePort2 = io->win[1].base;
-                       p_dev->io.NumPorts2 = io->win[1].len;
+                       p_dev->resource[1]->start = io->win[1].base;
+                       p_dev->resource[1]->end = io->win[1].len;
                }
-               if (pcmcia_request_io(p_dev, &p_dev->io) != 0)
+               if (pcmcia_request_io(p_dev) != 0)
                        return -ENODEV;
                return 0;
        }
@@ -174,16 +170,18 @@ static int parport_config(struct pcmcia_device *link)
 
     if (!link->irq)
            goto failed;
-    ret = pcmcia_request_configuration(link, &link->conf);
+    ret = pcmcia_enable_device(link);
     if (ret)
            goto failed;
 
-    p = parport_pc_probe_port(link->io.BasePort1, link->io.BasePort2,
+    p = parport_pc_probe_port(link->resource[0]->start,
+                             link->resource[1]->start,
                              link->irq, PARPORT_DMA_NONE,
                              &link->dev, IRQF_SHARED);
     if (p == NULL) {
        printk(KERN_NOTICE "parport_cs: parport_pc_probe_port() at "
-              "0x%3x, irq %u failed\n", link->io.BasePort1,
+              "0x%3x, irq %u failed\n",
+              (unsigned int) link->resource[0]->start,
               link->irq);
        goto failed;
     }