intelfb: support 945GME (as used in ASUS Eee 901)
[safe/jmp/linux-2.6] / drivers / video / skeletonfb.c
index c15b6fe..df53365 100644 (file)
@@ -14,7 +14,7 @@
  *  of it. 
  *
  *  First the roles of struct fb_info and struct display have changed. Struct
- *  display will go away. The way the the new framebuffer console code will
+ *  display will go away. The way the new framebuffer console code will
  *  work is that it will act to translate data about the tty/console in 
  *  struct vc_data to data in a device independent way in struct fb_info. Then
  *  various functions in struct fb_ops will be called to store the device 
@@ -84,7 +84,7 @@ struct xxx_par;
  * if we don't use modedb. If we do use modedb see xxxfb_init how to use it
  * to get a fb_var_screeninfo. Otherwise define a default var as well. 
  */
-static struct fb_fix_screeninfo xxxfb_fix __initdata = {
+static struct fb_fix_screeninfo xxxfb_fix __devinitdata = {
        .id =           "FB's name", 
        .type =         FB_TYPE_PACKED_PIXELS,
        .visual =       FB_VISUAL_PSEUDOCOLOR,
@@ -132,7 +132,6 @@ static struct fb_info info;
 static struct xxx_par __initdata current_par;
 
 int xxxfb_init(void);
-int xxxfb_setup(char*);
 
 /**
  *     xxxfb_open - Optional function. Called when the framebuffer is
@@ -676,13 +675,13 @@ static struct fb_ops xxxfb_ops = {
      *  Initialization
      */
 
-/* static int __init xxfb_probe (struct device *device) -- for platform devs */
+/* static int __init xxfb_probe (struct platform_device *pdev) -- for platform devs */
 static int __devinit xxxfb_probe(struct pci_dev *dev,
                              const struct pci_device_id *ent)
 {
     struct fb_info *info;
     struct xxx_par *par;
-    struct device* device = &dev->dev; /* for pci drivers */
+    struct device *device = &dev->dev; /* or &pdev->dev */
     int cmap_len, retval;      
    
     /*
@@ -705,7 +704,7 @@ static int __devinit xxxfb_probe(struct pci_dev *dev,
     info->screen_base = framebuffer_virtual_memory;
     info->fbops = &xxxfb_ops;
     info->fix = xxxfb_fix; /* this will be the only time xxxfb_fix will be
-                           * used, so mark it as __initdata
+                           * used, so mark it as __devinitdata
                            */
     info->pseudo_palette = pseudo_palette; /* The pseudopalette is an
                                            * 16-member array
@@ -781,7 +780,7 @@ static int __devinit xxxfb_probe(struct pci_dev *dev,
      *
      * NOTE: This field is currently unused.
      */
-    info->pixmap.scan_align = 32;
+    info->pixmap.access_align = 32;
 /***************************** End optional stage ***************************/
 
     /*
@@ -825,18 +824,18 @@ static int __devinit xxxfb_probe(struct pci_dev *dev,
        return -EINVAL;
     printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node,
           info->fix.id);
-    pci_set_drvdata(dev, info); /* or dev_set_drvdata(device, info) */
+    pci_set_drvdata(dev, info); /* or platform_set_drvdata(pdev, info) */
     return 0;
 }
 
     /*
      *  Cleanup
      */
-/* static void __devexit xxxfb_remove(struct device *device) */
+/* static void __devexit xxxfb_remove(struct platform_device *pdev) */
 static void __devexit xxxfb_remove(struct pci_dev *dev)
 {
        struct fb_info *info = pci_get_drvdata(dev);
-       /* or dev_get_drvdata(device); */
+       /* or platform_get_drvdata(pdev); */
 
        if (info) {
                unregister_framebuffer(info);
@@ -900,6 +899,8 @@ static struct pci_driver xxxfb_driver = {
        .resume =       xxxfb_resume,  /* optional but recommended */
 };
 
+MODULE_DEVICE_TABLE(pci, xxxfb_id_table);
+
 int __init xxxfb_init(void)
 {
        /*
@@ -960,18 +961,32 @@ static int xxxfb_resume(struct platform_dev *dev)
 #define xxxfb_resume NULL
 #endif /* CONFIG_PM */
 
-static struct device_driver xxxfb_driver = {
-       .name = "xxxfb",
-       .bus  = &platform_bus_type,
+static struct platform_device_driver xxxfb_driver = {
        .probe = xxxfb_probe,
        .remove = xxxfb_remove,
        .suspend = xxxfb_suspend, /* optional but recommended */
        .resume = xxxfb_resume,   /* optional but recommended */
+       .driver = {
+               .name = "xxxfb",
+       },
 };
 
-static struct platform_device xxxfb_device = {
-       .name = "xxxfb",
-};
+static struct platform_device *xxxfb_device;
+
+#ifndef MODULE
+    /*
+     *  Setup
+     */
+
+/*
+ * Only necessary if your driver takes special options,
+ * otherwise we fall back on the generic fb_setup().
+ */
+int __init xxxfb_setup(char *options)
+{
+    /* Parse user speficied options (`video=xxxfb:') */
+}
+#endif /* MODULE */
 
 static int __init xxxfb_init(void)
 {
@@ -986,12 +1001,16 @@ static int __init xxxfb_init(void)
                return -ENODEV;
        xxxfb_setup(option);
 #endif
-       ret = driver_register(&xxxfb_driver);
+       ret = platform_driver_register(&xxxfb_driver);
 
        if (!ret) {
-               ret = platform_device_register(&xxxfb_device);
-               if (ret)
-                       driver_unregister(&xxxfb_driver);
+               xxxfb_device = platform_device_register_simple("xxxfb", 0,
+                                                               NULL, 0);
+
+               if (IS_ERR(xxxfb_device)) {
+                       platform_driver_unregister(&xxxfb_driver);
+                       ret = PTR_ERR(xxxfb_device);
+               }
        }
 
        return ret;
@@ -999,26 +1018,11 @@ static int __init xxxfb_init(void)
 
 static void __exit xxxfb_exit(void)
 {
-       platform_device_unregister(&xxxfb_device);
-       driver_unregister(&xxxfb_driver);
+       platform_device_unregister(xxxfb_device);
+       platform_driver_unregister(&xxxfb_driver);
 }
 #endif /* CONFIG_PCI */
 
-#ifdef MODULE
-    /*
-     *  Setup
-     */
-
-/* 
- * Only necessary if your driver takes special options,
- * otherwise we fall back on the generic fb_setup().
- */
-int __init xxxfb_setup(char *options)
-{
-    /* Parse user speficied options (`video=xxxfb:') */
-}
-#endif /* MODULE */
-
 /* ------------------------------------------------------------------------- */