phram/slram
Jörn Engel
joern at wohnheim.fh-wedel.de
Mon Oct 18 09:32:06 EDT 2004
On Mon, 18 October 2004 09:06:07 +0200, Manfred Gruber wrote:
>
> 2.6.9 -rc1. When none have the same problem with phram. Than it is a problem
> on my arm board :-(
Most people have problems with neither phram or slram working. Below
is a patch for 2.6.8 (should still apply with -rc1) that fixes the
problem.
Will send it to akpm when 2.6.9 is out.
Jörn
--
It's not whether you win or lose, it's how you place the blame.
-- unknown
Finally make phram work again:
o Add simple usage example.
o Fix up unit handling (k, M. G).
o Use correct size limit for setup string.
o Remove pointless printk message.
o Fix mtdblock to not allocate a read-modify-write buffer for CAP_RAM
devices (and fail to do so, returning an error).
Signed-off-by: Jörn Engel <joern at wohnheim.fh-wedel.de>
---
devices/phram.c | 10 ++++++----
mtdblock.c | 2 +-
2 files changed, 7 insertions(+), 5 deletions(-)
--- linux-2.6.8cow/drivers/mtd/devices/phram.c~phram_fix 2004-09-05 11:57:14.000000000 +0200
+++ linux-2.6.8cow/drivers/mtd/devices/phram.c 2004-09-05 11:58:00.000000000 +0200
@@ -18,6 +18,9 @@
* by "k", "M" or "G", the numbers will be interpreted as kilo, mega or
* gigabytes.
*
+ * Example:
+ * phram=swap,896M,110M phram=test,1006M,1M
+ *
*/
#include <asm/io.h>
@@ -184,7 +187,7 @@
result *= 1024;
case 'k':
result *= 1024;
- endp++;
+ (*endp)++;
}
return result;
}
@@ -235,7 +238,7 @@
uint32_t len;
int i, ret;
- if (strnlen(val, sizeof(str)) >= sizeof(str))
+ if (strnlen(val, sizeof(buf)) >= sizeof(buf))
parse_err("parameter too long\n");
strcpy(str, val);
@@ -283,7 +286,7 @@
if (!val || !val[0])
parse_err("no arguments to \"slram=\"\n");
- if (strnlen(val, sizeof(str)) >= sizeof(str))
+ if (strnlen(val, sizeof(buf)) >= sizeof(buf))
parse_err("parameter too long\n");
strcpy(str, val);
@@ -342,7 +345,6 @@
int __init init_phram(void)
{
- printk(KERN_ERR "phram loaded\n");
return 0;
}
--- linux-2.6.8cow/drivers/mtd/mtdblock.c~phram_fix 2004-09-05 11:57:14.000000000 +0200
+++ linux-2.6.8cow/drivers/mtd/mtdblock.c 2004-09-05 11:58:00.000000000 +0200
@@ -248,7 +248,7 @@
unsigned long block, char *buf)
{
struct mtdblk_dev *mtdblk = mtdblks[dev->devnum];
- if (unlikely(!mtdblk->cache_data)) {
+ if (unlikely(!mtdblk->cache_data && mtdblk->cache_size)) {
mtdblk->cache_data = vmalloc(mtdblk->mtd->erasesize);
if (!mtdblk->cache_data)
return -EINTR;
More information about the linux-mtd
mailing list