forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/scsi/snic/snic_io.c
....@@ -102,7 +102,8 @@
102102 struct snic_req_info *rqi = NULL;
103103 unsigned long flags;
104104
105
- pci_unmap_single(snic->pdev, buf->dma_addr, buf->len, PCI_DMA_TODEVICE);
105
+ dma_unmap_single(&snic->pdev->dev, buf->dma_addr, buf->len,
106
+ DMA_TO_DEVICE);
106107
107108 rqi = req_to_rqi(req);
108109 spin_lock_irqsave(&snic->spl_cmd_lock, flags);
....@@ -172,8 +173,8 @@
172173 snic_print_desc(__func__, os_buf, len);
173174
174175 /* Map request buffer */
175
- pa = pci_map_single(snic->pdev, os_buf, len, PCI_DMA_TODEVICE);
176
- if (pci_dma_mapping_error(snic->pdev, pa)) {
176
+ pa = dma_map_single(&snic->pdev->dev, os_buf, len, DMA_TO_DEVICE);
177
+ if (dma_mapping_error(&snic->pdev->dev, pa)) {
177178 SNIC_HOST_ERR(snic->shost, "qdesc: PCI DMA Mapping Fail.\n");
178179
179180 return -ENOMEM;
....@@ -186,7 +187,7 @@
186187 spin_lock_irqsave(&snic->wq_lock[q_num], flags);
187188 desc_avail = snic_wqdesc_avail(snic, q_num, req->hdr.type);
188189 if (desc_avail <= 0) {
189
- pci_unmap_single(snic->pdev, pa, len, PCI_DMA_TODEVICE);
190
+ dma_unmap_single(&snic->pdev->dev, pa, len, DMA_TO_DEVICE);
190191 req->req_pa = 0;
191192 spin_unlock_irqrestore(&snic->wq_lock[q_num], flags);
192193 atomic64_inc(&snic->s_stats.misc.wq_alloc_fail);
....@@ -350,29 +351,29 @@
350351
351352 if (rqi->abort_req) {
352353 if (rqi->abort_req->req_pa)
353
- pci_unmap_single(snic->pdev,
354
+ dma_unmap_single(&snic->pdev->dev,
354355 rqi->abort_req->req_pa,
355356 sizeof(struct snic_host_req),
356
- PCI_DMA_TODEVICE);
357
+ DMA_TO_DEVICE);
357358
358359 mempool_free(rqi->abort_req, snic->req_pool[SNIC_REQ_TM_CACHE]);
359360 }
360361
361362 if (rqi->dr_req) {
362363 if (rqi->dr_req->req_pa)
363
- pci_unmap_single(snic->pdev,
364
+ dma_unmap_single(&snic->pdev->dev,
364365 rqi->dr_req->req_pa,
365366 sizeof(struct snic_host_req),
366
- PCI_DMA_TODEVICE);
367
+ DMA_TO_DEVICE);
367368
368369 mempool_free(rqi->dr_req, snic->req_pool[SNIC_REQ_TM_CACHE]);
369370 }
370371
371372 if (rqi->req->req_pa)
372
- pci_unmap_single(snic->pdev,
373
+ dma_unmap_single(&snic->pdev->dev,
373374 rqi->req->req_pa,
374375 rqi->req_len,
375
- PCI_DMA_TODEVICE);
376
+ DMA_TO_DEVICE);
376377
377378 mempool_free(rqi, snic->req_pool[rqi->rq_pool_type]);
378379 }
....@@ -384,10 +385,10 @@
384385
385386 sgd = req_to_sgl(rqi_to_req(rqi));
386387 SNIC_BUG_ON(sgd[0].addr == 0);
387
- pci_unmap_single(snic->pdev,
388
+ dma_unmap_single(&snic->pdev->dev,
388389 le64_to_cpu(sgd[0].addr),
389390 le32_to_cpu(sgd[0].len),
390
- PCI_DMA_FROMDEVICE);
391
+ DMA_FROM_DEVICE);
391392 }
392393
393394 /*