Skip to content

Commit 76a334d

Browse files
tititiou36martinkpetersen
authored andcommitted
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>
1 parent 7a960b3 commit 76a334d

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

drivers/message/fusion/mptsas.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,8 @@ mptsas_add_device_component_starget_ir(MPT_ADAPTER *ioc,
702702
if (!hdr.PageLength)
703703
goto out;
704704

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);
707707

708708
if (!buffer)
709709
goto out;
@@ -1399,8 +1399,8 @@ mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure,
13991399
goto out;
14001400
}
14011401

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);
14041404
if (!buffer) {
14051405
error = -ENOMEM;
14061406
goto out;
@@ -2058,8 +2058,8 @@ static int mptsas_get_linkerrors(struct sas_phy *phy)
20582058
if (!hdr.ExtPageLength)
20592059
return -ENXIO;
20602060

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);
20632063
if (!buffer)
20642064
return -ENOMEM;
20652065

@@ -2412,8 +2412,8 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
24122412
goto out;
24132413
}
24142414

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);
24172417
if (!buffer) {
24182418
error = -ENOMEM;
24192419
goto out;
@@ -2487,8 +2487,8 @@ mptsas_sas_io_unit_pg1(MPT_ADAPTER *ioc)
24872487
goto out;
24882488
}
24892489

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);
24922492
if (!buffer) {
24932493
error = -ENOMEM;
24942494
goto out;
@@ -2551,8 +2551,8 @@ mptsas_sas_phy_pg0(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
25512551
goto out;
25522552
}
25532553

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);
25562556
if (!buffer) {
25572557
error = -ENOMEM;
25582558
goto out;
@@ -2614,8 +2614,8 @@ mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info,
26142614
goto out;
26152615
}
26162616

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);
26192619
if (!buffer) {
26202620
error = -ENOMEM;
26212621
goto out;
@@ -2697,8 +2697,8 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
26972697
goto out;
26982698
}
26992699

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);
27022702
if (!buffer) {
27032703
error = -ENOMEM;
27042704
goto out;
@@ -2777,8 +2777,8 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
27772777
goto out;
27782778
}
27792779

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);
27822782
if (!buffer) {
27832783
error = -ENOMEM;
27842784
goto out;
@@ -4273,8 +4273,8 @@ mptsas_adding_inactive_raid_components(MPT_ADAPTER *ioc, u8 channel, u8 id)
42734273
if (!hdr.PageLength)
42744274
goto out;
42754275

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);
42784278

42794279
if (!buffer)
42804280
goto out;

0 commit comments

Comments
 (0)