aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/fb_defio.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c
index 06060ccd3c23..082026546aee 100644
--- a/drivers/video/fb_defio.c
+++ b/drivers/video/fb_defio.c
@@ -24,6 +24,19 @@
24#include <linux/rmap.h> 24#include <linux/rmap.h>
25#include <linux/pagemap.h> 25#include <linux/pagemap.h>
26 26
27struct page *fb_deferred_io_page(struct fb_info *info, unsigned long offs)
28{
29 void *screen_base = (void __force *) info->screen_base;
30 struct page *page;
31
32 if (is_vmalloc_addr(screen_base + offs))
33 page = vmalloc_to_page(screen_base + offs);
34 else
35 page = pfn_to_page((info->fix.smem_start + offs) >> PAGE_SHIFT);
36
37 return page;
38}
39
27/* this is to find and return the vmalloc-ed fb pages */ 40/* this is to find and return the vmalloc-ed fb pages */
28static int fb_deferred_io_fault(struct vm_area_struct *vma, 41static int fb_deferred_io_fault(struct vm_area_struct *vma,
29 struct vm_fault *vmf) 42 struct vm_fault *vmf)
@@ -31,14 +44,12 @@ static int fb_deferred_io_fault(struct vm_area_struct *vma,
31 unsigned long offset; 44 unsigned long offset;
32 struct page *page; 45 struct page *page;
33 struct fb_info *info = vma->vm_private_data; 46 struct fb_info *info = vma->vm_private_data;
34 /* info->screen_base is virtual memory */
35 void *screen_base = (void __force *) info->screen_base;
36 47
37 offset = vmf->pgoff << PAGE_SHIFT; 48 offset = vmf->pgoff << PAGE_SHIFT;
38 if (offset >= info->fix.smem_len) 49 if (offset >= info->fix.smem_len)
39 return VM_FAULT_SIGBUS; 50 return VM_FAULT_SIGBUS;
40 51
41 page = vmalloc_to_page(screen_base + offset); 52 page = fb_deferred_io_page(info, offset);
42 if (!page) 53 if (!page)
43 return VM_FAULT_SIGBUS; 54 return VM_FAULT_SIGBUS;
44 55
@@ -188,7 +199,6 @@ EXPORT_SYMBOL_GPL(fb_deferred_io_open);
188 199
189void fb_deferred_io_cleanup(struct fb_info *info) 200void fb_deferred_io_cleanup(struct fb_info *info)
190{ 201{
191 void *screen_base = (void __force *) info->screen_base;
192 struct fb_deferred_io *fbdefio = info->fbdefio; 202 struct fb_deferred_io *fbdefio = info->fbdefio;
193 struct page *page; 203 struct page *page;
194 int i; 204 int i;
@@ -199,7 +209,7 @@ void fb_deferred_io_cleanup(struct fb_info *info)
199 209
200 /* clear out the mapping that we setup */ 210 /* clear out the mapping that we setup */
201 for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) { 211 for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
202 page = vmalloc_to_page(screen_base + i); 212 page = fb_deferred_io_page(info, i);
203 page->mapping = NULL; 213 page->mapping = NULL;
204 } 214 }
205 215