forked from luck/tmp_suning_uos_patched
video: hitfb: Convert to framebuffer_alloc().
Follows the sh_mobile_lcdcfb change. Also fixes up a memory leak with cmap allocation. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
e33afddca1
commit
684dcd0561
@ -44,9 +44,6 @@ static struct fb_fix_screeninfo hitfb_fix __initdata = {
|
||||
.accel = FB_ACCEL_NONE,
|
||||
};
|
||||
|
||||
static u32 pseudo_palette[16];
|
||||
static struct fb_info fb_info;
|
||||
|
||||
static inline void hitfb_accel_wait(void)
|
||||
{
|
||||
while (fb_readw(HD64461_GRCFGR) & HD64461_GRCFGR_ACCSTATUS) ;
|
||||
@ -331,6 +328,8 @@ static struct fb_ops hitfb_ops = {
|
||||
static int __init hitfb_probe(struct platform_device *dev)
|
||||
{
|
||||
unsigned short lcdclor, ldr3, ldvndr;
|
||||
struct fb_info *info;
|
||||
int ret;
|
||||
|
||||
if (fb_get_options("hitfb", NULL))
|
||||
return -ENODEV;
|
||||
@ -384,28 +383,50 @@ static int __init hitfb_probe(struct platform_device *dev)
|
||||
break;
|
||||
}
|
||||
|
||||
fb_info.fbops = &hitfb_ops;
|
||||
fb_info.var = hitfb_var;
|
||||
fb_info.fix = hitfb_fix;
|
||||
fb_info.pseudo_palette = pseudo_palette;
|
||||
fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN |
|
||||
info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev);
|
||||
if (unlikely(!info))
|
||||
return -ENOMEM;
|
||||
|
||||
info->fbops = &hitfb_ops;
|
||||
info->var = hitfb_var;
|
||||
info->fix = hitfb_fix;
|
||||
info->pseudo_palette = info->par;
|
||||
info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN |
|
||||
FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_COPYAREA;
|
||||
|
||||
fb_info.screen_base = (void *)hitfb_fix.smem_start;
|
||||
info->screen_base = (void *)hitfb_fix.smem_start;
|
||||
|
||||
fb_alloc_cmap(&fb_info.cmap, 256, 0);
|
||||
ret = fb_alloc_cmap(&info->cmap, 256, 0);
|
||||
if (unlikely(ret < 0))
|
||||
goto err_fb;
|
||||
|
||||
if (register_framebuffer(&fb_info) < 0)
|
||||
return -EINVAL;
|
||||
ret = register_framebuffer(info);
|
||||
if (unlikely(ret < 0))
|
||||
goto err;
|
||||
|
||||
platform_set_drvdata(dev, info);
|
||||
|
||||
printk(KERN_INFO "fb%d: %s frame buffer device\n",
|
||||
fb_info.node, fb_info.fix.id);
|
||||
info->node, info->fix.id);
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
fb_dealloc_cmap(&info->cmap);
|
||||
err_fb:
|
||||
framebuffer_release(info);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __exit hitfb_remove(struct platform_device *dev)
|
||||
{
|
||||
return unregister_framebuffer(&fb_info);
|
||||
struct fb_info *info = platform_get_drvdata(dev);
|
||||
|
||||
unregister_framebuffer(info);
|
||||
fb_dealloc_cmap(&info->cmap);
|
||||
framebuffer_release(info);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
Loading…
Reference in New Issue
Block a user