Merge branch 'linus' into x86/urgent
[pandora-kernel.git] / drivers / video / sgivwfb.c
index 2e8769d..f5252c2 100644 (file)
@@ -9,7 +9,6 @@
  *  more details.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
@@ -22,6 +21,7 @@
 
 #include <asm/io.h>
 #include <asm/mtrr.h>
+#include <asm/visws/sgivw.h>
 
 #define INCLUDE_TIMING_TABLE_DATA
 #define DBE_REG_BASE par->regs
@@ -42,10 +42,6 @@ struct sgivw_par {
  *  The default can be overridden if the driver is compiled as a module
  */
 
-/* set by arch/i386/kernel/setup.c */
-extern unsigned long sgivwfb_mem_phys;
-extern unsigned long sgivwfb_mem_size;
-
 static int ypan = 0;
 static int ywrap = 0;
 
@@ -115,7 +111,7 @@ static int sgivwfb_set_par(struct fb_info *info);
 static int sgivwfb_setcolreg(u_int regno, u_int red, u_int green,
                             u_int blue, u_int transp,
                             struct fb_info *info);
-static int sgivwfb_mmap(struct fb_info *info, struct file *file,
+static int sgivwfb_mmap(struct fb_info *info,
                        struct vm_area_struct *vma);
 
 static struct fb_ops sgivwfb_ops = {
@@ -706,7 +702,7 @@ static int sgivwfb_setcolreg(u_int regno, u_int red, u_int green,
        return 0;
 }
 
-static int sgivwfb_mmap(struct fb_info *info, struct file *file,
+static int sgivwfb_mmap(struct fb_info *info,
                        struct vm_area_struct *vma)
 {
        unsigned long size = vma->vm_end - vma->vm_start;
@@ -723,7 +719,6 @@ static int sgivwfb_mmap(struct fb_info *info, struct file *file,
        if (remap_pfn_range(vma, vma->vm_start, offset >> PAGE_SHIFT,
                                                size, vma->vm_page_prot))
                return -EAGAIN;
-       vma->vm_file = file;
        printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n",
               offset, vma->vm_start);
        return 0;
@@ -750,14 +745,13 @@ int __init sgivwfb_setup(char *options)
 /*
  *  Initialisation
  */
-static int __init sgivwfb_probe(struct device *device)
+static int __init sgivwfb_probe(struct platform_device *dev)
 {
-       struct platform_device *dev = to_platform_device(device);
        struct sgivw_par *par;
        struct fb_info *info;
        char *monitor;
 
-       info = framebuffer_alloc(sizeof(struct sgivw_par) + sizeof(u32) * 256, &dev->dev);
+       info = framebuffer_alloc(sizeof(struct sgivw_par) + sizeof(u32) * 16, &dev->dev);
        if (!info)
                return -ENOMEM;
        par = info->par;
@@ -813,7 +807,7 @@ static int __init sgivwfb_probe(struct device *device)
                goto fail_register_framebuffer;
        }
 
-       dev_set_drvdata(&dev->dev, info);
+       platform_set_drvdata(dev, info);
 
        printk(KERN_INFO "fb%d: SGI DBE frame buffer device, using %ldK of video memory at %#lx\n",      
                info->node, sgivwfb_mem_size >> 10, sgivwfb_mem_phys);
@@ -831,9 +825,9 @@ fail_ioremap_regs:
        return -ENXIO;
 }
 
-static int sgivwfb_remove(struct device *device)
+static int sgivwfb_remove(struct platform_device *dev)
 {
-       struct fb_info *info = dev_get_drvdata(device);
+       struct fb_info *info = platform_get_drvdata(dev);
 
        if (info) {
                struct sgivw_par *par = info->par;
@@ -847,11 +841,12 @@ static int sgivwfb_remove(struct device *device)
        return 0;
 }
 
-static struct device_driver sgivwfb_driver = {
-       .name   = "sgivwfb",
-       .bus    = &platform_bus_type,
+static struct platform_driver sgivwfb_driver = {
        .probe  = sgivwfb_probe,
        .remove = sgivwfb_remove,
+       .driver = {
+               .name   = "sgivwfb",
+       },
 };
 
 static struct platform_device *sgivwfb_device;
@@ -867,7 +862,7 @@ int __init sgivwfb_init(void)
                return -ENODEV;
        sgivwfb_setup(option);
 #endif
-       ret = driver_register(&sgivwfb_driver);
+       ret = platform_driver_register(&sgivwfb_driver);
        if (!ret) {
                sgivwfb_device = platform_device_alloc("sgivwfb", 0);
                if (sgivwfb_device) {
@@ -875,7 +870,7 @@ int __init sgivwfb_init(void)
                } else
                        ret = -ENOMEM;
                if (ret) {
-                       driver_unregister(&sgivwfb_driver);
+                       platform_driver_unregister(&sgivwfb_driver);
                        platform_device_put(sgivwfb_device);
                }
        }
@@ -890,7 +885,7 @@ MODULE_LICENSE("GPL");
 static void __exit sgivwfb_exit(void)
 {
        platform_device_unregister(sgivwfb_device);
-       driver_unregister(&sgivwfb_driver);
+       platform_driver_unregister(&sgivwfb_driver);
 }
 
 module_exit(sgivwfb_exit);