fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / video / macfb.c
index 4945a4c..180d94c 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/mm.h>
-#include <linux/tty.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/nubus.h>
@@ -589,7 +588,6 @@ static struct fb_ops macfb_ops = {
        .fb_fillrect    = cfb_fillrect,
        .fb_copyarea    = cfb_copyarea,
        .fb_imageblit   = cfb_imageblit,
-       .fb_cursor      = soft_cursor,
 };
 
 void __init macfb_setup(char *options)
@@ -610,18 +608,35 @@ void __init macfb_setup(char *options)
        }
 }
 
-void __init macfb_init(void)
+static void __init iounmap_macfb(void)
+{
+       if (valkyrie_cmap_regs)
+               iounmap(valkyrie_cmap_regs);
+       if (dafb_cmap_regs)
+               iounmap(dafb_cmap_regs);
+       if (v8_brazil_cmap_regs)
+               iounmap(v8_brazil_cmap_regs);
+       if (rbv_cmap_regs)
+               iounmap(rbv_cmap_regs);
+       if (civic_cmap_regs)
+               iounmap(civic_cmap_regs);
+       if (csc_cmap_regs)
+               iounmap(csc_cmap_regs);
+}
+
+static int __init macfb_init(void)
 {
        int video_cmap_len, video_is_nubus = 0;
        struct nubus_dev* ndev = NULL;
        char *option = NULL;
+       int err;
 
        if (fb_get_options("macfb", &option))
                return -ENODEV;
        macfb_setup(option);
 
        if (!MACH_IS_MAC) 
-               return;
+               return -ENODEV;
 
        /* There can only be one internal video controller anyway so
           we're not too worried about this */
@@ -959,11 +974,15 @@ void __init macfb_init(void)
 
        fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0);
        
-       if (register_framebuffer(&fb_info) < 0)
-               return;
-
-       printk("fb%d: %s frame buffer device\n",
-              fb_info.node, fb_info.fix.id);
+       err = register_framebuffer(&fb_info);
+       if (!err)
+               printk("fb%d: %s frame buffer device\n",
+                      fb_info.node, fb_info.fix.id);
+       else {
+               iounmap(fb_info.screen_base);
+               iounmap_macfb();
+       }
+       return err;
 }
 
 module_init(macfb_init);