pcmcia: use autoconfiguration feature for ioports and iomem
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / scsi / pcmcia / aha152x_stub.c
index 0b5fc2fa05898e884126fb51fb98c42c5b09767e..bd9ce09b7ff819c73da0523e3280e5c02ce94e96 100644 (file)
@@ -99,9 +99,7 @@ static int aha152x_probe(struct pcmcia_device *link)
     info->p_dev = link;
     link->priv = info;
 
-    link->resource[0]->end = 0x20;
-    link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
-    link->config_flags |= CONF_ENABLE_IRQ;
+    link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
     link->config_regs = PRESENT_OPTION;
 
     return aha152x_config_cs(link);
@@ -121,24 +119,24 @@ static void aha152x_detach(struct pcmcia_device *link)
 
 /*====================================================================*/
 
-static int aha152x_config_check(struct pcmcia_device *p_dev,
-                               cistpl_cftable_entry_t *cfg,
-                               cistpl_cftable_entry_t *dflt,
-                               void *priv_data)
+static int aha152x_config_check(struct pcmcia_device *p_dev, void *priv_data)
 {
        p_dev->io_lines = 10;
+
        /* For New Media T&J, look for a SCSI window */
-       if (cfg->io.win[0].len >= 0x20)
-               p_dev->resource[0]->start = cfg->io.win[0].base;
-       else if ((cfg->io.nwin > 1) &&
-                (cfg->io.win[1].len >= 0x20))
-               p_dev->resource[0]->start = cfg->io.win[1].base;
-       if ((cfg->io.nwin > 0) &&
-           (p_dev->resource[0]->start < 0xffff)) {
-               if (!pcmcia_request_io(p_dev))
-                       return 0;
-       }
-       return -EINVAL;
+       if ((p_dev->resource[0]->end < 0x20) &&
+               (p_dev->resource[1]->end >= 0x20))
+               p_dev->resource[0]->start = p_dev->resource[1]->start;
+
+       if (p_dev->resource[0]->start >= 0xffff)
+               return -EINVAL;
+
+       p_dev->resource[1]->start = p_dev->resource[1]->end = 0;
+       p_dev->resource[0]->end = 0x20;
+       p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
+       p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
+
+       return pcmcia_request_io(p_dev);
 }
 
 static int aha152x_config_cs(struct pcmcia_device *link)