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

DMA-API: staging: use dma_set_coherent_mask()

The correct way for a driver to specify the coherent DMA mask is
not to directly access the field in the struct device, but to use
dma_set_coherent_mask(). Only arch and bus code should access this
member directly.

Convert all direct write accesses to using the correct API.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

+12 -5
+3 -2
drivers/staging/dwc2/platform.c
··· 100 100 */ 101 101 if (!dev->dev.dma_mask) 102 102 dev->dev.dma_mask = &dev->dev.coherent_dma_mask; 103 - if (!dev->dev.coherent_dma_mask) 104 - dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 103 + retval = dma_set_coherent_mask(&dev->dev, DMA_BIT_MASK(32)); 104 + if (retval) 105 + return retval; 105 106 106 107 irq = platform_get_irq(dev, 0); 107 108 if (irq < 0) {
+6 -2
drivers/staging/imx-drm/imx-drm-core.c
··· 805 805 806 806 static int imx_drm_platform_probe(struct platform_device *pdev) 807 807 { 808 + int ret; 809 + 810 + ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); 811 + if (ret) 812 + return ret; 813 + 808 814 imx_drm_device->dev = &pdev->dev; 809 815 810 816 return drm_platform_init(&imx_drm_driver, pdev); ··· 852 846 ret = -EINVAL; 853 847 goto err_pdev; 854 848 } 855 - 856 - imx_drm_pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32), 857 849 858 850 ret = platform_driver_register(&imx_drm_pdrv); 859 851 if (ret)
+3 -1
drivers/staging/imx-drm/ipuv3-crtc.c
··· 523 523 if (!pdata) 524 524 return -EINVAL; 525 525 526 - pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 526 + ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); 527 + if (ret) 528 + return ret; 527 529 528 530 ipu_crtc = devm_kzalloc(&pdev->dev, sizeof(*ipu_crtc), GFP_KERNEL); 529 531 if (!ipu_crtc)