Commit 931da2f7 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

sx8: switch to the generic DMA API

The PCI DMA API is deprecated, switch to the generic DMA API instead.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 64ab1fa5
...@@ -861,9 +861,9 @@ static blk_status_t carm_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -861,9 +861,9 @@ static blk_status_t carm_queue_rq(struct blk_mq_hw_ctx *hctx,
if (rq_data_dir(rq) == WRITE) { if (rq_data_dir(rq) == WRITE) {
writing = 1; writing = 1;
pci_dir = PCI_DMA_TODEVICE; pci_dir = DMA_TO_DEVICE;
} else { } else {
pci_dir = PCI_DMA_FROMDEVICE; pci_dir = DMA_FROM_DEVICE;
} }
/* get scatterlist from block layer */ /* get scatterlist from block layer */
...@@ -877,7 +877,7 @@ static blk_status_t carm_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -877,7 +877,7 @@ static blk_status_t carm_queue_rq(struct blk_mq_hw_ctx *hctx,
} }
/* map scatterlist to PCI bus addresses */ /* map scatterlist to PCI bus addresses */
n_elem = pci_map_sg(host->pdev, sg, n_elem, pci_dir); n_elem = dma_map_sg(&host->pdev->dev, sg, n_elem, pci_dir);
if (n_elem <= 0) { if (n_elem <= 0) {
/* request with no s/g entries? */ /* request with no s/g entries? */
carm_end_rq(host, crq, BLK_STS_IOERR); carm_end_rq(host, crq, BLK_STS_IOERR);
...@@ -1058,11 +1058,11 @@ static inline void carm_handle_rw(struct carm_host *host, ...@@ -1058,11 +1058,11 @@ static inline void carm_handle_rw(struct carm_host *host,
VPRINTK("ENTER\n"); VPRINTK("ENTER\n");
if (rq_data_dir(crq->rq) == WRITE) if (rq_data_dir(crq->rq) == WRITE)
pci_dir = PCI_DMA_TODEVICE; pci_dir = DMA_TO_DEVICE;
else else
pci_dir = PCI_DMA_FROMDEVICE; pci_dir = DMA_FROM_DEVICE;
pci_unmap_sg(host->pdev, &crq->sg[0], crq->n_elem, pci_dir); dma_unmap_sg(&host->pdev->dev, &crq->sg[0], crq->n_elem, pci_dir);
carm_end_rq(host, crq, error); carm_end_rq(host, crq, error);
} }
...@@ -1567,8 +1567,8 @@ static void carm_free_disks(struct carm_host *host) ...@@ -1567,8 +1567,8 @@ static void carm_free_disks(struct carm_host *host)
static int carm_init_shm(struct carm_host *host) static int carm_init_shm(struct carm_host *host)
{ {
host->shm = pci_alloc_consistent(host->pdev, CARM_SHM_SIZE, host->shm = dma_alloc_coherent(&host->pdev->dev, CARM_SHM_SIZE,
&host->shm_dma); &host->shm_dma, GFP_KERNEL);
if (!host->shm) if (!host->shm)
return -ENOMEM; return -ENOMEM;
...@@ -1598,7 +1598,7 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1598,7 +1598,7 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc) if (rc)
goto err_out; goto err_out;
rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
if (rc) { if (rc) {
printk(KERN_ERR DRV_NAME "(%s): DMA mask failure\n", printk(KERN_ERR DRV_NAME "(%s): DMA mask failure\n",
pci_name(pdev)); pci_name(pdev));
...@@ -1643,7 +1643,7 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1643,7 +1643,7 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
printk(KERN_ERR DRV_NAME "(%s): OOB queue alloc failure\n", printk(KERN_ERR DRV_NAME "(%s): OOB queue alloc failure\n",
pci_name(pdev)); pci_name(pdev));
rc = PTR_ERR(q); rc = PTR_ERR(q);
goto err_out_pci_free; goto err_out_dma_free;
} }
host->oob_q = q; host->oob_q = q;
q->queuedata = host; q->queuedata = host;
...@@ -1708,8 +1708,8 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1708,8 +1708,8 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
clear_bit(1, &carm_major_alloc); clear_bit(1, &carm_major_alloc);
blk_cleanup_queue(host->oob_q); blk_cleanup_queue(host->oob_q);
blk_mq_free_tag_set(&host->tag_set); blk_mq_free_tag_set(&host->tag_set);
err_out_pci_free: err_out_dma_free:
pci_free_consistent(pdev, CARM_SHM_SIZE, host->shm, host->shm_dma); dma_free_coherent(&pdev->dev, CARM_SHM_SIZE, host->shm, host->shm_dma);
err_out_iounmap: err_out_iounmap:
iounmap(host->mmio); iounmap(host->mmio);
err_out_kfree: err_out_kfree:
...@@ -1740,7 +1740,7 @@ static void carm_remove_one (struct pci_dev *pdev) ...@@ -1740,7 +1740,7 @@ static void carm_remove_one (struct pci_dev *pdev)
clear_bit(1, &carm_major_alloc); clear_bit(1, &carm_major_alloc);
blk_cleanup_queue(host->oob_q); blk_cleanup_queue(host->oob_q);
blk_mq_free_tag_set(&host->tag_set); blk_mq_free_tag_set(&host->tag_set);
pci_free_consistent(pdev, CARM_SHM_SIZE, host->shm, host->shm_dma); dma_free_coherent(&pdev->dev, CARM_SHM_SIZE, host->shm, host->shm_dma);
iounmap(host->mmio); iounmap(host->mmio);
kfree(host); kfree(host);
pci_release_regions(pdev); pci_release_regions(pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment