[MTD] m25p80 handles more chips, uses JEDEC ids and small eraseblocks
[linux-2.6.git] / drivers / mtd / devices / slram.c
index fdb7a78..d293add 100644 (file)
@@ -35,7 +35,6 @@
 #include <asm/uaccess.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/ptrace.h>
 #include <linux/slab.h>
 #include <linux/string.h>
@@ -168,19 +167,16 @@ static int register_device(char *name, unsigned long start, unsigned long length
                E("slram: Cannot allocate new MTD device.\n");
                return(-ENOMEM);
        }
-       (*curmtd)->mtdinfo = kmalloc(sizeof(struct mtd_info), GFP_KERNEL);
+       (*curmtd)->mtdinfo = kzalloc(sizeof(struct mtd_info), GFP_KERNEL);
        (*curmtd)->next = NULL;
 
        if ((*curmtd)->mtdinfo) {
-               memset((char *)(*curmtd)->mtdinfo, 0, sizeof(struct mtd_info));
                (*curmtd)->mtdinfo->priv =
-                       kmalloc(sizeof(slram_priv_t), GFP_KERNEL);
+                       kzalloc(sizeof(slram_priv_t), GFP_KERNEL);
 
                if (!(*curmtd)->mtdinfo->priv) {
                        kfree((*curmtd)->mtdinfo);
                        (*curmtd)->mtdinfo = NULL;
-               } else {
-                       memset((*curmtd)->mtdinfo->priv,0,sizeof(slram_priv_t));
                }
        }
 
@@ -207,8 +203,9 @@ static int register_device(char *name, unsigned long start, unsigned long length
        (*curmtd)->mtdinfo->read = slram_read;
        (*curmtd)->mtdinfo->write = slram_write;
        (*curmtd)->mtdinfo->owner = THIS_MODULE;
-       (*curmtd)->mtdinfo->type = MTD_GENERIC_TYPE;
+       (*curmtd)->mtdinfo->type = MTD_RAM;
        (*curmtd)->mtdinfo->erasesize = SLRAM_BLK_SZ;
+       (*curmtd)->mtdinfo->writesize = 1;
 
        if (add_mtd_device((*curmtd)->mtdinfo)) {
                E("slram: Failed to register new device\n");