From: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/6] tools/env: pass bad block offset by value
Date: Mon, 29 Aug 2016 23:16:58 +0200 [thread overview]
Message-ID: <1472505422-26122-3-git-send-email-andreas.fenkart@digitalstrom.com> (raw)
In-Reply-To: <1472505422-26122-1-git-send-email-andreas.fenkart@digitalstrom.com>
the offset is not modified by linux ioctl call
see mtd_ioctl{drivers/mtd/mtdchar.c}
Makes the interface less ambiguous, since the caller can
now exclude a modification of blockstart
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
---
tools/env/fw_env.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 90eb5fa..86849b7 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -661,10 +661,10 @@ off_t environment_end(int dev)
* > 0 - block is bad
* < 0 - failed to test
*/
-static int flash_bad_block (int fd, uint8_t mtd_type, loff_t *blockstart)
+static int flash_bad_block(int fd, uint8_t mtd_type, loff_t blockstart)
{
if (mtd_type == MTD_NANDFLASH) {
- int badblock = ioctl (fd, MEMGETBADBLOCK, blockstart);
+ int badblock = ioctl(fd, MEMGETBADBLOCK, &blockstart);
if (badblock < 0) {
perror ("Cannot read bad block mark");
@@ -674,7 +674,7 @@ static int flash_bad_block (int fd, uint8_t mtd_type, loff_t *blockstart)
if (badblock) {
#ifdef DEBUG
fprintf (stderr, "Bad block@0x%llx, skipping\n",
- (unsigned long long) *blockstart);
+ (unsigned long long)blockstart);
#endif
return badblock;
}
@@ -722,7 +722,7 @@ static int flash_read_buf (int dev, int fd, void *buf, size_t count,
/* This only runs once on NOR flash */
while (processed < count) {
- rc = flash_bad_block (fd, mtd_type, &blockstart);
+ rc = flash_bad_block(fd, mtd_type, blockstart);
if (rc < 0) /* block test failed */
return -1;
@@ -876,7 +876,7 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count,
/* This only runs once on NOR flash and SPI-dataflash */
while (processed < write_total) {
- rc = flash_bad_block (fd, mtd_type, &blockstart);
+ rc = flash_bad_block(fd, mtd_type, blockstart);
if (rc < 0) /* block test failed */
return rc;
--
2.8.1
next prev parent reply other threads:[~2016-08-29 21:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-29 21:16 [U-Boot] [PATCH 0/6] tools/env: refactor flash read/write function Andreas Fenkart
2016-08-29 21:16 ` [U-Boot] [PATCH 1/6] tools/env: factor out environment_end function Andreas Fenkart
2016-10-08 17:04 ` [U-Boot] [U-Boot, " Tom Rini
2016-08-29 21:16 ` Andreas Fenkart [this message]
2016-10-08 17:04 ` [U-Boot] [U-Boot, 2/6] tools/env: pass bad block offset by value Tom Rini
2016-08-29 21:16 ` [U-Boot] [PATCH 3/6] tools/env: lookup dev_type directly from flash_read_buf/flash_write_buf Andreas Fenkart
2016-10-08 17:04 ` [U-Boot] [U-Boot, " Tom Rini
2016-08-29 21:17 ` [U-Boot] Suspected Spam: Do not open attachements![PATCH 4/6] tools/env: flash_write_buf: enforce offset to be start of environment Andreas Fenkart
2016-10-08 17:04 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1472505422-26122-3-git-send-email-andreas.fenkart@digitalstrom.com \
--to=andreas.fenkart@digitalstrom.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox