Commit 01594267 authored by Thomas Zimmermann's avatar Thomas Zimmermann

fbdev/offb: Allocate struct offb_par with framebuffer_alloc()

Move the palette array into struct offb_par and allocate both via
framebuffer_alloc(), as intended by fbdev. No functional changes.
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/20221219160516.23436-13-tzimmermann@suse.de
parent 7191ec80
...@@ -53,10 +53,9 @@ struct offb_par { ...@@ -53,10 +53,9 @@ struct offb_par {
volatile void __iomem *cmap_data; volatile void __iomem *cmap_data;
int cmap_type; int cmap_type;
int blanked; int blanked;
u32 pseudo_palette[16];
}; };
struct offb_par default_par;
#ifdef CONFIG_PPC32 #ifdef CONFIG_PPC32
extern boot_infos_t *boot_infos; extern boot_infos_t *boot_infos;
#endif #endif
...@@ -393,11 +392,11 @@ static void offb_init_fb(struct platform_device *parent, const char *name, ...@@ -393,11 +392,11 @@ static void offb_init_fb(struct platform_device *parent, const char *name,
int foreign_endian, struct device_node *dp) int foreign_endian, struct device_node *dp)
{ {
unsigned long res_size = pitch * height; unsigned long res_size = pitch * height;
struct offb_par *par = &default_par;
unsigned long res_start = address; unsigned long res_start = address;
struct fb_fix_screeninfo *fix; struct fb_fix_screeninfo *fix;
struct fb_var_screeninfo *var; struct fb_var_screeninfo *var;
struct fb_info *info; struct fb_info *info;
struct offb_par *par;
if (!request_mem_region(res_start, res_size, "offb")) if (!request_mem_region(res_start, res_size, "offb"))
return; return;
...@@ -411,17 +410,15 @@ static void offb_init_fb(struct platform_device *parent, const char *name, ...@@ -411,17 +410,15 @@ static void offb_init_fb(struct platform_device *parent, const char *name,
return; return;
} }
info = framebuffer_alloc(sizeof(u32) * 16, &parent->dev); info = framebuffer_alloc(sizeof(*par), &parent->dev);
if (!info) { if (!info) {
release_mem_region(res_start, res_size); release_mem_region(res_start, res_size);
return; return;
} }
platform_set_drvdata(parent, info); platform_set_drvdata(parent, info);
par = info->par;
fix = &info->fix; fix = &info->fix;
var = &info->var; var = &info->var;
info->par = par;
if (name) { if (name) {
strcpy(fix->id, "OFfb "); strcpy(fix->id, "OFfb ");
...@@ -515,7 +512,7 @@ static void offb_init_fb(struct platform_device *parent, const char *name, ...@@ -515,7 +512,7 @@ static void offb_init_fb(struct platform_device *parent, const char *name,
info->fbops = &offb_ops; info->fbops = &offb_ops;
info->screen_base = ioremap(address, fix->smem_len); info->screen_base = ioremap(address, fix->smem_len);
info->pseudo_palette = (void *) (info + 1); info->pseudo_palette = par->pseudo_palette;
info->flags = FBINFO_DEFAULT | FBINFO_MISC_FIRMWARE | foreign_endian; info->flags = FBINFO_DEFAULT | FBINFO_MISC_FIRMWARE | foreign_endian;
fb_alloc_cmap(&info->cmap, 256, 0); fb_alloc_cmap(&info->cmap, 256, 0);
......
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