[PATCH] net: wan: replace dma_set_mask()+dma_set_coherent_mask() with new helper

DORMANTno replies

From: zhangheng <hidden>
Date: 2024-11-23 08:55:52
Also in: lkml
Subsystem: generic hdlc (wan) drivers, networking drivers, the rest · Maintainers: Krzysztof Halasa, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Replace the following sequence:

	dma_set_mask(dev, mask);
	dma_set_coherent_mask(dev, mask);

with a call to the new helper dma_set_mask_and_coherent().

Signed-off-by: zhangheng <redacted>
---
 drivers/net/wan/wanxl.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 5a9e262188ef..c2d5fbf887ee 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -574,8 +574,7 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 	 * and pray pci_alloc_consistent() will use this info. It should
 	 * work on most platforms
 	 */
-	if (dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(28)) ||
-	    dma_set_mask(&pdev->dev, DMA_BIT_MASK(28))) {
+	if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(28))) {
 		pr_err("No usable DMA configuration\n");
 		pci_disable_device(pdev);
 		return -EIO;
@@ -626,8 +625,7 @@ static int wanxl_pci_init_one(struct pci_dev *pdev,
 	 * We set both dma_mask and consistent_dma_mask back to 32 bits
 	 * to indicate the card can do 32-bit DMA addressing
 	 */
-	if (dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)) ||
-	    dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
+	if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
 		pr_err("No usable DMA configuration\n");
 		wanxl_pci_remove_one(pdev);
 		return -EIO;
-- 
2.45.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help