Subject: Re: linux-next: build failure after merge of the omap_dss2 tree

From: Tomi Valkeinen <[email-masked]>
Date: Fri, 26 Apr 2013 08:31:03 +0300

On 2013-04-26 08:10, Stephen Rothwell wrote:
> Hi Tomi,
> 
> After merging the omap_dss2 tree, today's linux-next build (powerpc
> ppc64_defconfig) failed like this:
> 
> drivers/video/ps3fb.c: In function 'ps3fb_mmap':
> drivers/video/ps3fb.c:710:2: error: implicit declaration of function 'vm_ioremap_memory' [-Werror=implicit-function-declaration]
> drivers/video/ps3fb.c:712:2: error: 'offset' undeclared (first use in this function)
> 
> Caused by commit 6ea19860d6c5 ("fbdev/ps3fb: use vm_iomap_memory()").
> 
> I have used the omap_dss2 tree from next-20130424 for today.
> 

Thanks. Updated patch below. I couldn't right away find where to download a
ppc64 toolchain, so not compile tested...

 Tomi

From 11bd5933abe033fb7a3a0d1f1bd2cb4b6df8143f Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <[email-masked]>
Date: Thu, 18 Apr 2013 07:52:42 +0300
Subject: [PATCH] fbdev/ps3fb: use vm_iomap_memory()

Use vm_iomap_memory() instead of [io_]remap_pfn_range().
vm_iomap_memory() gives us much simpler API to map memory to userspace,
and reduces possibilities for bugs.

Signed-off-by: Tomi Valkeinen <[email-masked]>
Cc: Geert Uytterhoeven <[email-masked]>
---
 drivers/video/ps3fb.c |   18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 920c27b..d9f08c6 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -705,21 +705,15 @@ static int ps3fb_pan_display(struct fb_var_screeninfo *var,
 
 static int ps3fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
 {
-	unsigned long size, offset;
+	int r;
 
-	size = vma->vm_end - vma->vm_start;
-	offset = vma->vm_pgoff << PAGE_SHIFT;
-	if (offset + size > info->fix.smem_len)
-		return -EINVAL;
-
-	offset += info->fix.smem_start;
-	if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT,
-			    size, vma->vm_page_prot))
-		return -EAGAIN;
+	r = vm_iomap_memory(vma, info->fix.smem_start, info->fix.smem_len);
 
 	dev_dbg(info->device, "ps3fb: mmap framebuffer P(%lx)->V(%lx)\n",
-		offset, vma->vm_start);
-	return 0;
+		info->fix.smem_start + vma->vm_pgoff << PAGE_SHIFT,
+		vma->vm_start);
+
+	return r;
 }
 
     /*
-- 
1.7.10.4