fbdev/radeonfb: Remove bugus radeonfb_read/write
PATCH 1/1 fbdev/radeonfb: Remove bugus radeonfb_read/write
This patch kills the bogus radeonfb_read/write routines. In order to do so, it adds a new member to fb_info, along with screen_base, which is screen_size, indicating the mapped area. The default fb_read/write will now use that instead of fix->smem_len if it is non-0, and radeonfb now sets it to the mapped size of the framebuffer.
Ben.
===== drivers/video/fbmem.c 1.127 vs edited =====
drivers/video/fbmem.c +20 -10
@@ -506,6 +506,7 @@struct fb_info *info = registered_fb[fbidx];u32 *buffer, *dst, *src;int c, i, cnt =0 , err =0 ; +unsigned long total_size;if (!info || ! info->screen_base)return -ENODEV ;
@@ -516,12 +517,16 @@if (info->fbops->fb_read)return info->fbops->fb_read (file, buf, count, ppos); -if (p >= info->fix.smem_len) + total_size = info->screen_size; +if (total_size ==0 ) + total_size = info->fix.smem_len; + +if (p >= total_size)return 0 ; -if (count >= info->fix.smem_len) - count = info->fix.smem_len; -if (count + p > info->fix.smem_len) - count = info->fix.smem_len - p; +if (count >= total_size) + count = total_size; +if (count + p > total_size) + count = total_size - p; cnt =0 ; buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count,
@@ -572,6 +577,7 @@struct fb_info *info = registered_fb[fbidx];u32 *buffer, *dst, *src;int c, i, cnt =0 , err; +unsigned long total_size;if (!info || !info->screen_base)return -ENODEV ;
@@ -582,13 +588,17 @@if (info->fbops->fb_write)return info->fbops->fb_write (file, buf, count, ppos); -if (p > info->fix.smem_len) + total_size = info->screen_size; +if (total_size ==0 ) + total_size = info->fix.smem_len; + +if (p > total_size)return -ENOSPC ; -if (count >= info->fix.smem_len) - count = info->fix.smem_len; +if (count >= total_size) + count = total_size; err =0 ; -if (count + p > info->fix.smem_len) { - count = info->fix.smem_len - p; +if (count + p > total_size) { + count = total_size - p; err = -ENOSPC ; } cnt =0 ;
===== drivers/video/aty/radeon_base.c 1.27 vs edited =====
drivers/video/aty/radeon_base.c +1 -71
96 lines not on this page · raw message
===== include/linux/fb.h 1.82 vs edited =====
include/linux/fb.h +1 -0
@@ -603,6 +603,7 @@struct fb_cmap cmap;/* Current cmap */ struct fb_ops *fbops;char __iomem *screen_base;/* Virtual address */ +unsigned long screen_size;/* Amount of ioremapped VRAM or 0 */ int currcon;/* Current VC. */ void *pseudo_palette;/* Fake palette of 16 colors */ #define FBINFO_STATE_RUNNING 0
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php