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 / mtd / maps / integrator-flash.c
index e39a98a..a3ba52f 100644 (file)
@@ -1,28 +1,28 @@
 /*======================================================================
 
     drivers/mtd/maps/integrator-flash.c: ARM Integrator flash map driver
-  
+
     Copyright (C) 2000 ARM Limited
     Copyright (C) 2003 Deep Blue Solutions Ltd.
-  
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
-  
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-  
+
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-  
-   This is access code for flashes using ARM's flash partitioning 
+
+   This is access code for flashes using ARM's flash partitioning
    standards.
 
-   $Id: integrator-flash.c,v 1.18 2004/11/01 13:26:15 rmk Exp $
+   $Id: integrator-flash.c,v 1.20 2005/11/07 11:14:27 gleixner Exp $
 
 ======================================================================*/
 
@@ -32,7 +32,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/ioport.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/init.h>
 
 #include <linux/mtd/mtd.h>
@@ -67,9 +67,8 @@ static void armflash_set_vpp(struct map_info *map, int on)
 
 static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL };
 
-static int armflash_probe(struct device *_dev)
+static int armflash_probe(struct platform_device *dev)
 {
-       struct platform_device *dev = to_platform_device(_dev);
        struct flash_platform_data *plat = dev->dev.platform_data;
        struct resource *res = dev->resource;
        unsigned int size = res->end - res->start + 1;
@@ -138,7 +137,7 @@ static int armflash_probe(struct device *_dev)
        }
 
        if (err == 0)
-               dev_set_drvdata(&dev->dev, info);
+               platform_set_drvdata(dev, info);
 
        /*
         * If we got an error, free all resources.
@@ -148,8 +147,7 @@ static int armflash_probe(struct device *_dev)
                        del_mtd_partitions(info->mtd);
                        map_destroy(info->mtd);
                }
-               if (info->parts)
-                       kfree(info->parts);
+               kfree(info->parts);
 
  no_device:
                iounmap(base);
@@ -164,20 +162,18 @@ static int armflash_probe(struct device *_dev)
        return err;
 }
 
-static int armflash_remove(struct device *_dev)
+static int armflash_remove(struct platform_device *dev)
 {
-       struct platform_device *dev = to_platform_device(_dev);
-       struct armflash_info *info = dev_get_drvdata(&dev->dev);
+       struct armflash_info *info = platform_get_drvdata(dev);
 
-       dev_set_drvdata(&dev->dev, NULL);
+       platform_set_drvdata(dev, NULL);
 
        if (info) {
                if (info->mtd) {
                        del_mtd_partitions(info->mtd);
                        map_destroy(info->mtd);
                }
-               if (info->parts)
-                       kfree(info->parts);
+               kfree(info->parts);
 
                iounmap(info->map.virt);
                release_resource(info->res);
@@ -192,21 +188,22 @@ static int armflash_remove(struct device *_dev)
        return 0;
 }
 
-static struct device_driver armflash_driver = {
-       .name           = "armflash",
-       .bus            = &platform_bus_type,
+static struct platform_driver armflash_driver = {
        .probe          = armflash_probe,
        .remove         = armflash_remove,
+       .driver         = {
+               .name   = "armflash",
+       },
 };
 
 static int __init armflash_init(void)
 {
-       return driver_register(&armflash_driver);
+       return platform_driver_register(&armflash_driver);
 }
 
 static void __exit armflash_exit(void)
 {
-       driver_unregister(&armflash_driver);
+       platform_driver_unregister(&armflash_driver);
 }
 
 module_init(armflash_init);