From: Adrian Hunter <ext-adrian.hunter@nokia.com>
To: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] [MTD] Make ecclayout static const
Date: Mon, 19 Feb 2007 15:08:17 +0200 [thread overview]
Message-ID: <45D9A141.3040300@nokia.com> (raw)
In-Reply-To: <007101c74e4c$bdb8bbb0$c7a3580a@swcenter.sec.samsung.co.kr>
ext Kyungmin Park wrote:
> @@ -827,13 +829,15 @@ static int onenand_transfer_auto_oob(struct mtd_info
> *mtd, uint8_t *buf, int col
> int thislen)
> {
> struct onenand_chip *this = mtd->priv;
> struct nand_oobfree *free;
> int readcol = column;
> int readend = column + thislen;
> int lastgap = 0;
> uint8_t *oob_buf = this->page_buf + mtd->writesize;
> + int i;
>
> - for (free = this->ecclayout->oobfree; free->length; ++free) {
> + free = this->ecclayout->oobfree;
> + for (i = 0; i < ARRAY_SIZE(this->ecclayout->oobfree); i++, free++) {
> if (readcol >= lastgap)
> readcol += free->offset - lastgap;
> if (readend >= lastgap)
> @@ -841,7 +845,8 @@ static int onenand_transfer_auto_oob(struct mtd_info
> *mtd, uint8_t *buf, int col
> lastgap = free->offset + free->length;
> }
> this->read_bufferram(mtd, ONENAND_SPARERAM, oob_buf, 0, mtd-
>> oobsize);
> - for (free = this->ecclayout->oobfree; free->length; ++free) {
> + free = this->ecclayout->oobfree;
> + for (i = 0; i < ARRAY_SIZE(this->ecclayout->oobfree); i++, free++) {
> int free_end = free->offset + free->length;
> if (free->offset < readend && free_end > readcol) {
> int st = max_t(int,free->offset,readcol);
> @@ -1270,19 +1277,22 @@ static int onenand_fill_auto_oob(struct mtd_info
> *mtd, u_char *oob_buf,
> const u_char *buf, int column, int
> thislen)
> {
> struct onenand_chip *this = mtd->priv;
> struct nand_oobfree *free;
> int writecol = column;
> int writeend = column + thislen;
> int lastgap = 0;
> + int i;
>
> - for (free = this->ecclayout->oobfree; free->length; ++free) {
> + free = this->ecclayout->oobfree;
> + for (i = 0; i < ARRAY_SIZE(this->ecclayout->oobfree); i++, free++) {
> if (writecol >= lastgap)
> writecol += free->offset - lastgap;
> if (writeend >= lastgap)
> writeend += free->offset - lastgap;
> lastgap = free->offset + free->length;
> }
> - for (free = this->ecclayout->oobfree; free->length; ++free) {
> + free = this->ecclayout->oobfree;
> + for (i = 0; i < ARRAY_SIZE(this->ecclayout->oobfree); i++, free++) {
> int free_end = free->offset + free->length;
> if (free->offset < writeend && free_end > writecol) {
> int st = max_t(int,free->offset,writecol);
Isn't this still needed?
Note you could use MTD_MAX_OOBFREE_ENTRIES instead of ARRAY_SIZE
prev parent reply other threads:[~2007-02-19 13:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-12 2:23 [PATCH] [MTD] Make ecclayout static const Kyungmin Park
2007-02-12 5:36 ` Kyungmin Park
2007-02-19 13:08 ` Adrian Hunter [this message]
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=45D9A141.3040300@nokia.com \
--to=ext-adrian.hunter@nokia.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox