]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
libata: switch remaining drivers to use dma_set_mask_and_coherent
authorChristoph Hellwig <hch@lst.de>
Mon, 26 Aug 2019 10:57:25 +0000 (12:57 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 26 Aug 2019 19:58:59 +0000 (13:58 -0600)
Use dma_set_mask_and_coherent instead of separate dma_set_mask and
dma_set_coherent_mask calls.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
14 files changed:
drivers/ata/libata-sff.c
drivers/ata/pata_atp867x.c
drivers/ata/pata_cs5520.c
drivers/ata/pata_hpt3x3.c
drivers/ata/pata_ninja32.c
drivers/ata/pata_pdc2027x.c
drivers/ata/pata_sil680.c
drivers/ata/sata_inic162x.c
drivers/ata/sata_promise.c
drivers/ata/sata_sil.c
drivers/ata/sata_svw.c
drivers/ata/sata_sx4.c
drivers/ata/sata_via.c
drivers/ata/sata_vsc.c

index 10aa2788214279b1682135e77fc22ac0007e6190..d911514de05c3a50ed3a17b67c3b91f4fcb62714 100644 (file)
@@ -3147,15 +3147,9 @@ void ata_pci_bmdma_init(struct ata_host *host)
         * ->sff_irq_clear method.  Try to initialize bmdma_addr
         * regardless of dma masks.
         */
-       rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
+       rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
        if (rc)
                ata_bmdma_nodma(host, "failed to set dma mask");
-       if (!rc) {
-               rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
-               if (rc)
-                       ata_bmdma_nodma(host,
-                                       "failed to set consistent dma mask");
-       }
 
        /* request and iomap DMA region */
        rc = pcim_iomap_regions(pdev, 1 << 4, dev_driver_string(gdev));
index 2b9ed4ddef8ded6e1772eafda8f215547e4fcd3b..cfd0cf2cbca6caaaab2fd2b2d424375bb09a95a2 100644 (file)
@@ -463,12 +463,7 @@ static int atp867x_ata_pci_sff_init_host(struct ata_host *host)
 
        atp867x_fixup(host);
 
-       rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
-       if (rc)
-               return rc;
-
-       rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
-       return rc;
+       return dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
 }
 
 static int atp867x_init_one(struct pci_dev *pdev,
index 099a5c68a4c99863f0528b88a2aa2b7449000f21..9052148b306d9f157e5b2e22c04a8282add07c2d 100644 (file)
@@ -155,14 +155,10 @@ static int cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
                return -ENODEV;
        }
 
-       if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
+       if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
                printk(KERN_ERR DRV_NAME ": unable to configure DMA mask.\n");
                return -ENODEV;
        }
-       if (dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32))) {
-               printk(KERN_ERR DRV_NAME ": unable to configure consistent DMA mask.\n");
-               return -ENODEV;
-       }
 
        /* Map IO ports and initialize host accordingly */
        iomap[0] = devm_ioport_map(&pdev->dev, cmd_port[0], 8);
index b2fc023783b15c3338160d3a0370a4e494b5db6f..83974d5eb3871d15a6eb9a5513a6efb3d003a220 100644 (file)
@@ -221,10 +221,7 @@ static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
        if (rc)
                return rc;
        host->iomap = pcim_iomap_table(pdev);
-       rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
-       if (rc)
-               return rc;
-       rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
+       rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
        if (rc)
                return rc;
 
index 607db1f05f9a01563dc5611f0a2de354315f1289..f9255d6fd19406b8c009e0ca8ec2596decc818bb 100644 (file)
@@ -123,10 +123,7 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id)
                return rc;
 
        host->iomap = pcim_iomap_table(dev);
-       rc = dma_set_mask(&dev->dev, ATA_DMA_MASK);
-       if (rc)
-               return rc;
-       rc = dma_set_coherent_mask(&dev->dev, ATA_DMA_MASK);
+       rc = dma_set_mask_and_coherent(&dev->dev, ATA_DMA_MASK);
        if (rc)
                return rc;
        pci_set_master(dev);
index b656e15368554d4b84d65e2be3ce8020ba889fe2..de834fbb6dfe6eb301086667248a3a9d68ffa982 100644 (file)
@@ -722,11 +722,7 @@ static int pdc2027x_init_one(struct pci_dev *pdev,
                return rc;
        host->iomap = pcim_iomap_table(pdev);
 
-       rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
-       if (rc)
-               return rc;
-
-       rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
+       rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
        if (rc)
                return rc;
 
index c14071be4f55f2f5222f5599b7570bba6de4d430..7ab9aea3b6305dd9ba1aad6c2650d3cd7ebb4c5b 100644 (file)
@@ -374,10 +374,7 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
        host->iomap = pcim_iomap_table(pdev);
 
        /* Setup DMA masks */
-       rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
-       if (rc)
-               return rc;
-       rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
+       rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
        if (rc)
                return rc;
        pci_set_master(pdev);
index 790968497dfe86cd234c860b9eacf5b6683d615e..7f99e23bff88c31e02938ca8fd85bb10ef33cea8 100644 (file)
@@ -862,18 +862,12 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        }
 
        /* Set dma_mask.  This devices doesn't support 64bit addressing. */
-       rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+       rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
        if (rc) {
                dev_err(&pdev->dev, "32-bit DMA enable failed\n");
                return rc;
        }
 
-       rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
-       if (rc) {
-               dev_err(&pdev->dev, "32-bit consistent DMA enable failed\n");
-               return rc;
-       }
-
        rc = init_controller(hpriv->mmio_base, hpriv->cached_hctl);
        if (rc) {
                dev_err(&pdev->dev, "failed to initialize controller\n");
index f4dfec3b6e424146a90c00b5d9a53146dca6bdf2..5fd464765ddcb5195c3fe731992d792b6912faf9 100644 (file)
@@ -1230,10 +1230,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev,
        /* initialize adapter */
        pdc_host_init(host);
 
-       rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
-       if (rc)
-               return rc;
-       rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
+       rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
        if (rc)
                return rc;
 
index 25b6a52be5abac7b575b43d324e385cbf034b06a..e6fbae2f645acf5f74dd48d52a209732fde879f5 100644 (file)
@@ -757,10 +757,7 @@ static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                return rc;
        host->iomap = pcim_iomap_table(pdev);
 
-       rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
-       if (rc)
-               return rc;
-       rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
+       rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
        if (rc)
                return rc;
 
index b903d55c6c20d50c28724b45c00fd4b81c7361f7..f8552559db7f5c1962c892e12c92f790c5eb98c5 100644 (file)
@@ -471,10 +471,7 @@ static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *en
                ata_port_pbar_desc(ap, 5, offset, "port");
        }
 
-       rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
-       if (rc)
-               return rc;
-       rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
+       rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
        if (rc)
                return rc;
 
index ae8e374d0a77cc049e351b3e7813bd0c3af64858..2277ba0c9c7f4c527f2db952fe7ba5885631f2ba 100644 (file)
@@ -1470,10 +1470,7 @@ static int pdc_sata_init_one(struct pci_dev *pdev,
        }
 
        /* configure and activate */
-       rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
-       if (rc)
-               return rc;
-       rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
+       rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
        if (rc)
                return rc;
 
index fcb9245b184f53371032c8c2e96790f0fc1409a0..c7891cc84ea0bb7d4d3da77d1026d04d22556fa5 100644 (file)
@@ -505,14 +505,7 @@ static int vt6421_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
        for (i = 0; i < host->n_ports; i++)
                vt6421_init_addrs(host->ports[i]);
 
-       rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
-       if (rc)
-               return rc;
-       rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
-       if (rc)
-               return rc;
-
-       return 0;
+       return dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
 }
 
 static int vt8251_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
index fd401e9164ef4a4c4b11a1531e9f8843926ccc3f..8fa952cb9f7f4bf150db781f4d8ba1e09f5992d0 100644 (file)
@@ -371,10 +371,7 @@ static int vsc_sata_init_one(struct pci_dev *pdev,
        /*
         * Use 32 bit DMA mask, because 64 bit address support is poor.
         */
-       rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
-       if (rc)
-               return rc;
-       rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+       rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
        if (rc)
                return rc;