diff options
author | Timur Tabi <timur@freescale.com> | 2011-12-19 16:26:18 -0600 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2012-01-03 15:59:09 +0000 |
commit | 05342c0bdfd519873462e04ad81be07c9cd3c1e1 (patch) | |
tree | f16833fe4a4bee45d74f6383b623411c00cb6024 /drivers/video | |
parent | e09a8c3a42f4c90d300678b198410e6fcc8eddb6 (diff) |
drivers/video: fsl-diu-fb: merge fsl_diu_alloc() into map_video_memory()
Functions fsl_diu_alloc() and fsl_diu_free() were only being called by
map_video_memory() and unmap_video_memory(), respectively.
Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/fsl-diu-fb.c | 47 |
1 files changed, 11 insertions, 36 deletions
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index e2f4f32692a..acf292bfba0 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c @@ -461,37 +461,6 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s) return diu_ops.valid_monitor_port(port); } -/** - * fsl_diu_alloc - allocate memory for the DIU - * @size: number of bytes to allocate - * @param: returned physical address of memory - * - * This function allocates a physically-contiguous block of memory. - */ -static void *fsl_diu_alloc(size_t size, phys_addr_t *phys) -{ - void *virt; - - virt = alloc_pages_exact(size, GFP_DMA | __GFP_ZERO); - if (virt) - *phys = virt_to_phys(virt); - - return virt; -} - -/** - * fsl_diu_free - release DIU memory - * @virt: pointer returned by fsl_diu_alloc() - * @size: number of bytes allocated by fsl_diu_alloc() - * - * This function releases memory allocated by fsl_diu_alloc(). - */ -static void fsl_diu_free(void *virt, size_t size) -{ - if (virt && size) - free_pages_exact(virt, size); -} - /* * Workaround for failed writing desc register of planes. * Needed with MPC5121 DIU rev 2.0 silicon. @@ -875,16 +844,17 @@ static void update_lcdc(struct fb_info *info) static int map_video_memory(struct fb_info *info) { - phys_addr_t phys; u32 smem_len = info->fix.line_length * info->var.yres_virtual; + void *p; - info->screen_base = fsl_diu_alloc(smem_len, &phys); - if (info->screen_base == NULL) { + p = alloc_pages_exact(smem_len, GFP_DMA | __GFP_ZERO); + if (!p) { dev_err(info->dev, "unable to allocate fb memory\n"); return -ENOMEM; } mutex_lock(&info->mm_lock); - info->fix.smem_start = (unsigned long) phys; + info->screen_base = p; + info->fix.smem_start = virt_to_phys(info->screen_base); info->fix.smem_len = smem_len; mutex_unlock(&info->mm_lock); info->screen_size = info->fix.smem_len; @@ -894,12 +864,17 @@ static int map_video_memory(struct fb_info *info) static void unmap_video_memory(struct fb_info *info) { - fsl_diu_free(info->screen_base, info->fix.smem_len); + void *p = info->screen_base; + size_t l = info->fix.smem_len; + mutex_lock(&info->mm_lock); info->screen_base = NULL; info->fix.smem_start = 0; info->fix.smem_len = 0; mutex_unlock(&info->mm_lock); + + if (p) + free_pages_exact(p, l); } /* |