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 / uclinux.c
index 811d92e..f7264dc 100644 (file)
@@ -5,7 +5,7 @@
  *
  *     (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
  *
- *     $Id: uclinux.c,v 1.10 2005/01/05 18:05:13 dwmw2 Exp $
+ *     $Id: uclinux.c,v 1.12 2005/11/07 11:14:29 gleixner Exp $
  */
 
 /****************************************************************************/
@@ -23,9 +23,6 @@
 #include <linux/mtd/partitions.h>
 #include <asm/io.h>
 
-/****************************************************************************/
-
-
 /****************************************************************************/
 
 struct map_info uclinux_ram_map = {
@@ -40,7 +37,7 @@ struct mtd_partition uclinux_romfs[] = {
        { .name = "ROMfs" }
 };
 
-#define        NUM_PARTITIONS  (sizeof(uclinux_romfs) / sizeof(uclinux_romfs[0]))
+#define        NUM_PARTITIONS  ARRAY_SIZE(uclinux_romfs)
 
 /****************************************************************************/
 
@@ -60,14 +57,15 @@ int __init uclinux_mtd_init(void)
        struct mtd_info *mtd;
        struct map_info *mapp;
        extern char _ebss;
+       unsigned long addr = (unsigned long) &_ebss;
 
        mapp = &uclinux_ram_map;
-       mapp->phys = (unsigned long) &_ebss;
-       mapp->size = PAGE_ALIGN(*((unsigned long *)((&_ebss) + 8)));
+       mapp->phys = addr;
+       mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(addr + 8))));
        mapp->bankwidth = 4;
 
        printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
-               (int) mapp->map_priv_2, (int) mapp->size);
+               (int) mapp->phys, (int) mapp->size);
 
        mapp->virt = ioremap_nocache(mapp->phys, mapp->size);
 
@@ -84,7 +82,7 @@ int __init uclinux_mtd_init(void)
                iounmap(mapp->virt);
                return(-ENXIO);
        }
-               
+
        mtd->owner = THIS_MODULE;
        mtd->point = uclinux_point;
        mtd->priv = mapp;
@@ -95,7 +93,6 @@ int __init uclinux_mtd_init(void)
        printk("uclinux[mtd]: set %s to be root filesystem\n",
                uclinux_romfs[0].name);
        ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, 0);
-       put_mtd_device(mtd);
 
        return(0);
 }
@@ -109,7 +106,7 @@ void __exit uclinux_mtd_cleanup(void)
                map_destroy(uclinux_ram_mtdinfo);
                uclinux_ram_mtdinfo = NULL;
        }
-       if (uclinux_ram_map.map_priv_1) {
+       if (uclinux_ram_map.virt) {
                iounmap((void *) uclinux_ram_map.virt);
                uclinux_ram_map.virt = 0;
        }