Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: message: fusion: Remove usage of the deprecated "pci-dma-compat.h" API

In [1], Christoph Hellwig has proposed to remove the wrappers in
include/linux/pci-dma-compat.h.

Some reasons why this API should be removed have been given by Julia Lawall
in [2].

A coccinelle script has been used to perform the needed transformation. It
can be found in [3].

In this patch, all functions but pci_alloc_consistent() are handled.
pci_alloc_consistent() needs more attention and explanation.

[1]: https://lore.kernel.org/kernel-janitors/20200421081257.GA131897@infradead.org/
[2]: https://lore.kernel.org/kernel-janitors/alpine.DEB.2.22.394.2007120902170.2424@hadrien/
[3]: https://lore.kernel.org/kernel-janitors/20200716192821.321233-1-christophe.jaillet@wanadoo.fr/

Link: https://lore.kernel.org/r/e38e897fbd3314718315b0e357c824e3f01775d6.1641500561.git.christophe.jaillet@wanadoo.fr
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Christophe JAILLET and committed by
Martin K. Petersen
b114dda6 315d049a

+154 -132
+50 -44
drivers/message/fusion/mptbase.c
··· 316 316 rc = 1; 317 317 318 318 out_free_consistent: 319 - pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 320 - buffer, dma_handle); 319 + dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, 320 + dma_handle); 321 321 out: 322 322 return rc; 323 323 } ··· 1661 1661 const uint64_t required_mask = dma_get_required_mask 1662 1662 (&pdev->dev); 1663 1663 if (required_mask > DMA_BIT_MASK(32) 1664 - && !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) 1665 - && !pci_set_consistent_dma_mask(pdev, 1666 - DMA_BIT_MASK(64))) { 1664 + && !dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) 1665 + && !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) { 1667 1666 ioc->dma_mask = DMA_BIT_MASK(64); 1668 1667 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT 1669 1668 ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", 1670 1669 ioc->name)); 1671 - } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) 1672 - && !pci_set_consistent_dma_mask(pdev, 1673 - DMA_BIT_MASK(32))) { 1670 + } else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)) 1671 + && !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32))) { 1674 1672 ioc->dma_mask = DMA_BIT_MASK(32); 1675 1673 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT 1676 1674 ": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", ··· 1679 1681 goto out_pci_release_region; 1680 1682 } 1681 1683 } else { 1682 - if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) 1683 - && !pci_set_consistent_dma_mask(pdev, 1684 - DMA_BIT_MASK(32))) { 1684 + if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)) 1685 + && !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32))) { 1685 1686 ioc->dma_mask = DMA_BIT_MASK(32); 1686 1687 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT 1687 1688 ": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", ··· 2766 2769 2767 2770 if (ioc->spi_data.pIocPg4 != NULL) { 2768 2771 sz = ioc->spi_data.IocPg4Sz; 2769 - pci_free_consistent(ioc->pcidev, sz, 2770 - ioc->spi_data.pIocPg4, 2771 - ioc->spi_data.IocPg4_dma); 2772 + dma_free_coherent(&ioc->pcidev->dev, sz, 2773 + ioc->spi_data.pIocPg4, 2774 + ioc->spi_data.IocPg4_dma); 2772 2775 ioc->spi_data.pIocPg4 = NULL; 2773 2776 ioc->alloc_total -= sz; 2774 2777 } ··· 3545 3548 sz = ioc->facts.FWImageSize; 3546 3549 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "free_fw_memory: FW Image @ %p[%p], sz=%d[%x] bytes\n", 3547 3550 ioc->name, ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz)); 3548 - pci_free_consistent(ioc->pcidev, sz, ioc->cached_fw, ioc->cached_fw_dma); 3551 + dma_free_coherent(&ioc->pcidev->dev, sz, ioc->cached_fw, 3552 + ioc->cached_fw_dma); 3549 3553 ioc->alloc_total -= sz; 3550 3554 ioc->cached_fw = NULL; 3551 3555 } ··· 4445 4447 */ 4446 4448 if (ioc->pcidev->device == MPI_MANUFACTPAGE_DEVID_SAS1078 && 4447 4449 ioc->dma_mask > DMA_BIT_MASK(35)) { 4448 - if (!pci_set_dma_mask(ioc->pcidev, DMA_BIT_MASK(32)) 4449 - && !pci_set_consistent_dma_mask(ioc->pcidev, 4450 - DMA_BIT_MASK(32))) { 4450 + if (!dma_set_mask(&ioc->pcidev->dev, DMA_BIT_MASK(32)) 4451 + && !dma_set_coherent_mask(&ioc->pcidev->dev, DMA_BIT_MASK(32))) { 4451 4452 dma_mask = DMA_BIT_MASK(35); 4452 4453 d36memprintk(ioc, printk(MYIOC_s_DEBUG_FMT 4453 4454 "setting 35 bit addressing for " ··· 4454 4457 ioc->name)); 4455 4458 } else { 4456 4459 /*Reseting DMA mask to 64 bit*/ 4457 - pci_set_dma_mask(ioc->pcidev, 4458 - DMA_BIT_MASK(64)); 4459 - pci_set_consistent_dma_mask(ioc->pcidev, 4460 - DMA_BIT_MASK(64)); 4460 + dma_set_mask(&ioc->pcidev->dev, 4461 + DMA_BIT_MASK(64)); 4462 + dma_set_coherent_mask(&ioc->pcidev->dev, 4463 + DMA_BIT_MASK(64)); 4461 4464 4462 4465 printk(MYIOC_s_ERR_FMT 4463 4466 "failed setting 35 bit addressing for " ··· 4592 4595 alloc_dma += ioc->reply_sz; 4593 4596 } 4594 4597 4595 - if (dma_mask == DMA_BIT_MASK(35) && !pci_set_dma_mask(ioc->pcidev, 4596 - ioc->dma_mask) && !pci_set_consistent_dma_mask(ioc->pcidev, 4598 + if (dma_mask == DMA_BIT_MASK(35) && !dma_set_mask(&ioc->pcidev->dev, 4599 + ioc->dma_mask) && !dma_set_coherent_mask(&ioc->pcidev->dev, 4597 4600 ioc->dma_mask)) 4598 4601 d36memprintk(ioc, printk(MYIOC_s_DEBUG_FMT 4599 4602 "restoring 64 bit addressing\n", ioc->name)); ··· 4617 4620 ioc->sense_buf_pool = NULL; 4618 4621 } 4619 4622 4620 - if (dma_mask == DMA_BIT_MASK(35) && !pci_set_dma_mask(ioc->pcidev, 4621 - DMA_BIT_MASK(64)) && !pci_set_consistent_dma_mask(ioc->pcidev, 4623 + if (dma_mask == DMA_BIT_MASK(35) && !dma_set_mask(&ioc->pcidev->dev, 4624 + DMA_BIT_MASK(64)) && !dma_set_coherent_mask(&ioc->pcidev->dev, 4622 4625 DMA_BIT_MASK(64))) 4623 4626 d36memprintk(ioc, printk(MYIOC_s_DEBUG_FMT 4624 4627 "restoring 64 bit addressing\n", ioc->name)); ··· 4979 4982 4980 4983 } 4981 4984 4982 - pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma); 4985 + dma_free_coherent(&ioc->pcidev->dev, data_sz, 4986 + (u8 *)ppage0_alloc, page0_dma); 4983 4987 4984 4988 /* FIXME! 4985 4989 * Normalize endianness of structure data, ··· 5024 5026 memcpy(&ioc->lan_cnfg_page1, ppage1_alloc, copy_sz); 5025 5027 } 5026 5028 5027 - pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage1_alloc, page1_dma); 5029 + dma_free_coherent(&ioc->pcidev->dev, data_sz, 5030 + (u8 *)ppage1_alloc, page1_dma); 5028 5031 5029 5032 /* FIXME! 5030 5033 * Normalize endianness of structure data, ··· 5324 5325 if ((rc = mpt_config(ioc, &cfg)) == 0) 5325 5326 ioc->biosVersion = le32_to_cpu(ppage_alloc->BiosVersion); 5326 5327 5327 - pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage_alloc, page_dma); 5328 + dma_free_coherent(&ioc->pcidev->dev, data_sz, 5329 + (u8 *)ppage_alloc, page_dma); 5328 5330 } 5329 5331 5330 5332 return rc; ··· 5456 5456 } 5457 5457 } 5458 5458 if (pbuf) { 5459 - pci_free_consistent(ioc->pcidev, header.PageLength * 4, pbuf, buf_dma); 5459 + dma_free_coherent(&ioc->pcidev->dev, 5460 + header.PageLength * 4, pbuf, 5461 + buf_dma); 5460 5462 } 5461 5463 } 5462 5464 } ··· 5545 5543 } 5546 5544 } 5547 5545 5548 - pci_free_consistent(ioc->pcidev, header.PageLength * 4, pbuf, buf_dma); 5546 + dma_free_coherent(&ioc->pcidev->dev, 5547 + header.PageLength * 4, pbuf, 5548 + buf_dma); 5549 5549 } 5550 5550 } 5551 5551 ··· 5711 5707 5712 5708 out: 5713 5709 if (buffer) 5714 - pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, buffer, 5715 - dma_handle); 5710 + dma_free_coherent(&ioc->pcidev->dev, hdr.PageLength * 4, 5711 + buffer, dma_handle); 5716 5712 } 5717 5713 5718 5714 /** ··· 5780 5776 out: 5781 5777 5782 5778 if (buffer) 5783 - pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, buffer, 5784 - dma_handle); 5779 + dma_free_coherent(&ioc->pcidev->dev, hdr.PageLength * 4, 5780 + buffer, dma_handle); 5785 5781 5786 5782 return rc; 5787 5783 } ··· 5844 5840 out: 5845 5841 5846 5842 if (buffer) 5847 - pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, buffer, 5848 - dma_handle); 5843 + dma_free_coherent(&ioc->pcidev->dev, hdr.PageLength * 4, 5844 + buffer, dma_handle); 5849 5845 5850 5846 return rc; 5851 5847 } ··· 5933 5929 out: 5934 5930 5935 5931 if (buffer) 5936 - pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, buffer, 5937 - dma_handle); 5932 + dma_free_coherent(&ioc->pcidev->dev, hdr.PageLength * 4, 5933 + buffer, dma_handle); 5938 5934 5939 5935 return rc; 5940 5936 } ··· 6015 6011 pIoc2->RaidVolume[i].VolumeID); 6016 6012 6017 6013 out: 6018 - pci_free_consistent(ioc->pcidev, iocpage2sz, pIoc2, ioc2_dma); 6014 + dma_free_coherent(&ioc->pcidev->dev, iocpage2sz, pIoc2, ioc2_dma); 6019 6015 6020 6016 return rc; 6021 6017 } ··· 6074 6070 } 6075 6071 } 6076 6072 6077 - pci_free_consistent(ioc->pcidev, iocpage3sz, pIoc3, ioc3_dma); 6073 + dma_free_coherent(&ioc->pcidev->dev, iocpage3sz, pIoc3, ioc3_dma); 6078 6074 6079 6075 return 0; 6080 6076 } ··· 6126 6122 ioc->spi_data.IocPg4_dma = ioc4_dma; 6127 6123 ioc->spi_data.IocPg4Sz = iocpage4sz; 6128 6124 } else { 6129 - pci_free_consistent(ioc->pcidev, iocpage4sz, pIoc4, ioc4_dma); 6125 + dma_free_coherent(&ioc->pcidev->dev, iocpage4sz, pIoc4, 6126 + ioc4_dma); 6130 6127 ioc->spi_data.pIocPg4 = NULL; 6131 6128 ioc->alloc_total -= iocpage4sz; 6132 6129 } ··· 6215 6210 } 6216 6211 } 6217 6212 6218 - pci_free_consistent(ioc->pcidev, iocpage1sz, pIoc1, ioc1_dma); 6213 + dma_free_coherent(&ioc->pcidev->dev, iocpage1sz, pIoc1, ioc1_dma); 6219 6214 6220 6215 return; 6221 6216 } ··· 6260 6255 out: 6261 6256 6262 6257 if (pbuf) 6263 - pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, pbuf, buf_dma); 6258 + dma_free_coherent(&ioc->pcidev->dev, hdr.PageLength * 4, pbuf, 6259 + buf_dma); 6264 6260 } 6265 6261 6266 6262 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
+30 -21
drivers/message/fusion/mptctl.c
··· 1046 1046 goto free_and_fail; 1047 1047 1048 1048 if (sgdir & 0x04000000) 1049 - dir = PCI_DMA_TODEVICE; 1049 + dir = DMA_TO_DEVICE; 1050 1050 else 1051 - dir = PCI_DMA_FROMDEVICE; 1051 + dir = DMA_FROM_DEVICE; 1052 1052 1053 1053 /* At start: 1054 1054 * sgl = sglbuf = point to beginning of sg buffer ··· 1080 1080 1081 1081 bytes_allocd += this_alloc; 1082 1082 sgl->FlagsLength = (0x10000000|sgdir|this_alloc); 1083 - dma_addr = pci_map_single(ioc->pcidev, 1084 - buflist[buflist_ent].kptr, this_alloc, dir); 1083 + dma_addr = dma_map_single(&ioc->pcidev->dev, 1084 + buflist[buflist_ent].kptr, 1085 + this_alloc, dir); 1085 1086 sgl->Address = dma_addr; 1086 1087 1087 1088 fragcnt++; ··· 1141 1140 kptr = buflist[i].kptr; 1142 1141 len = buflist[i].len; 1143 1142 1144 - pci_free_consistent(ioc->pcidev, len, kptr, dma_addr); 1143 + dma_free_coherent(&ioc->pcidev->dev, len, kptr, 1144 + dma_addr); 1145 1145 } 1146 - pci_free_consistent(ioc->pcidev, MAX_SGL_BYTES, sglbuf, *sglbuf_dma); 1146 + dma_free_coherent(&ioc->pcidev->dev, MAX_SGL_BYTES, sglbuf, 1147 + *sglbuf_dma); 1147 1148 } 1148 1149 kfree(buflist); 1149 1150 return NULL; ··· 1165 1162 int n = 0; 1166 1163 1167 1164 if (sg->FlagsLength & 0x04000000) 1168 - dir = PCI_DMA_TODEVICE; 1165 + dir = DMA_TO_DEVICE; 1169 1166 else 1170 - dir = PCI_DMA_FROMDEVICE; 1167 + dir = DMA_FROM_DEVICE; 1171 1168 1172 1169 nib = (sg->FlagsLength & 0xF0000000) >> 28; 1173 1170 while (! (nib & 0x4)) { /* eob */ ··· 1182 1179 dma_addr = sg->Address; 1183 1180 kptr = bl->kptr; 1184 1181 len = bl->len; 1185 - pci_unmap_single(ioc->pcidev, dma_addr, len, dir); 1186 - pci_free_consistent(ioc->pcidev, len, kptr, dma_addr); 1182 + dma_unmap_single(&ioc->pcidev->dev, dma_addr, len, 1183 + dir); 1184 + dma_free_coherent(&ioc->pcidev->dev, len, kptr, 1185 + dma_addr); 1187 1186 n++; 1188 1187 } 1189 1188 sg++; ··· 1202 1197 dma_addr = sg->Address; 1203 1198 kptr = bl->kptr; 1204 1199 len = bl->len; 1205 - pci_unmap_single(ioc->pcidev, dma_addr, len, dir); 1206 - pci_free_consistent(ioc->pcidev, len, kptr, dma_addr); 1200 + dma_unmap_single(&ioc->pcidev->dev, dma_addr, len, dir); 1201 + dma_free_coherent(&ioc->pcidev->dev, len, kptr, dma_addr); 1207 1202 n++; 1208 1203 } 1209 1204 1210 - pci_free_consistent(ioc->pcidev, MAX_SGL_BYTES, sgl, sgl_dma); 1205 + dma_free_coherent(&ioc->pcidev->dev, MAX_SGL_BYTES, sgl, sgl_dma); 1211 1206 kfree(buflist); 1212 1207 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "-SG: Free'd 1 SGL buf + %d kbufs!\n", 1213 1208 ioc->name, n)); ··· 2288 2283 /* Free the allocated memory. 2289 2284 */ 2290 2285 if (bufOut.kptr != NULL) { 2291 - pci_free_consistent(ioc->pcidev, 2292 - bufOut.len, (void *) bufOut.kptr, dma_addr_out); 2286 + dma_free_coherent(&ioc->pcidev->dev, bufOut.len, 2287 + (void *)bufOut.kptr, dma_addr_out); 2293 2288 } 2294 2289 2295 2290 if (bufIn.kptr != NULL) { 2296 - pci_free_consistent(ioc->pcidev, 2297 - bufIn.len, (void *) bufIn.kptr, dma_addr_in); 2291 + dma_free_coherent(&ioc->pcidev->dev, bufIn.len, 2292 + (void *)bufIn.kptr, dma_addr_in); 2298 2293 } 2299 2294 2300 2295 /* mf is null if command issued successfully ··· 2410 2405 pdata->BoardTracerNumber, 24); 2411 2406 } 2412 2407 } 2413 - pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, pbuf, buf_dma); 2408 + dma_free_coherent(&ioc->pcidev->dev, 2409 + hdr.PageLength * 4, pbuf, 2410 + buf_dma); 2414 2411 pbuf = NULL; 2415 2412 } 2416 2413 } ··· 2526 2519 SET_MGMT_MSG_CONTEXT(ioc->ioctl_cmds.msg_context, 0); 2527 2520 2528 2521 if (pbuf) 2529 - pci_free_consistent(ioc->pcidev, 4, pbuf, buf_dma); 2522 + dma_free_coherent(&ioc->pcidev->dev, 4, pbuf, buf_dma); 2530 2523 2531 2524 /* Copy the data from kernel memory to user memory 2532 2525 */ ··· 2630 2623 karg.negotiated_speed = HP_DEV_SPEED_ASYNC; 2631 2624 } 2632 2625 2633 - pci_free_consistent(ioc->pcidev, data_sz, (u8 *) pg0_alloc, page_dma); 2626 + dma_free_coherent(&ioc->pcidev->dev, data_sz, (u8 *)pg0_alloc, 2627 + page_dma); 2634 2628 } 2635 2629 2636 2630 /* Set defaults ··· 2666 2658 karg.phase_errors = (u32) le16_to_cpu(pg3_alloc->PhaseErrorCount); 2667 2659 karg.parity_errors = (u32) le16_to_cpu(pg3_alloc->ParityErrorCount); 2668 2660 } 2669 - pci_free_consistent(ioc->pcidev, data_sz, (u8 *) pg3_alloc, page_dma); 2661 + dma_free_coherent(&ioc->pcidev->dev, data_sz, 2662 + (u8 *)pg3_alloc, page_dma); 2670 2663 } 2671 2664 } 2672 2665 hd = shost_priv(ioc->sh);
+48 -42
drivers/message/fusion/mptlan.c
··· 516 516 if (priv->RcvCtl[i].skb != NULL) { 517 517 /**/ dlprintk((KERN_INFO MYNAM "/lan_close: bucket %05x " 518 518 /**/ "is still out\n", i)); 519 - pci_unmap_single(mpt_dev->pcidev, priv->RcvCtl[i].dma, 520 - priv->RcvCtl[i].len, 521 - PCI_DMA_FROMDEVICE); 519 + dma_unmap_single(&mpt_dev->pcidev->dev, 520 + priv->RcvCtl[i].dma, 521 + priv->RcvCtl[i].len, DMA_FROM_DEVICE); 522 522 dev_kfree_skb(priv->RcvCtl[i].skb); 523 523 } 524 524 } ··· 528 528 529 529 for (i = 0; i < priv->tx_max_out; i++) { 530 530 if (priv->SendCtl[i].skb != NULL) { 531 - pci_unmap_single(mpt_dev->pcidev, priv->SendCtl[i].dma, 532 - priv->SendCtl[i].len, 533 - PCI_DMA_TODEVICE); 531 + dma_unmap_single(&mpt_dev->pcidev->dev, 532 + priv->SendCtl[i].dma, 533 + priv->SendCtl[i].len, DMA_TO_DEVICE); 534 534 dev_kfree_skb(priv->SendCtl[i].skb); 535 535 } 536 536 } ··· 582 582 __func__, sent)); 583 583 584 584 priv->SendCtl[ctx].skb = NULL; 585 - pci_unmap_single(mpt_dev->pcidev, priv->SendCtl[ctx].dma, 586 - priv->SendCtl[ctx].len, PCI_DMA_TODEVICE); 585 + dma_unmap_single(&mpt_dev->pcidev->dev, priv->SendCtl[ctx].dma, 586 + priv->SendCtl[ctx].len, DMA_TO_DEVICE); 587 587 dev_kfree_skb_irq(sent); 588 588 589 589 spin_lock_irqsave(&priv->txfidx_lock, flags); ··· 648 648 __func__, sent)); 649 649 650 650 priv->SendCtl[ctx].skb = NULL; 651 - pci_unmap_single(mpt_dev->pcidev, priv->SendCtl[ctx].dma, 652 - priv->SendCtl[ctx].len, PCI_DMA_TODEVICE); 651 + dma_unmap_single(&mpt_dev->pcidev->dev, 652 + priv->SendCtl[ctx].dma, 653 + priv->SendCtl[ctx].len, DMA_TO_DEVICE); 653 654 dev_kfree_skb_irq(sent); 654 655 655 656 priv->mpt_txfidx[++priv->mpt_txfidx_tail] = ctx; ··· 721 720 skb_reset_mac_header(skb); 722 721 skb_pull(skb, 12); 723 722 724 - dma = pci_map_single(mpt_dev->pcidev, skb->data, skb->len, 725 - PCI_DMA_TODEVICE); 723 + dma = dma_map_single(&mpt_dev->pcidev->dev, skb->data, skb->len, 724 + DMA_TO_DEVICE); 726 725 727 726 priv->SendCtl[ctx].skb = skb; 728 727 priv->SendCtl[ctx].dma = dma; ··· 869 868 return -ENOMEM; 870 869 } 871 870 872 - pci_dma_sync_single_for_cpu(mpt_dev->pcidev, priv->RcvCtl[ctx].dma, 873 - priv->RcvCtl[ctx].len, PCI_DMA_FROMDEVICE); 871 + dma_sync_single_for_cpu(&mpt_dev->pcidev->dev, 872 + priv->RcvCtl[ctx].dma, 873 + priv->RcvCtl[ctx].len, 874 + DMA_FROM_DEVICE); 874 875 875 876 skb_copy_from_linear_data(old_skb, skb_put(skb, len), len); 876 877 877 - pci_dma_sync_single_for_device(mpt_dev->pcidev, priv->RcvCtl[ctx].dma, 878 - priv->RcvCtl[ctx].len, PCI_DMA_FROMDEVICE); 878 + dma_sync_single_for_device(&mpt_dev->pcidev->dev, 879 + priv->RcvCtl[ctx].dma, 880 + priv->RcvCtl[ctx].len, 881 + DMA_FROM_DEVICE); 879 882 goto out; 880 883 } 881 884 ··· 887 882 888 883 priv->RcvCtl[ctx].skb = NULL; 889 884 890 - pci_unmap_single(mpt_dev->pcidev, priv->RcvCtl[ctx].dma, 891 - priv->RcvCtl[ctx].len, PCI_DMA_FROMDEVICE); 885 + dma_unmap_single(&mpt_dev->pcidev->dev, priv->RcvCtl[ctx].dma, 886 + priv->RcvCtl[ctx].len, DMA_FROM_DEVICE); 892 887 893 888 out: 894 889 spin_lock_irqsave(&priv->rxfidx_lock, flags); ··· 932 927 // dlprintk((KERN_INFO MYNAM "@rpr[2] TC + 3\n")); 933 928 934 929 priv->RcvCtl[ctx].skb = NULL; 935 - pci_unmap_single(mpt_dev->pcidev, priv->RcvCtl[ctx].dma, 936 - priv->RcvCtl[ctx].len, PCI_DMA_FROMDEVICE); 930 + dma_unmap_single(&mpt_dev->pcidev->dev, priv->RcvCtl[ctx].dma, 931 + priv->RcvCtl[ctx].len, DMA_FROM_DEVICE); 937 932 dev_kfree_skb_any(skb); 938 933 939 934 priv->mpt_rxfidx[++priv->mpt_rxfidx_tail] = ctx; ··· 1033 1028 // IOC_AND_NETDEV_NAMES_s_s(dev), 1034 1029 // i, l)); 1035 1030 1036 - pci_dma_sync_single_for_cpu(mpt_dev->pcidev, 1037 - priv->RcvCtl[ctx].dma, 1038 - priv->RcvCtl[ctx].len, 1039 - PCI_DMA_FROMDEVICE); 1031 + dma_sync_single_for_cpu(&mpt_dev->pcidev->dev, 1032 + priv->RcvCtl[ctx].dma, 1033 + priv->RcvCtl[ctx].len, 1034 + DMA_FROM_DEVICE); 1040 1035 skb_copy_from_linear_data(old_skb, skb_put(skb, l), l); 1041 1036 1042 - pci_dma_sync_single_for_device(mpt_dev->pcidev, 1043 - priv->RcvCtl[ctx].dma, 1044 - priv->RcvCtl[ctx].len, 1045 - PCI_DMA_FROMDEVICE); 1037 + dma_sync_single_for_device(&mpt_dev->pcidev->dev, 1038 + priv->RcvCtl[ctx].dma, 1039 + priv->RcvCtl[ctx].len, 1040 + DMA_FROM_DEVICE); 1046 1041 1047 1042 priv->mpt_rxfidx[++priv->mpt_rxfidx_tail] = ctx; 1048 1043 szrem -= l; ··· 1061 1056 return -ENOMEM; 1062 1057 } 1063 1058 1064 - pci_dma_sync_single_for_cpu(mpt_dev->pcidev, 1065 - priv->RcvCtl[ctx].dma, 1066 - priv->RcvCtl[ctx].len, 1067 - PCI_DMA_FROMDEVICE); 1059 + dma_sync_single_for_cpu(&mpt_dev->pcidev->dev, 1060 + priv->RcvCtl[ctx].dma, 1061 + priv->RcvCtl[ctx].len, 1062 + DMA_FROM_DEVICE); 1068 1063 1069 1064 skb_copy_from_linear_data(old_skb, skb_put(skb, len), len); 1070 1065 1071 - pci_dma_sync_single_for_device(mpt_dev->pcidev, 1072 - priv->RcvCtl[ctx].dma, 1073 - priv->RcvCtl[ctx].len, 1074 - PCI_DMA_FROMDEVICE); 1066 + dma_sync_single_for_device(&mpt_dev->pcidev->dev, 1067 + priv->RcvCtl[ctx].dma, 1068 + priv->RcvCtl[ctx].len, 1069 + DMA_FROM_DEVICE); 1075 1070 1076 1071 spin_lock_irqsave(&priv->rxfidx_lock, flags); 1077 1072 priv->mpt_rxfidx[++priv->mpt_rxfidx_tail] = ctx; ··· 1082 1077 1083 1078 priv->RcvCtl[ctx].skb = NULL; 1084 1079 1085 - pci_unmap_single(mpt_dev->pcidev, priv->RcvCtl[ctx].dma, 1086 - priv->RcvCtl[ctx].len, PCI_DMA_FROMDEVICE); 1080 + dma_unmap_single(&mpt_dev->pcidev->dev, priv->RcvCtl[ctx].dma, 1081 + priv->RcvCtl[ctx].len, DMA_FROM_DEVICE); 1087 1082 priv->RcvCtl[ctx].dma = 0; 1088 1083 1089 1084 priv->mpt_rxfidx[++priv->mpt_rxfidx_tail] = ctx; ··· 1204 1199 1205 1200 skb = priv->RcvCtl[ctx].skb; 1206 1201 if (skb && (priv->RcvCtl[ctx].len != len)) { 1207 - pci_unmap_single(mpt_dev->pcidev, 1202 + dma_unmap_single(&mpt_dev->pcidev->dev, 1208 1203 priv->RcvCtl[ctx].dma, 1209 1204 priv->RcvCtl[ctx].len, 1210 - PCI_DMA_FROMDEVICE); 1205 + DMA_FROM_DEVICE); 1211 1206 dev_kfree_skb(priv->RcvCtl[ctx].skb); 1212 1207 skb = priv->RcvCtl[ctx].skb = NULL; 1213 1208 } ··· 1223 1218 break; 1224 1219 } 1225 1220 1226 - dma = pci_map_single(mpt_dev->pcidev, skb->data, 1227 - len, PCI_DMA_FROMDEVICE); 1221 + dma = dma_map_single(&mpt_dev->pcidev->dev, 1222 + skb->data, len, 1223 + DMA_FROM_DEVICE); 1228 1224 1229 1225 priv->RcvCtl[ctx].skb = skb; 1230 1226 priv->RcvCtl[ctx].dma = dma;
+26 -25
drivers/message/fusion/mptsas.c
··· 769 769 770 770 out: 771 771 if (buffer) 772 - pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, buffer, 773 - dma_handle); 772 + dma_free_coherent(&ioc->pcidev->dev, hdr.PageLength * 4, 773 + buffer, dma_handle); 774 774 } 775 775 776 776 /** ··· 1426 1426 enclosure->sep_channel = buffer->SEPBus; 1427 1427 1428 1428 out_free_consistent: 1429 - pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 1430 - buffer, dma_handle); 1429 + dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, 1430 + dma_handle); 1431 1431 out: 1432 1432 return error; 1433 1433 } ··· 2081 2081 le32_to_cpu(buffer->PhyResetProblemCount); 2082 2082 2083 2083 out_free_consistent: 2084 - pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2085 - buffer, dma_handle); 2084 + dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, 2085 + dma_handle); 2086 2086 return error; 2087 2087 } 2088 2088 ··· 2301 2301 << MPI_SGE_FLAGS_SHIFT; 2302 2302 2303 2303 if (!dma_map_sg(&ioc->pcidev->dev, job->request_payload.sg_list, 2304 - 1, PCI_DMA_BIDIRECTIONAL)) 2304 + 1, DMA_BIDIRECTIONAL)) 2305 2305 goto put_mf; 2306 2306 2307 2307 flagsLength |= (sg_dma_len(job->request_payload.sg_list) - 4); ··· 2318 2318 flagsLength = flagsLength << MPI_SGE_FLAGS_SHIFT; 2319 2319 2320 2320 if (!dma_map_sg(&ioc->pcidev->dev, job->reply_payload.sg_list, 2321 - 1, PCI_DMA_BIDIRECTIONAL)) 2321 + 1, DMA_BIDIRECTIONAL)) 2322 2322 goto unmap_out; 2323 2323 flagsLength |= sg_dma_len(job->reply_payload.sg_list) + 4; 2324 2324 ioc->add_sge(psge, flagsLength, ··· 2356 2356 2357 2357 unmap_in: 2358 2358 dma_unmap_sg(&ioc->pcidev->dev, job->reply_payload.sg_list, 1, 2359 - PCI_DMA_BIDIRECTIONAL); 2359 + DMA_BIDIRECTIONAL); 2360 2360 unmap_out: 2361 2361 dma_unmap_sg(&ioc->pcidev->dev, job->request_payload.sg_list, 1, 2362 - PCI_DMA_BIDIRECTIONAL); 2362 + DMA_BIDIRECTIONAL); 2363 2363 put_mf: 2364 2364 if (mf) 2365 2365 mpt_free_msg_frame(ioc, mf); ··· 2452 2452 } 2453 2453 2454 2454 out_free_consistent: 2455 - pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2456 - buffer, dma_handle); 2455 + dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, 2456 + dma_handle); 2457 2457 out: 2458 2458 return error; 2459 2459 } ··· 2509 2509 device_missing_delay & MPI_SAS_IOUNIT1_REPORT_MISSING_TIMEOUT_MASK; 2510 2510 2511 2511 out_free_consistent: 2512 - pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2513 - buffer, dma_handle); 2512 + dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, 2513 + dma_handle); 2514 2514 out: 2515 2515 return error; 2516 2516 } ··· 2573 2573 phy_info->attached.handle = le16_to_cpu(buffer->AttachedDevHandle); 2574 2574 2575 2575 out_free_consistent: 2576 - pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2577 - buffer, dma_handle); 2576 + dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, 2577 + dma_handle); 2578 2578 out: 2579 2579 return error; 2580 2580 } ··· 2654 2654 device_info->flags = le16_to_cpu(buffer->Flags); 2655 2655 2656 2656 out_free_consistent: 2657 - pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2658 - buffer, dma_handle); 2657 + dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, 2658 + dma_handle); 2659 2659 out: 2660 2660 return error; 2661 2661 } ··· 2737 2737 } 2738 2738 2739 2739 out_free_consistent: 2740 - pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2741 - buffer, dma_handle); 2740 + dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, 2741 + dma_handle); 2742 2742 out: 2743 2743 return error; 2744 2744 } ··· 2810 2810 phy_info->attached.handle = le16_to_cpu(buffer->AttachedDevHandle); 2811 2811 2812 2812 out_free_consistent: 2813 - pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2814 - buffer, dma_handle); 2813 + dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, 2814 + dma_handle); 2815 2815 out: 2816 2816 return error; 2817 2817 } ··· 2987 2987 } 2988 2988 out_free: 2989 2989 if (data_out_dma) 2990 - pci_free_consistent(ioc->pcidev, sz, data_out, data_out_dma); 2990 + dma_free_coherent(&ioc->pcidev->dev, sz, data_out, 2991 + data_out_dma); 2991 2992 put_mf: 2992 2993 if (mf) 2993 2994 mpt_free_msg_frame(ioc, mf); ··· 4319 4318 4320 4319 out: 4321 4320 if (buffer) 4322 - pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, buffer, 4323 - dma_handle); 4321 + dma_free_coherent(&ioc->pcidev->dev, hdr.PageLength * 4, 4322 + buffer, dma_handle); 4324 4323 } 4325 4324 /* 4326 4325 * Work queue thread to handle SAS hotplug events