Merge branch 'stable/bug-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / drivers / video / vga16fb.c
index bf638a4..28ccab4 100644 (file)
@@ -65,7 +65,7 @@ struct vga16fb_par {
 
 /* --------------------------------------------------------------------- */
 
-static struct fb_var_screeninfo vga16fb_defined __initdata = {
+static struct fb_var_screeninfo vga16fb_defined __devinitdata = {
        .xres           = 640,
        .yres           = 480,
        .xres_virtual   = 640,
@@ -85,7 +85,7 @@ static struct fb_var_screeninfo vga16fb_defined __initdata = {
 };
 
 /* name should not depend on EGA/VGA */
-static struct fb_fix_screeninfo vga16fb_fix __initdata = {
+static struct fb_fix_screeninfo vga16fb_fix __devinitdata = {
        .id             = "VGA16 VGA",
        .smem_start     = VGA_FB_PHYS,
        .smem_len       = VGA_FB_PHYS_LEN,
@@ -1263,10 +1263,19 @@ static void vga16fb_imageblit(struct fb_info *info, const struct fb_image *image
                vga_imageblit_color(info, image);
 }
 
+static void vga16fb_destroy(struct fb_info *info)
+{
+       iounmap(info->screen_base);
+       fb_dealloc_cmap(&info->cmap);
+       /* XXX unshare VGA regions */
+       framebuffer_release(info);
+}
+
 static struct fb_ops vga16fb_ops = {
        .owner          = THIS_MODULE,
        .fb_open        = vga16fb_open,
        .fb_release     = vga16fb_release,
+       .fb_destroy     = vga16fb_destroy,
        .fb_check_var   = vga16fb_check_var,
        .fb_set_par     = vga16fb_set_par,
        .fb_setcolreg   = vga16fb_setcolreg,
@@ -1278,7 +1287,7 @@ static struct fb_ops vga16fb_ops = {
 };
 
 #ifndef MODULE
-static int vga16fb_setup(char *options)
+static int __init vga16fb_setup(char *options)
 {
        char *this_opt;
        
@@ -1306,6 +1315,11 @@ static int __devinit vga16fb_probe(struct platform_device *dev)
                ret = -ENOMEM;
                goto err_fb_alloc;
        }
+       info->apertures = alloc_apertures(1);
+       if (!info->apertures) {
+               ret = -ENOMEM;
+               goto err_ioremap;
+       }
 
        /* XXX share VGA_FB_PHYS and I/O region with vgacon and others */
        info->screen_base = (void __iomem *)VGA_MAP_MEM(VGA_FB_PHYS, 0);
@@ -1335,7 +1349,7 @@ static int __devinit vga16fb_probe(struct platform_device *dev)
        info->fix = vga16fb_fix;
        /* supports rectangles with widths of multiples of 8 */
        info->pixmap.blit_x = 1 << 7 | 1 << 15 | 1 << 23 | 1 << 31;
-       info->flags = FBINFO_FLAG_DEFAULT |
+       info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE |
                FBINFO_HWACCEL_YPAN;
 
        i = (info->var.bits_per_pixel == 8) ? 256 : 16;
@@ -1354,6 +1368,9 @@ static int __devinit vga16fb_probe(struct platform_device *dev)
 
        vga16fb_update_fix(info);
 
+       info->apertures->ranges[0].base = VGA_FB_PHYS;
+       info->apertures->ranges[0].size = VGA_FB_PHYS_LEN;
+
        if (register_framebuffer(info) < 0) {
                printk(KERN_ERR "vga16fb: unable to register framebuffer\n");
                ret = -EINVAL;
@@ -1376,24 +1393,19 @@ static int __devinit vga16fb_probe(struct platform_device *dev)
        return ret;
 }
 
-static int vga16fb_remove(struct platform_device *dev)
+static int __devexit vga16fb_remove(struct platform_device *dev)
 {
        struct fb_info *info = platform_get_drvdata(dev);
 
-       if (info) {
+       if (info)
                unregister_framebuffer(info);
-               iounmap(info->screen_base);
-               fb_dealloc_cmap(&info->cmap);
-       /* XXX unshare VGA regions */
-               framebuffer_release(info);
-       }
 
        return 0;
 }
 
 static struct platform_driver vga16fb_driver = {
        .probe = vga16fb_probe,
-       .remove = vga16fb_remove,
+       .remove = __devexit_p(vga16fb_remove),
        .driver = {
                .name = "vga16fb",
        },