Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / video / dnfb.c
index 7e75f74..5abd3cb 100644 (file)
@@ -6,6 +6,8 @@
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
+#include <linux/platform_device.h>
+
 #include <asm/setup.h>
 #include <asm/system.h>
 #include <asm/irq.h>
@@ -114,27 +116,26 @@ static struct fb_ops dn_fb_ops = {
        .fb_fillrect    = cfb_fillrect,
        .fb_copyarea    = dnfb_copyarea,
        .fb_imageblit   = cfb_imageblit,
-       .fb_cursor      = soft_cursor,
 };
 
 struct fb_var_screeninfo dnfb_var __devinitdata = {
-       .xres           1280,
-       .yres           1024,
-       .xres_virtual   2048,
-       .yres_virtual   1024,
-       .bits_per_pixel 1,
-       .height         -1,
-       .width          -1,
-       .vmode          FB_VMODE_NONINTERLACED,
+       .xres           1280,
+       .yres           1024,
+       .xres_virtual   2048,
+       .yres_virtual   1024,
+       .bits_per_pixel 1,
+       .height         -1,
+       .width          -1,
+       .vmode          FB_VMODE_NONINTERLACED,
 };
 
 static struct fb_fix_screeninfo dnfb_fix __devinitdata = {
-       .id             "Apollo Mono",
-       .smem_start     (FRAME_BUFFER_START + IO_BASE),
-       .smem_len       FRAME_BUFFER_LEN,
-       .type           FB_TYPE_PACKED_PIXELS,
-       .visual         FB_VISUAL_MONO10,
-       .line_length    256,
+       .id             "Apollo Mono",
+       .smem_start     (FRAME_BUFFER_START + IO_BASE),
+       .smem_len       FRAME_BUFFER_LEN,
+       .type           FB_TYPE_PACKED_PIXELS,
+       .visual         FB_VISUAL_MONO10,
+       .line_length    256,
 };
 
 static int dnfb_blank(int blank, struct fb_info *info)
@@ -226,9 +227,8 @@ void dnfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
  * Initialization
  */
 
-static int __devinit dnfb_probe(struct device *device)
+static int __devinit dnfb_probe(struct platform_device *dev)
 {
-       struct platform_device *dev = to_platform_device(device);
        struct fb_info *info;
        int err = 0;
 
@@ -239,6 +239,9 @@ static int __devinit dnfb_probe(struct device *device)
        info->fbops = &dn_fb_ops;
        info->fix = dnfb_fix;
        info->var = dnfb_var;
+       info->var.red.length = 1;
+       info->var.red.offset = 0;
+       info->var.green = info->var.blue = info->var.red;
        info->screen_base = (u_char *) info->fix.smem_start;
 
        err = fb_alloc_cmap(&info->cmap, 2, 0);
@@ -253,7 +256,7 @@ static int __devinit dnfb_probe(struct device *device)
                framebuffer_release(info);
                return err;
        }
-       dev_set_drvdata(&dev->dev, info);
+       platform_set_drvdata(dev, info);
 
        /* now we have registered we can safely setup the hardware */
        out_8(AP_CONTROL_3A, RESET_CREG);
@@ -267,10 +270,11 @@ static int __devinit dnfb_probe(struct device *device)
        return err;
 }
 
-static struct device_driver dnfb_driver = {
-       .name   = "dnfb",
-       .bus    = &platform_bus_type,
+static struct platform_driver dnfb_driver = {
        .probe  = dnfb_probe,
+       .driver = {
+               .name   = "dnfb",
+       },
 };
 
 static struct platform_device dnfb_device = {
@@ -281,14 +285,19 @@ int __init dnfb_init(void)
 {
        int ret;
 
-       ret = driver_register(&dnfb_driver);
+       if (fb_get_options("dnfb", NULL))
+               return -ENODEV;
+
+       ret = platform_driver_register(&dnfb_driver);
 
        if (!ret) {
                ret = platform_device_register(&dnfb_device);
                if (ret)
-                       driver_unregister(&dnfb_driver);
+                       platform_driver_unregister(&dnfb_driver);
        }
        return ret;
 }
 
+module_init(dnfb_init);
+
 MODULE_LICENSE("GPL");