Merge mainline v2.6.27-rc2 tree into linux-omap tree
[pandora-kernel.git] / drivers / video / bw2.c
index 718b9f8..e721644 100644 (file)
 #include <linux/init.h>
 #include <linux/fb.h>
 #include <linux/mm.h>
+#include <linux/of_device.h>
 
 #include <asm/io.h>
-#include <asm/oplib.h>
-#include <asm/prom.h>
-#include <asm/of_device.h>
 #include <asm/fbio.h>
 
 #include "sbuslib.h"
@@ -233,9 +231,9 @@ static u8 bw2regs_66hz[] __devinitdata = {
        0x10, 0x20,     0
 };
 
-static void __devinit bw2_do_default_mode(struct bw2_par *par,
-                                         struct fb_info *info,
-                                         int *linebytes)
+static int __devinit bw2_do_default_mode(struct bw2_par *par,
+                                        struct fb_info *info,
+                                        int *linebytes)
 {
        u8 status, mon;
        u8 *p;
@@ -266,17 +264,18 @@ static void __devinit bw2_do_default_mode(struct bw2_par *par,
                break;
 
        case BWTWO_SR_ID_NOCONN:
-               return;
+               return 0;
 
        default:
-               prom_printf("bw2: can't handle SR %02x\n",
-                           status);
-               prom_halt();
+               printk(KERN_ERR "bw2: can't handle SR %02x\n",
+                      status);
+               return -EINVAL;
        }
        for ( ; *p; p += 2) {
                u8 __iomem *regp = &((u8 __iomem *)par->regs)[p[0]];
                sbus_writeb(p[1], regp);
        }
+       return 0;
 }
 
 static int __devinit bw2_probe(struct of_device *op, const struct of_device_id *match)
@@ -298,7 +297,7 @@ static int __devinit bw2_probe(struct of_device *op, const struct of_device_id *
        par->physbase = op->resource[0].start;
        par->which_io = op->resource[0].flags & IORESOURCE_BITS;
 
-       sbusfb_fill_var(&info->var, dp->node, 1);
+       sbusfb_fill_var(&info->var, dp, 1);
        linebytes = of_getintprop_default(dp, "linebytes",
                                          info->var.xres);
 
@@ -312,8 +311,11 @@ static int __devinit bw2_probe(struct of_device *op, const struct of_device_id *
        if (!par->regs)
                goto out_release_fb;
 
-       if (!of_find_property(dp, "width", NULL))
-               bw2_do_default_mode(par, info, &linebytes);
+       if (!of_find_property(dp, "width", NULL)) {
+               err = bw2_do_default_mode(par, info, &linebytes);
+               if (err)
+                       goto out_unmap_regs;
+       }
 
        par->fbsize = PAGE_ALIGN(linebytes * info->var.yres);
 
@@ -325,7 +327,7 @@ static int __devinit bw2_probe(struct of_device *op, const struct of_device_id *
        if (!info->screen_base)
                goto out_unmap_regs;
 
-       bw2_blank(0, info);
+       bw2_blank(FB_BLANK_UNBLANK, info);
 
        bw2_init_fix(info, linebytes);
 
@@ -335,7 +337,7 @@ static int __devinit bw2_probe(struct of_device *op, const struct of_device_id *
 
        dev_set_drvdata(&op->dev, info);
 
-       printk("%s: bwtwo at %lx:%lx\n",
+       printk(KERN_INFO "%s: bwtwo at %lx:%lx\n",
               dp->full_name, par->which_io, par->physbase);
 
        return 0;
@@ -395,10 +397,9 @@ static int __init bw2_init(void)
 
 static void __exit bw2_exit(void)
 {
-       return of_unregister_driver(&bw2_driver);
+       of_unregister_driver(&bw2_driver);
 }
 
-
 module_init(bw2_init);
 module_exit(bw2_exit);