From: Arnd Bergmann <[email protected]>

The omap lcdc driver has an elaborate mmap_kern function
to map the frame buffer into kernel address space as
write-combined. This uses functions that are only available
on MMU-enabled builds.

It does seem equivalent to ioremap_wc though, so we should
be able to just use that instead.

This patch is build-tested only, it needs to be run on real
hardware before applying.

Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Peter Griffin <[email protected]>
Cc: Jean-Christophe Plagniol-Villard <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
 drivers/video/fbdev/omap/lcdc.c |   28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/drivers/video/fbdev/omap/lcdc.c b/drivers/video/fbdev/omap/lcdc.c
index b52f625..40e8200 100644
--- a/drivers/video/fbdev/omap/lcdc.c
+++ b/drivers/video/fbdev/omap/lcdc.c
@@ -613,29 +613,11 @@ static void lcdc_dma_handler(u16 status, void *data)
 
 static int mmap_kern(void)
 {
-       struct vm_struct        *kvma;
-       struct vm_area_struct   vma;
-       pgprot_t                pgprot;
-       unsigned long           vaddr;
-
-       kvma = get_vm_area(lcdc.vram_size, VM_IOREMAP);
-       if (kvma == NULL) {
-               dev_err(lcdc.fbdev->dev, "can't get kernel vm area\n");
+       void __iomem *vaddr;
+
+       vaddr = ioremap_wc(lcdc.vram_phys, lcdc.vram_size);
+       if (!vaddr)
                return -ENOMEM;
-       }
-       vma.vm_mm = &init_mm;
-
-       vaddr = (unsigned long)kvma->addr;
-       vma.vm_start = vaddr;
-       vma.vm_end = vaddr + lcdc.vram_size;
-
-       pgprot = pgprot_writecombine(pgprot_kernel);
-       if (io_remap_pfn_range(&vma, vaddr,
-                          lcdc.vram_phys >> PAGE_SHIFT,
-                          lcdc.vram_size, pgprot) < 0) {
-               dev_err(lcdc.fbdev->dev, "kernel mmap for FB memory failed\n");
-               return -EAGAIN;
-       }
 
        lcdc.vram_virt = (void *)vaddr;
 
@@ -644,7 +626,7 @@ static int mmap_kern(void)
 
 static void unmap_kern(void)
 {
-       vunmap(lcdc.vram_virt);
+       iounmap(lcdc.vram_virt);
 }
 
 static int alloc_palette_ram(void)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to