diff options
author | Christoph Hellwig <hch@lst.de> | 2019-08-26 06:57:25 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-08-26 15:58:59 -0400 |
commit | b5e55556182d2e43da035df1bffbd492c72a7994 (patch) | |
tree | 53f0636e32e98fa861650e8b4378227c7dd21481 | |
parent | dcc02c19cc06bd7bc1b6db0aa0087a2b6eb05b94 (diff) |
libata: switch remaining drivers to use dma_set_mask_and_coherent
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>
-rw-r--r-- | drivers/ata/libata-sff.c | 8 | ||||
-rw-r--r-- | drivers/ata/pata_atp867x.c | 7 | ||||
-rw-r--r-- | drivers/ata/pata_cs5520.c | 6 | ||||
-rw-r--r-- | drivers/ata/pata_hpt3x3.c | 5 | ||||
-rw-r--r-- | drivers/ata/pata_ninja32.c | 5 | ||||
-rw-r--r-- | drivers/ata/pata_pdc2027x.c | 6 | ||||
-rw-r--r-- | drivers/ata/pata_sil680.c | 5 | ||||
-rw-r--r-- | drivers/ata/sata_inic162x.c | 8 | ||||
-rw-r--r-- | drivers/ata/sata_promise.c | 5 | ||||
-rw-r--r-- | drivers/ata/sata_sil.c | 5 | ||||
-rw-r--r-- | drivers/ata/sata_svw.c | 5 | ||||
-rw-r--r-- | drivers/ata/sata_sx4.c | 5 | ||||
-rw-r--r-- | drivers/ata/sata_via.c | 9 | ||||
-rw-r--r-- | drivers/ata/sata_vsc.c | 5 |
14 files changed, 14 insertions, 70 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 10aa27882142..d911514de05c 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -3147,15 +3147,9 @@ void ata_pci_bmdma_init(struct ata_host *host) | |||
3147 | * ->sff_irq_clear method. Try to initialize bmdma_addr | 3147 | * ->sff_irq_clear method. Try to initialize bmdma_addr |
3148 | * regardless of dma masks. | 3148 | * regardless of dma masks. |
3149 | */ | 3149 | */ |
3150 | rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK); | 3150 | rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK); |
3151 | if (rc) | 3151 | if (rc) |
3152 | ata_bmdma_nodma(host, "failed to set dma mask"); | 3152 | ata_bmdma_nodma(host, "failed to set dma mask"); |
3153 | if (!rc) { | ||
3154 | rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK); | ||
3155 | if (rc) | ||
3156 | ata_bmdma_nodma(host, | ||
3157 | "failed to set consistent dma mask"); | ||
3158 | } | ||
3159 | 3153 | ||
3160 | /* request and iomap DMA region */ | 3154 | /* request and iomap DMA region */ |
3161 | rc = pcim_iomap_regions(pdev, 1 << 4, dev_driver_string(gdev)); | 3155 | rc = pcim_iomap_regions(pdev, 1 << 4, dev_driver_string(gdev)); |
diff --git a/drivers/ata/pata_atp867x.c b/drivers/ata/pata_atp867x.c index 2b9ed4ddef8d..cfd0cf2cbca6 100644 --- a/drivers/ata/pata_atp867x.c +++ b/drivers/ata/pata_atp867x.c | |||
@@ -463,12 +463,7 @@ static int atp867x_ata_pci_sff_init_host(struct ata_host *host) | |||
463 | 463 | ||
464 | atp867x_fixup(host); | 464 | atp867x_fixup(host); |
465 | 465 | ||
466 | rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK); | 466 | return dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK); |
467 | if (rc) | ||
468 | return rc; | ||
469 | |||
470 | rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK); | ||
471 | return rc; | ||
472 | } | 467 | } |
473 | 468 | ||
474 | static int atp867x_init_one(struct pci_dev *pdev, | 469 | static int atp867x_init_one(struct pci_dev *pdev, |
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c index 099a5c68a4c9..9052148b306d 100644 --- a/drivers/ata/pata_cs5520.c +++ b/drivers/ata/pata_cs5520.c | |||
@@ -155,14 +155,10 @@ static int cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
155 | return -ENODEV; | 155 | return -ENODEV; |
156 | } | 156 | } |
157 | 157 | ||
158 | if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { | 158 | if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { |
159 | printk(KERN_ERR DRV_NAME ": unable to configure DMA mask.\n"); | 159 | printk(KERN_ERR DRV_NAME ": unable to configure DMA mask.\n"); |
160 | return -ENODEV; | 160 | return -ENODEV; |
161 | } | 161 | } |
162 | if (dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32))) { | ||
163 | printk(KERN_ERR DRV_NAME ": unable to configure consistent DMA mask.\n"); | ||
164 | return -ENODEV; | ||
165 | } | ||
166 | 162 | ||
167 | /* Map IO ports and initialize host accordingly */ | 163 | /* Map IO ports and initialize host accordingly */ |
168 | iomap[0] = devm_ioport_map(&pdev->dev, cmd_port[0], 8); | 164 | iomap[0] = devm_ioport_map(&pdev->dev, cmd_port[0], 8); |
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c index b2fc023783b1..83974d5eb387 100644 --- a/drivers/ata/pata_hpt3x3.c +++ b/drivers/ata/pata_hpt3x3.c | |||
@@ -221,10 +221,7 @@ static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
221 | if (rc) | 221 | if (rc) |
222 | return rc; | 222 | return rc; |
223 | host->iomap = pcim_iomap_table(pdev); | 223 | host->iomap = pcim_iomap_table(pdev); |
224 | rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK); | 224 | rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK); |
225 | if (rc) | ||
226 | return rc; | ||
227 | rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK); | ||
228 | if (rc) | 225 | if (rc) |
229 | return rc; | 226 | return rc; |
230 | 227 | ||
diff --git a/drivers/ata/pata_ninja32.c b/drivers/ata/pata_ninja32.c index 607db1f05f9a..f9255d6fd194 100644 --- a/drivers/ata/pata_ninja32.c +++ b/drivers/ata/pata_ninja32.c | |||
@@ -123,10 +123,7 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
123 | return rc; | 123 | return rc; |
124 | 124 | ||
125 | host->iomap = pcim_iomap_table(dev); | 125 | host->iomap = pcim_iomap_table(dev); |
126 | rc = dma_set_mask(&dev->dev, ATA_DMA_MASK); | 126 | rc = dma_set_mask_and_coherent(&dev->dev, ATA_DMA_MASK); |
127 | if (rc) | ||
128 | return rc; | ||
129 | rc = dma_set_coherent_mask(&dev->dev, ATA_DMA_MASK); | ||
130 | if (rc) | 127 | if (rc) |
131 | return rc; | 128 | return rc; |
132 | pci_set_master(dev); | 129 | pci_set_master(dev); |
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c index b656e1536855..de834fbb6dfe 100644 --- a/drivers/ata/pata_pdc2027x.c +++ b/drivers/ata/pata_pdc2027x.c | |||
@@ -722,11 +722,7 @@ static int pdc2027x_init_one(struct pci_dev *pdev, | |||
722 | return rc; | 722 | return rc; |
723 | host->iomap = pcim_iomap_table(pdev); | 723 | host->iomap = pcim_iomap_table(pdev); |
724 | 724 | ||
725 | rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK); | 725 | rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK); |
726 | if (rc) | ||
727 | return rc; | ||
728 | |||
729 | rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK); | ||
730 | if (rc) | 726 | if (rc) |
731 | return rc; | 727 | return rc; |
732 | 728 | ||
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c index c14071be4f55..7ab9aea3b630 100644 --- a/drivers/ata/pata_sil680.c +++ b/drivers/ata/pata_sil680.c | |||
@@ -374,10 +374,7 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
374 | host->iomap = pcim_iomap_table(pdev); | 374 | host->iomap = pcim_iomap_table(pdev); |
375 | 375 | ||
376 | /* Setup DMA masks */ | 376 | /* Setup DMA masks */ |
377 | rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK); | 377 | rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK); |
378 | if (rc) | ||
379 | return rc; | ||
380 | rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK); | ||
381 | if (rc) | 378 | if (rc) |
382 | return rc; | 379 | return rc; |
383 | pci_set_master(pdev); | 380 | pci_set_master(pdev); |
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index 790968497dfe..7f99e23bff88 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c | |||
@@ -862,18 +862,12 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
862 | } | 862 | } |
863 | 863 | ||
864 | /* Set dma_mask. This devices doesn't support 64bit addressing. */ | 864 | /* Set dma_mask. This devices doesn't support 64bit addressing. */ |
865 | rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); | 865 | rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
866 | if (rc) { | 866 | if (rc) { |
867 | dev_err(&pdev->dev, "32-bit DMA enable failed\n"); | 867 | dev_err(&pdev->dev, "32-bit DMA enable failed\n"); |
868 | return rc; | 868 | return rc; |
869 | } | 869 | } |
870 | 870 | ||
871 | rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); | ||
872 | if (rc) { | ||
873 | dev_err(&pdev->dev, "32-bit consistent DMA enable failed\n"); | ||
874 | return rc; | ||
875 | } | ||
876 | |||
877 | rc = init_controller(hpriv->mmio_base, hpriv->cached_hctl); | 871 | rc = init_controller(hpriv->mmio_base, hpriv->cached_hctl); |
878 | if (rc) { | 872 | if (rc) { |
879 | dev_err(&pdev->dev, "failed to initialize controller\n"); | 873 | dev_err(&pdev->dev, "failed to initialize controller\n"); |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index f4dfec3b6e42..5fd464765ddc 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -1230,10 +1230,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev, | |||
1230 | /* initialize adapter */ | 1230 | /* initialize adapter */ |
1231 | pdc_host_init(host); | 1231 | pdc_host_init(host); |
1232 | 1232 | ||
1233 | rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK); | 1233 | rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK); |
1234 | if (rc) | ||
1235 | return rc; | ||
1236 | rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK); | ||
1237 | if (rc) | 1234 | if (rc) |
1238 | return rc; | 1235 | return rc; |
1239 | 1236 | ||
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index 25b6a52be5ab..e6fbae2f645a 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -757,10 +757,7 @@ static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
757 | return rc; | 757 | return rc; |
758 | host->iomap = pcim_iomap_table(pdev); | 758 | host->iomap = pcim_iomap_table(pdev); |
759 | 759 | ||
760 | rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK); | 760 | rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK); |
761 | if (rc) | ||
762 | return rc; | ||
763 | rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK); | ||
764 | if (rc) | 761 | if (rc) |
765 | return rc; | 762 | return rc; |
766 | 763 | ||
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c index b903d55c6c20..f8552559db7f 100644 --- a/drivers/ata/sata_svw.c +++ b/drivers/ata/sata_svw.c | |||
@@ -471,10 +471,7 @@ static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *en | |||
471 | ata_port_pbar_desc(ap, 5, offset, "port"); | 471 | ata_port_pbar_desc(ap, 5, offset, "port"); |
472 | } | 472 | } |
473 | 473 | ||
474 | rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK); | 474 | rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK); |
475 | if (rc) | ||
476 | return rc; | ||
477 | rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK); | ||
478 | if (rc) | 475 | if (rc) |
479 | return rc; | 476 | return rc; |
480 | 477 | ||
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c index ae8e374d0a77..2277ba0c9c7f 100644 --- a/drivers/ata/sata_sx4.c +++ b/drivers/ata/sata_sx4.c | |||
@@ -1470,10 +1470,7 @@ static int pdc_sata_init_one(struct pci_dev *pdev, | |||
1470 | } | 1470 | } |
1471 | 1471 | ||
1472 | /* configure and activate */ | 1472 | /* configure and activate */ |
1473 | rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK); | 1473 | rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK); |
1474 | if (rc) | ||
1475 | return rc; | ||
1476 | rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK); | ||
1477 | if (rc) | 1474 | if (rc) |
1478 | return rc; | 1475 | return rc; |
1479 | 1476 | ||
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index fcb9245b184f..c7891cc84ea0 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -505,14 +505,7 @@ static int vt6421_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) | |||
505 | for (i = 0; i < host->n_ports; i++) | 505 | for (i = 0; i < host->n_ports; i++) |
506 | vt6421_init_addrs(host->ports[i]); | 506 | vt6421_init_addrs(host->ports[i]); |
507 | 507 | ||
508 | rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK); | 508 | return dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK); |
509 | if (rc) | ||
510 | return rc; | ||
511 | rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK); | ||
512 | if (rc) | ||
513 | return rc; | ||
514 | |||
515 | return 0; | ||
516 | } | 509 | } |
517 | 510 | ||
518 | static int vt8251_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) | 511 | static int vt8251_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) |
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c index fd401e9164ef..8fa952cb9f7f 100644 --- a/drivers/ata/sata_vsc.c +++ b/drivers/ata/sata_vsc.c | |||
@@ -371,10 +371,7 @@ static int vsc_sata_init_one(struct pci_dev *pdev, | |||
371 | /* | 371 | /* |
372 | * Use 32 bit DMA mask, because 64 bit address support is poor. | 372 | * Use 32 bit DMA mask, because 64 bit address support is poor. |
373 | */ | 373 | */ |
374 | rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); | 374 | rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
375 | if (rc) | ||
376 | return rc; | ||
377 | rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); | ||
378 | if (rc) | 375 | if (rc) |
379 | return rc; | 376 | return rc; |
380 | 377 | ||