From: Marek Vasut <marek.vasut@gmail.com>
To: David Oberhollenzer <david.oberhollenzer@sigma-star.at>,
Kees Trommel <ctrommel@aimvalley.nl>,
linux-mtd@lists.infradead.org
Subject: Re: Add --skip-all-ffs option to mtd-utils nandwrite
Date: Wed, 7 Dec 2016 06:01:08 +0100 [thread overview]
Message-ID: <15c62cdb-38f7-76b8-b3fc-6b3c2766e9df@gmail.com> (raw)
In-Reply-To: <cb18365f-4fe0-9e07-f7cc-6c2bf72018b3@sigma-star.at>
On 12/06/2016 02:19 PM, David Oberhollenzer wrote:
> On 12/06/2016 09:29 AM, Kees Trommel wrote:
>> David,
>>
>> Attached a rebased patch file.
>>
>> Kees.
> Applied to mtd-utils.git.
It'd be great to have the patch posted to the list with git send-email ,
otherwise it's not possible to review it :-(
Also, the code doesn't look awesome, see below:
+ if (skipallffs)
+ {
+ for (ii = 0; ii < mtd.min_io_size; ii +=
sizeof(uint32_t))
+ {
+ if (*(uint32_t*)(writebuf + ii) !=
0xffffffff)
+ break;
Is this memcmp()-alike function ?
+ }
+ if (ii == mtd.min_io_size)
+ allffs = 1;
+ }
+ if (!allffs) {
This could be simply turned to:
ret = 0;
if (!memcmp(writebuf, writebuf + 1, mtd.min_io_size - 1)) {
ret = mtd_write(....);
}
And then you don't need to introduce any new vars (which have weird
names like 'ii' ) either.
+ /* Write out data */
+ ret = mtd_write(mtd_desc, &mtd, fd, mtdoffset /
mtd.eb_size,
+ mtdoffset % mtd.eb_size,
+ onlyoob ? NULL : writebuf,
+ onlyoob ? 0 : mtd.min_io_size,
+ writeoob ? oobbuf : NULL,
+ writeoob ? mtd.oob_size : 0,
+ write_mode);
+ } else {
+ ret = 0;
+ }
--
Best regards,
Marek Vasut
next prev parent reply other threads:[~2016-12-07 5:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-05 16:14 Add --skip-all-ffs option to mtd-utils nandwrite Kees Trommel
2016-12-05 19:13 ` David Oberhollenzer
2016-12-06 8:29 ` Kees Trommel
2016-12-06 13:19 ` David Oberhollenzer
2016-12-07 5:01 ` Marek Vasut [this message]
2016-12-07 8:21 ` David Oberhollenzer
2016-12-07 14:09 ` Marek Vasut
2016-12-07 16:07 ` Boris Brezillon
2016-12-07 16:31 ` Marek Vasut
2016-12-07 16:59 ` Boris Brezillon
2016-12-08 4:14 ` Marek Vasut
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=15c62cdb-38f7-76b8-b3fc-6b3c2766e9df@gmail.com \
--to=marek.vasut@gmail.com \
--cc=ctrommel@aimvalley.nl \
--cc=david.oberhollenzer@sigma-star.at \
--cc=linux-mtd@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.