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

scsi: message: fusion: mptsas: Use dma_alloc_coherent()

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].

In all these places where some memory is allocated GFP_KERNEL can be used
because they already call mpt_config() which has an explicit might_sleep().

[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/

Link: https://lore.kernel.org/r/443b81ecb08b2fe6f789bb2fdff13a53c809e401.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
76a334d7 7a960b3a

+20 -20
+20 -20
drivers/message/fusion/mptsas.c
··· 702 702 if (!hdr.PageLength) 703 703 goto out; 704 704 705 - buffer = pci_alloc_consistent(ioc->pcidev, hdr.PageLength * 4, 706 - &dma_handle); 705 + buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.PageLength * 4, 706 + &dma_handle, GFP_KERNEL); 707 707 708 708 if (!buffer) 709 709 goto out; ··· 1399 1399 goto out; 1400 1400 } 1401 1401 1402 - buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 1403 - &dma_handle); 1402 + buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, 1403 + &dma_handle, GFP_KERNEL); 1404 1404 if (!buffer) { 1405 1405 error = -ENOMEM; 1406 1406 goto out; ··· 2058 2058 if (!hdr.ExtPageLength) 2059 2059 return -ENXIO; 2060 2060 2061 - buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2062 - &dma_handle); 2061 + buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, 2062 + &dma_handle, GFP_KERNEL); 2063 2063 if (!buffer) 2064 2064 return -ENOMEM; 2065 2065 ··· 2412 2412 goto out; 2413 2413 } 2414 2414 2415 - buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2416 - &dma_handle); 2415 + buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, 2416 + &dma_handle, GFP_KERNEL); 2417 2417 if (!buffer) { 2418 2418 error = -ENOMEM; 2419 2419 goto out; ··· 2487 2487 goto out; 2488 2488 } 2489 2489 2490 - buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2491 - &dma_handle); 2490 + buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, 2491 + &dma_handle, GFP_KERNEL); 2492 2492 if (!buffer) { 2493 2493 error = -ENOMEM; 2494 2494 goto out; ··· 2551 2551 goto out; 2552 2552 } 2553 2553 2554 - buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2555 - &dma_handle); 2554 + buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, 2555 + &dma_handle, GFP_KERNEL); 2556 2556 if (!buffer) { 2557 2557 error = -ENOMEM; 2558 2558 goto out; ··· 2614 2614 goto out; 2615 2615 } 2616 2616 2617 - buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2618 - &dma_handle); 2617 + buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, 2618 + &dma_handle, GFP_KERNEL); 2619 2619 if (!buffer) { 2620 2620 error = -ENOMEM; 2621 2621 goto out; ··· 2697 2697 goto out; 2698 2698 } 2699 2699 2700 - buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2701 - &dma_handle); 2700 + buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, 2701 + &dma_handle, GFP_KERNEL); 2702 2702 if (!buffer) { 2703 2703 error = -ENOMEM; 2704 2704 goto out; ··· 2777 2777 goto out; 2778 2778 } 2779 2779 2780 - buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4, 2781 - &dma_handle); 2780 + buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, 2781 + &dma_handle, GFP_KERNEL); 2782 2782 if (!buffer) { 2783 2783 error = -ENOMEM; 2784 2784 goto out; ··· 4273 4273 if (!hdr.PageLength) 4274 4274 goto out; 4275 4275 4276 - buffer = pci_alloc_consistent(ioc->pcidev, hdr.PageLength * 4, 4277 - &dma_handle); 4276 + buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.PageLength * 4, 4277 + &dma_handle, GFP_KERNEL); 4278 4278 4279 4279 if (!buffer) 4280 4280 goto out;