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 / sun_uflash.c
index 2a9932c..0758cb1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: sun_uflash.c,v 1.9 2004/07/12 21:59:45 dwmw2 Exp $
+/* $Id: sun_uflash.c,v 1.13 2005/11/07 11:14:28 gleixner Exp $
  *
  * sun_uflash - Driver implementation for user-programmable flash
  * present on many Sun Microsystems SME boardsets.
@@ -63,7 +63,7 @@ int uflash_devinit(struct linux_ebus_device* edev)
        iTmp = prom_getproperty(
                edev->prom_node, "reg", (void *)regs, sizeof(regs));
        if ((iTmp % sizeof(regs[0])) != 0) {
-               printk("%s: Strange reg property size %d\n", 
+               printk("%s: Strange reg property size %d\n",
                        UFLASH_DEVNAME, iTmp);
                return -ENODEV;
        }
@@ -75,7 +75,7 @@ int uflash_devinit(struct linux_ebus_device* edev)
                 * can work on supporting it.
                 */
                printk("%s: unsupported device at 0x%lx (%d regs): " \
-                       "email ebrower@usa.net\n", 
+                       "email ebrower@usa.net\n",
                        UFLASH_DEVNAME, edev->resource[0].start, nregs);
                return -ENODEV;
        }
@@ -84,7 +84,7 @@ int uflash_devinit(struct linux_ebus_device* edev)
                printk("%s: unable to kmalloc new device\n", UFLASH_DEVNAME);
                return(-ENOMEM);
        }
-       
+
        /* copy defaults and tweak parameters */
        memcpy(&pdev->map, &uflash_map_templ, sizeof(uflash_map_templ));
        pdev->map.size = regs[0].reg_size;
@@ -96,8 +96,7 @@ int uflash_devinit(struct linux_ebus_device* edev)
                pdev->map.name = pdev->name;
        }
        pdev->map.phys = edev->resource[0].start;
-       pdev->map.virt = 
-               (unsigned long)ioremap_nocache(edev->resource[0].start, pdev->map.size);
+       pdev->map.virt = ioremap_nocache(edev->resource[0].start, pdev->map.size);
        if(0 == pdev->map.virt) {
                printk("%s: failed to map device\n", __FUNCTION__);
                kfree(pdev->name);
@@ -110,7 +109,7 @@ int uflash_devinit(struct linux_ebus_device* edev)
        /* MTD registration */
        pdev->mtd = do_map_probe("cfi_probe", &pdev->map);
        if(0 == pdev->mtd) {
-               iounmap((void *)pdev->map.virt);
+               iounmap(pdev->map.virt);
                kfree(pdev->name);
                kfree(pdev);
                return(-ENXIO);
@@ -156,7 +155,7 @@ static void __exit uflash_cleanup(void)
 
        list_for_each(udevlist, &device_list) {
                udev = list_entry(udevlist, struct uflash_dev, list);
-               DEBUG(2, "%s: removing device %s\n", 
+               DEBUG(2, "%s: removing device %s\n",
                        UFLASH_DEVNAME, udev->name);
 
                if(0 != udev->mtd) {
@@ -164,14 +163,12 @@ static void __exit uflash_cleanup(void)
                        map_destroy(udev->mtd);
                }
                if(0 != udev->map.virt) {
-                       iounmap((void*)udev->map.virt);
-                       udev->map.virt = 0;
-               }
-               if(0 != udev->name) {
-                       kfree(udev->name);
+                       iounmap(udev->map.virt);
+                       udev->map.virt = NULL;
                }
+               kfree(udev->name);
                kfree(udev);
-       }       
+       }
 }
 
 module_init(uflash_init);