]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/mtd/devices/slram.c
Merge branches 'at91', 'dyntick', 'ep93xx', 'iop', 'ixp', 'misc', 'orion', 'omap...
[linux-2.6-omap-h63xx.git] / drivers / mtd / devices / slram.c
index 542a0c009006d4b682d30c03fa437a4f0b62a2aa..cb86db746f28c91f552462696b10d5c99f23c07d 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>
@@ -77,8 +76,9 @@ static char *map;
 static slram_mtd_list_t *slram_mtdlist = NULL;
 
 static int slram_erase(struct mtd_info *, struct erase_info *);
-static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, u_char **);
-static void slram_unpoint(struct mtd_info *, u_char *, loff_t, size_t);
+static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, void **,
+               resource_size_t *);
+static void slram_unpoint(struct mtd_info *, loff_t, size_t);
 static int slram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *);
 static int slram_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
 
@@ -105,19 +105,23 @@ static int slram_erase(struct mtd_info *mtd, struct erase_info *instr)
 }
 
 static int slram_point(struct mtd_info *mtd, loff_t from, size_t len,
-               size_t *retlen, u_char **mtdbuf)
+               size_t *retlen, void **virt, resource_size_t *phys)
 {
        slram_priv_t *priv = mtd->priv;
 
+       /* can we return a physical address with this driver? */
+       if (phys)
+               return -EINVAL;
+
        if (from + len > mtd->size)
                return -EINVAL;
 
-       *mtdbuf = priv->start + from;
+       *virt = priv->start + from;
        *retlen = len;
        return(0);
 }
 
-static void slram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, size_t len)
+static void slram_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
 {
 }
 
@@ -168,19 +172,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));
                }
        }