]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/parport/parport_pc.c
Merge gregkh@master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
[linux-2.6-omap-h63xx.git] / drivers / parport / parport_pc.c
index c5774e7855d0362acbea8c7c5eb32049e0332612..1b938bb9be3cc0a985c8b22d80fbdac97344e33a 100644 (file)
 
 #define PARPORT_PC_MAX_PORTS PARPORT_MAX
 
+#ifdef CONFIG_ISA_DMA_API
+#define HAS_DMA
+#endif
+
 /* ECR modes */
 #define ECR_SPP 00
 #define ECR_PS2 01
@@ -610,6 +614,7 @@ dump_parport_state ("leave fifo_write_block_pio", port);
        return length - left;
 }
 
+#ifdef HAS_DMA
 static size_t parport_pc_fifo_write_block_dma (struct parport *port,
                                               const void *buf, size_t length)
 {
@@ -732,6 +737,17 @@ dump_parport_state ("enter fifo_write_block_dma", port);
 dump_parport_state ("leave fifo_write_block_dma", port);
        return length - left;
 }
+#endif
+
+static inline size_t parport_pc_fifo_write_block(struct parport *port,
+                                              const void *buf, size_t length)
+{
+#ifdef HAS_DMA
+       if (port->dma != PARPORT_DMA_NONE)
+               return parport_pc_fifo_write_block_dma (port, buf, length);
+#endif
+       return parport_pc_fifo_write_block_pio (port, buf, length);
+}
 
 /* Parallel Port FIFO mode (ECP chipsets) */
 static size_t parport_pc_compat_write_block_pio (struct parport *port,
@@ -758,10 +774,7 @@ static size_t parport_pc_compat_write_block_pio (struct parport *port,
        port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA;
 
        /* Write the data to the FIFO. */
-       if (port->dma != PARPORT_DMA_NONE)
-               written = parport_pc_fifo_write_block_dma (port, buf, length);
-       else
-               written = parport_pc_fifo_write_block_pio (port, buf, length);
+       written = parport_pc_fifo_write_block(port, buf, length);
 
        /* Finish up. */
        /* For some hardware we don't want to touch the mode until
@@ -856,10 +869,7 @@ static size_t parport_pc_ecp_write_block_pio (struct parport *port,
        port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA;
 
        /* Write the data to the FIFO. */
-       if (port->dma != PARPORT_DMA_NONE)
-               written = parport_pc_fifo_write_block_dma (port, buf, length);
-       else
-               written = parport_pc_fifo_write_block_pio (port, buf, length);
+       written = parport_pc_fifo_write_block(port, buf, length);
 
        /* Finish up. */
        /* For some hardware we don't want to touch the mode until
@@ -2285,6 +2295,7 @@ struct parport *parport_pc_probe_port (unsigned long int base,
                }
 
 #ifdef CONFIG_PARPORT_PC_FIFO
+#ifdef HAS_DMA
                if (p->dma != PARPORT_DMA_NONE) {
                        if (request_dma (p->dma, p->name)) {
                                printk (KERN_WARNING "%s: dma %d in use, "
@@ -2306,7 +2317,8 @@ struct parport *parport_pc_probe_port (unsigned long int base,
                                }
                        }
                }
-#endif /* CONFIG_PARPORT_PC_FIFO */
+#endif
+#endif
        }
 
        /* Done probing.  Now put the port into a sensible start-up state. */
@@ -2367,11 +2379,13 @@ void parport_pc_unregister_port (struct parport *p)
        if (p->modes & PARPORT_MODE_ECP)
                release_region(p->base_hi, 3);
 #ifdef CONFIG_PARPORT_PC_FIFO
+#ifdef HAS_DMA
        if (priv->dma_buf)
                pci_free_consistent(priv->dev, PAGE_SIZE,
                                    priv->dma_buf,
                                    priv->dma_handle);
-#endif /* CONFIG_PARPORT_PC_FIFO */
+#endif
+#endif
        kfree (p->private_data);
        parport_put_port(p);
        kfree (ops); /* hope no-one cached it */
@@ -2725,6 +2739,7 @@ enum parport_pc_pci_cards {
        syba_2p_epp,
        syba_1p_ecp,
        titan_010l,
+       titan_1284p1,
        titan_1284p2,
        avlab_1p,
        avlab_2p,
@@ -2737,7 +2752,6 @@ enum parport_pc_pci_cards {
        netmos_9755,
        netmos_9805,
        netmos_9815,
-       netmos_9855,
 };
 
 
@@ -2798,6 +2812,7 @@ static struct parport_pc_pci {
        /* syba_2p_epp AP138B */        { 2, { { 0, 0x078 }, { 0, 0x178 }, } },
        /* syba_1p_ecp W83787 */        { 1, { { 0, 0x078 }, } },
        /* titan_010l */                { 1, { { 3, -1 }, } },
+       /* titan_1284p1 */              { 1, { { 0, 1 }, } },
        /* titan_1284p2 */              { 2, { { 0, 1 }, { 2, 3 }, } },
        /* avlab_1p             */      { 1, { { 0, 1}, } },
        /* avlab_2p             */      { 2, { { 0, 1}, { 2, 3 },} },
@@ -2812,7 +2827,6 @@ static struct parport_pc_pci {
         /* netmos_9755 */               { 2, { { 0, 1 }, { 2, 3 },} }, /* untested */
        /* netmos_9805 */               { 1, { { 0, -1 }, } }, /* untested */
        /* netmos_9815 */               { 2, { { 0, -1 }, { 2, -1 }, } }, /* untested */
-       /* netmos_9855 */               { 2, { { 0, -1 }, { 2, -1 }, } }, /* untested */
 };
 
 static struct pci_device_id parport_pc_pci_tbl[] = {
@@ -2872,6 +2886,7 @@ static struct pci_device_id parport_pc_pci_tbl[] = {
          PCI_ANY_ID, PCI_ANY_ID, 0, 0, syba_1p_ecp },
        { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_010L,
          PCI_ANY_ID, PCI_ANY_ID, 0, 0, titan_010l },
+       { 0x9710, 0x9805, 0x1000, 0x0010, 0, 0, titan_1284p1 },
        { 0x9710, 0x9815, 0x1000, 0x0020, 0, 0, titan_1284p2 },
        /* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/
        { 0x14db, 0x2120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1p}, /* AFAVLAB_TK9902 */
@@ -2893,8 +2908,6 @@ static struct pci_device_id parport_pc_pci_tbl[] = {
          PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9805 },
        { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9815,
          PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9815 },
-       { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9855,
-         PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9855 },
        { 0, } /* terminate list */
 };
 MODULE_DEVICE_TABLE(pci,parport_pc_pci_tbl);
@@ -2997,8 +3010,8 @@ static int __init parport_pc_init_superio (int autoirq, int autodma)
        struct pci_dev *pdev = NULL;
        int ret = 0;
 
-       while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
-               id = pci_match_device (parport_pc_pci_tbl, pdev);
+       for_each_pci_dev(pdev) {
+               id = pci_match_id(parport_pc_pci_tbl, pdev);
                if (id == NULL || id->driver_data >= last_sio)
                        continue;