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,
|
.accel = FB_ACCEL_NONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static u32 pseudo_palette[16];
|
|
||||||
static struct fb_info fb_info;
|
|
||||||
|
|
||||||
static inline void hitfb_accel_wait(void)
|
static inline void hitfb_accel_wait(void)
|
||||||
{
|
{
|
||||||
while (fb_readw(HD64461_GRCFGR) & HD64461_GRCFGR_ACCSTATUS) ;
|
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)
|
static int __init hitfb_probe(struct platform_device *dev)
|
||||||
{
|
{
|
||||||
unsigned short lcdclor, ldr3, ldvndr;
|
unsigned short lcdclor, ldr3, ldvndr;
|
||||||
|
struct fb_info *info;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (fb_get_options("hitfb", NULL))
|
if (fb_get_options("hitfb", NULL))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -384,28 +383,50 @@ static int __init hitfb_probe(struct platform_device *dev)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_info.fbops = &hitfb_ops;
|
info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev);
|
||||||
fb_info.var = hitfb_var;
|
if (unlikely(!info))
|
||||||
fb_info.fix = hitfb_fix;
|
return -ENOMEM;
|
||||||
fb_info.pseudo_palette = pseudo_palette;
|
|
||||||
fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN |
|
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;
|
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)
|
ret = register_framebuffer(info);
|
||||||
return -EINVAL;
|
if (unlikely(ret < 0))
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
platform_set_drvdata(dev, info);
|
||||||
|
|
||||||
printk(KERN_INFO "fb%d: %s frame buffer device\n",
|
printk(KERN_INFO "fb%d: %s frame buffer device\n",
|
||||||
fb_info.node, fb_info.fix.id);
|
info->node, info->fix.id);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err:
|
||||||
|
fb_dealloc_cmap(&info->cmap);
|
||||||
|
err_fb:
|
||||||
|
framebuffer_release(info);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __exit hitfb_remove(struct platform_device *dev)
|
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
|
#ifdef CONFIG_PM
|
||||||
|
Loading…
Reference in New Issue
Block a user