
Dear Lubomir Rintel,
In message 1359589584-19846-1-git-send-email-lkundrak@v3.sk you wrote:
In certain cases, memory device is present as flat file or block device (via mmc or mtdblock layer). Do not attempt MTD operations against it.
What exactly would be such cases?
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 37b60b8..0d8052d 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -838,7 +838,7 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count, ioctl (fd, MEMUNLOCK, &erase);
/* Dataflash does not need an explicit erase cycle */
if (mtd_type != MTD_DATAFLASH)
if (mtd_type && mtd_type != MTD_DATAFLASH)
This change appears to be redundant. If mtd_type is null, then this is already caught iun te test mtd_type != MTD_DATAFLASH, isn't it?
- rc = ioctl (fd, MEMGETINFO, &mtdinfo);
- rc = fstat (fd, &st); if (rc < 0) {
perror ("Cannot get MTD information");
perror ("Cannot access MTD device");
I don't understand this. You talk about a MTD device here, but expect that MEMGETINFO will not work on it? Please explain in which exact circumstances such a situation wouldhappen.
if (mtdinfo.type != MTD_NORFLASH && mtdinfo.type != MTD_NANDFLASH &&
mtdinfo.type != MTD_DATAFLASH) {
mtdinfo.type != MTD_DATAFLASH &&
mtdinfo.type) {
Again, this last line appears to be redundant.
}
DEVTYPE(dev_current) = mtdinfo.type;
- rc = flash_read_buf(dev_current, fd, environment.image, CUR_ENVSIZE,
Please don't make such unrelated white space changes in this commit.
diff --git a/tools/env/fw_env.config b/tools/env/fw_env.config index 8e21d5a..c086512 100644 --- a/tools/env/fw_env.config +++ b/tools/env/fw_env.config @@ -17,3 +17,6 @@
# NAND example #/dev/mtd0 0x4000 0x4000 0x20000 2
+# Block device example +#/dev/mmcblk0 0xc0000 0x20000
I don't see why one would use that. Please elucidate.
Please also make sure to run your patch through checkpatch - it catches a number of "space prohibited between function name and open parenthesis" warnings and tells you that your Signed-off-by: line is missing.
Best regards,
Wolfgang Denk