Skip to content

Commit b5e5555

Browse files
Christoph Hellwigaxboe
authored andcommitted
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent dcc02c1 commit b5e5555

File tree

14 files changed

+14
-70
lines changed

14 files changed

+14
-70
lines changed

drivers/ata/libata-sff.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3147,15 +3147,9 @@ void ata_pci_bmdma_init(struct ata_host *host)
31473147
* ->sff_irq_clear method. Try to initialize bmdma_addr
31483148
* regardless of dma masks.
31493149
*/
3150-
rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
3150+
rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
31513151
if (rc)
31523152
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-
}
31593153

31603154
/* request and iomap DMA region */
31613155
rc = pcim_iomap_regions(pdev, 1 << 4, dev_driver_string(gdev));

drivers/ata/pata_atp867x.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -463,12 +463,7 @@ static int atp867x_ata_pci_sff_init_host(struct ata_host *host)
463463

464464
atp867x_fixup(host);
465465

466-
rc = dma_set_mask(&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;
466+
return dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
472467
}
473468

474469
static int atp867x_init_one(struct pci_dev *pdev,

drivers/ata/pata_cs5520.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,10 @@ static int cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
155155
return -ENODEV;
156156
}
157157

158-
if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
158+
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
159159
printk(KERN_ERR DRV_NAME ": unable to configure DMA mask.\n");
160160
return -ENODEV;
161161
}
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-
}
166162

167163
/* Map IO ports and initialize host accordingly */
168164
iomap[0] = devm_ioport_map(&pdev->dev, cmd_port[0], 8);

drivers/ata/pata_hpt3x3.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,7 @@ static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
221221
if (rc)
222222
return rc;
223223
host->iomap = pcim_iomap_table(pdev);
224-
rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
225-
if (rc)
226-
return rc;
227-
rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
224+
rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
228225
if (rc)
229226
return rc;
230227

drivers/ata/pata_ninja32.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,7 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id)
123123
return rc;
124124

125125
host->iomap = pcim_iomap_table(dev);
126-
rc = dma_set_mask(&dev->dev, ATA_DMA_MASK);
127-
if (rc)
128-
return rc;
129-
rc = dma_set_coherent_mask(&dev->dev, ATA_DMA_MASK);
126+
rc = dma_set_mask_and_coherent(&dev->dev, ATA_DMA_MASK);
130127
if (rc)
131128
return rc;
132129
pci_set_master(dev);

drivers/ata/pata_pdc2027x.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,7 @@ static int pdc2027x_init_one(struct pci_dev *pdev,
722722
return rc;
723723
host->iomap = pcim_iomap_table(pdev);
724724

725-
rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
726-
if (rc)
727-
return rc;
728-
729-
rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
725+
rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
730726
if (rc)
731727
return rc;
732728

drivers/ata/pata_sil680.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,7 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
374374
host->iomap = pcim_iomap_table(pdev);
375375

376376
/* Setup DMA masks */
377-
rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
378-
if (rc)
379-
return rc;
380-
rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
377+
rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
381378
if (rc)
382379
return rc;
383380
pci_set_master(pdev);

drivers/ata/sata_inic162x.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -862,18 +862,12 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
862862
}
863863

864864
/* 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));
866866
if (rc) {
867867
dev_err(&pdev->dev, "32-bit DMA enable failed\n");
868868
return rc;
869869
}
870870

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-
877871
rc = init_controller(hpriv->mmio_base, hpriv->cached_hctl);
878872
if (rc) {
879873
dev_err(&pdev->dev, "failed to initialize controller\n");

drivers/ata/sata_promise.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,10 +1230,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev,
12301230
/* initialize adapter */
12311231
pdc_host_init(host);
12321232

1233-
rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
1234-
if (rc)
1235-
return rc;
1236-
rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
1233+
rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
12371234
if (rc)
12381235
return rc;
12391236

drivers/ata/sata_sil.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,10 +757,7 @@ static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
757757
return rc;
758758
host->iomap = pcim_iomap_table(pdev);
759759

760-
rc = dma_set_mask(&pdev->dev, ATA_DMA_MASK);
761-
if (rc)
762-
return rc;
763-
rc = dma_set_coherent_mask(&pdev->dev, ATA_DMA_MASK);
760+
rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
764761
if (rc)
765762
return rc;
766763

0 commit comments

Comments
 (0)