fbdev: da8xx: use resource management for dma
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 22 Jul 2019 13:44:23 +0000 (15:44 +0200)
committerSekhar Nori <nsekhar@ti.com>
Mon, 26 Aug 2019 12:24:00 +0000 (17:54 +0530)
Use managed variants of dma alloc functions in the da8xx fbdev driver.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
drivers/video/fbdev/da8xx-fb.c

index d14ea6f913710c020c70db21176b1f095eb9dbcf..2d3dcc52fcf3c807ba9d20b83250db8be203ab09 100644 (file)
@@ -1087,10 +1087,6 @@ static int fb_remove(struct platform_device *dev)
 
        unregister_framebuffer(info);
        fb_dealloc_cmap(&info->cmap);
-       dma_free_coherent(par->dev, PALETTE_SIZE, par->v_palette_base,
-                         par->p_palette_base);
-       dma_free_coherent(par->dev, par->vram_size, par->vram_virt,
-                         par->vram_phys);
        pm_runtime_put_sync(&dev->dev);
        pm_runtime_disable(&dev->dev);
        framebuffer_release(info);
@@ -1427,10 +1423,10 @@ static int fb_probe(struct platform_device *device)
        par->vram_size = roundup(par->vram_size/8, ulcm);
        par->vram_size = par->vram_size * LCD_NUM_BUFFERS;
 
-       par->vram_virt = dma_alloc_coherent(par->dev,
-                                           par->vram_size,
-                                           &par->vram_phys,
-                                           GFP_KERNEL | GFP_DMA);
+       par->vram_virt = dmam_alloc_coherent(par->dev,
+                                            par->vram_size,
+                                            &par->vram_phys,
+                                            GFP_KERNEL | GFP_DMA);
        if (!par->vram_virt) {
                dev_err(&device->dev,
                        "GLCD: kmalloc for frame buffer failed\n");
@@ -1448,20 +1444,20 @@ static int fb_probe(struct platform_device *device)
                da8xx_fb_fix.line_length - 1;
 
        /* allocate palette buffer */
-       par->v_palette_base = dma_alloc_coherent(par->dev, PALETTE_SIZE,
-                                                &par->p_palette_base,
-                                                GFP_KERNEL | GFP_DMA);
+       par->v_palette_base = dmam_alloc_coherent(par->dev, PALETTE_SIZE,
+                                                 &par->p_palette_base,
+                                                 GFP_KERNEL | GFP_DMA);
        if (!par->v_palette_base) {
                dev_err(&device->dev,
                        "GLCD: kmalloc for palette buffer failed\n");
                ret = -EINVAL;
-               goto err_release_fb_mem;
+               goto err_release_fb;
        }
 
        par->irq = platform_get_irq(device, 0);
        if (par->irq < 0) {
                ret = -ENOENT;
-               goto err_release_pl_mem;
+               goto err_release_fb;
        }
 
        da8xx_fb_var.grayscale =
@@ -1479,7 +1475,7 @@ static int fb_probe(struct platform_device *device)
 
        ret = fb_alloc_cmap(&da8xx_fb_info->cmap, PALETTE_SIZE, 0);
        if (ret)
-               goto err_release_pl_mem;
+               goto err_release_fb;
        da8xx_fb_info->cmap.len = par->palette_sz;
 
        /* initialize var_screeninfo */
@@ -1533,14 +1529,6 @@ err_cpu_freq:
 err_dealloc_cmap:
        fb_dealloc_cmap(&da8xx_fb_info->cmap);
 
-err_release_pl_mem:
-       dma_free_coherent(par->dev, PALETTE_SIZE, par->v_palette_base,
-                         par->p_palette_base);
-
-err_release_fb_mem:
-       dma_free_coherent(par->dev, par->vram_size, par->vram_virt,
-                         par->vram_phys);
-
 err_release_fb:
        framebuffer_release(da8xx_fb_info);