summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2023-04-28 14:24:48 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2023-05-08 15:28:33 +0200
commitf06875dc4c4f5d8895519857e441d407e88280e4 (patch)
tree5bd254c9bf0c40fcb70b00c96e4c0a5de916960a
parentfbdev: Return number of bytes read or written (diff)
downloadlinux-f06875dc4c4f5d8895519857e441d407e88280e4.tar.xz
linux-f06875dc4c4f5d8895519857e441d407e88280e4.zip
fbdev: Use screen_buffer in fb_sys_{read,write}()
Use info->screen_buffer when reading and writing framebuffers in system memory. It's the correct pointer for this address space. The struct fb_info has a union to store the framebuffer memory. This can either be info->screen_base if the framebuffer is stored in I/O memory, or info->screen_buffer if the framebuffer is stored in system memory. Since the fb_sys_{read,write}() functions operate on the latter address space, it is wrong to use .screen_base and .screen_buffer must be used instead. This also gets rid of all the casting needed due to not using the correct data type. v2: * add detailed commit message (Javier) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Tested-by: Sui Jingfeng <suijingfeng@loongson.cn> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Helge Deller <deller@gmx.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230428122452.4856-16-tzimmermann@suse.de
-rw-r--r--drivers/video/fbdev/core/fb_sys_fops.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/video/fbdev/core/fb_sys_fops.c b/drivers/video/fbdev/core/fb_sys_fops.c
index cefb77b9546d..6589123f4127 100644
--- a/drivers/video/fbdev/core/fb_sys_fops.c
+++ b/drivers/video/fbdev/core/fb_sys_fops.c
@@ -39,7 +39,7 @@ ssize_t fb_sys_read(struct fb_info *info, char __user *buf, size_t count,
if (count + p > total_size)
count = total_size - p;
- src = (void __force *)(info->screen_base + p);
+ src = info->screen_buffer + p;
if (info->fbops->fb_sync)
info->fbops->fb_sync(info);
@@ -87,7 +87,7 @@ ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
count = total_size - p;
}
- dst = (void __force *) (info->screen_base + p);
+ dst = info->screen_buffer + p;
if (info->fbops->fb_sync)
info->fbops->fb_sync(info);