/**
- * $Id: phram.c,v 1.14 2005/03/07 21:43:38 joern Exp $
+ * $Id: phram.c,v 1.16 2005/11/07 11:14:25 gleixner Exp $
*
* Copyright (c) ???? Jochen Schäuble <psionic@psionic.de>
* Copyright (c) 2003-2004 Jörn Engel <joern@wh.fh-wedel.de>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
+#include <linux/slab.h>
#include <linux/mtd/mtd.h>
#define ERROR(fmt, args...) printk(KERN_ERR "phram: " fmt , ## args)
if (instr->addr + instr->len > mtd->size)
return -EINVAL;
-
+
memset(start + instr->addr, 0xff, instr->len);
- /* This'll catch a few races. Free the thing before returning :)
+ /* This'll catch a few races. Free the thing before returning :)
* I don't feel at all ashamed. This kind of thing is possible anyway
* with flash, but unlikely.
*/
if (from + len > mtd->size)
return -EINVAL;
-
+
*mtdbuf = start + from;
*retlen = len;
return 0;
if (len > mtd->size - from)
len = mtd->size - from;
-
+
memcpy(buf, start + from, len);
*retlen = len;
if (len > mtd->size - to)
len = mtd->size - to;
-
+
memcpy(start + to, buf, len);
*retlen = len;
}
list_add_tail(&new->list, &phram_list);
- return 0;
+ return 0;
out2:
iounmap(new->mtd.priv);