Commit 6ca49268 authored by Thomas Zimmermann's avatar Thomas Zimmermann

fbdev/smscufx: Use struct fb_info.screen_buffer

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.

As the driver operates on the latter address space, it is wrong to use
.screen_base and .screen_buffer must be used instead.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230428122452.4856-11-tzimmermann@suse.de
parent bdb61647
...@@ -1150,7 +1150,7 @@ static void ufx_free_framebuffer(struct ufx_data *dev) ...@@ -1150,7 +1150,7 @@ static void ufx_free_framebuffer(struct ufx_data *dev)
fb_dealloc_cmap(&info->cmap); fb_dealloc_cmap(&info->cmap);
if (info->monspecs.modedb) if (info->monspecs.modedb)
fb_destroy_modedb(info->monspecs.modedb); fb_destroy_modedb(info->monspecs.modedb);
vfree(info->screen_base); vfree(info->screen_buffer);
fb_destroy_modelist(&info->modelist); fb_destroy_modelist(&info->modelist);
...@@ -1257,7 +1257,7 @@ static int ufx_ops_set_par(struct fb_info *info) ...@@ -1257,7 +1257,7 @@ static int ufx_ops_set_par(struct fb_info *info)
if ((result == 0) && (dev->fb_count == 0)) { if ((result == 0) && (dev->fb_count == 0)) {
/* paint greenscreen */ /* paint greenscreen */
pix_framebuffer = (u16 *) info->screen_base; pix_framebuffer = (u16 *)info->screen_buffer;
for (i = 0; i < info->fix.smem_len / 2; i++) for (i = 0; i < info->fix.smem_len / 2; i++)
pix_framebuffer[i] = 0x37e6; pix_framebuffer[i] = 0x37e6;
...@@ -1303,7 +1303,7 @@ static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info) ...@@ -1303,7 +1303,7 @@ static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info)
{ {
int old_len = info->fix.smem_len; int old_len = info->fix.smem_len;
int new_len; int new_len;
unsigned char *old_fb = info->screen_base; unsigned char *old_fb = info->screen_buffer;
unsigned char *new_fb; unsigned char *new_fb;
pr_debug("Reallocating framebuffer. Addresses will change!"); pr_debug("Reallocating framebuffer. Addresses will change!");
...@@ -1318,12 +1318,12 @@ static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info) ...@@ -1318,12 +1318,12 @@ static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info)
if (!new_fb) if (!new_fb)
return -ENOMEM; return -ENOMEM;
if (info->screen_base) { if (info->screen_buffer) {
memcpy(new_fb, old_fb, old_len); memcpy(new_fb, old_fb, old_len);
vfree(info->screen_base); vfree(info->screen_buffer);
} }
info->screen_base = new_fb; info->screen_buffer = new_fb;
info->fix.smem_len = PAGE_ALIGN(new_len); info->fix.smem_len = PAGE_ALIGN(new_len);
info->fix.smem_start = (unsigned long) new_fb; info->fix.smem_start = (unsigned long) new_fb;
info->flags = smscufx_info_flags; info->flags = smscufx_info_flags;
...@@ -1746,7 +1746,7 @@ static int ufx_usb_probe(struct usb_interface *interface, ...@@ -1746,7 +1746,7 @@ static int ufx_usb_probe(struct usb_interface *interface,
atomic_set(&dev->usb_active, 0); atomic_set(&dev->usb_active, 0);
setup_modes: setup_modes:
fb_destroy_modedb(info->monspecs.modedb); fb_destroy_modedb(info->monspecs.modedb);
vfree(info->screen_base); vfree(info->screen_buffer);
fb_destroy_modelist(&info->modelist); fb_destroy_modelist(&info->modelist);
error: error:
fb_dealloc_cmap(&info->cmap); fb_dealloc_cmap(&info->cmap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment