From: Florian Fainelli <florian@openwrt.org>
To: Sourav Poddar <sourav.poddar@ti.com>
Cc: artem.bityutskiy@linux.intel.com, rnayak@ti.com,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
balbi@ti.com, linux-mtd@lists.infradead.org, tqnguyen@micron.com,
linux-omap@vger.kernel.org, David Woodhouse <dwmw2@infradead.org>,
manonuevo@micron.com
Subject: Re: [PATCHv2] drivers: mtd: spinand: Add generic spinand frameowrk.
Date: Thu, 04 Jul 2013 08:21:59 +0100 [thread overview]
Message-ID: <1390226.n8Vjs1lthe@lenovo> (raw)
In-Reply-To: <51D4FD7F.3020104@ti.com>
Hello,
Le jeudi 4 juillet 2013 10:13:43 Sourav Poddar a écrit :
> >
> > Can this somehow be made a runtime thing?
>
> Ahh..I think we might opt for a device tree entry and based on that
> check for ECC.
Ok, sounds good too.
>
> > [snip]
> >
> >> + if (count< oob_num&& ops->oobbuf&& chip->oobbuf) {
> >> + int size;
> >> + int offset, len, temp;
> >> +
> >> + /* repack spare to oob */
> >> + memset(chip->oobbuf, 0,
> >> info->ecclayout->oobavail);
> >> +
> >> + temp = 0;
> >> + offset = info->ecclayout->oobfree[0].offset;
> >> + len = info->ecclayout->oobfree[0].length;
> >> + memcpy(chip->oobbuf + temp,
> >> + chip->buf + info->page_main_size +
> >> offset, len);>
> > Sounds like a for look might be useful here
>
> I dont think so, there is a while loop above under which it happens.
> We are increasing count at the bottom of the while loop. So, I think
> this should work fine.
What I meant here, is that you could use a for loop to repeat 4 times the same
following pattern, such that it becomes:
for (j = 0; j < 4; j++0 {
temp += len;
offset = info->ecclayout->oobfree[j].offset;
len = info->ecclayout->oobfree[j].length;
memcpy(chip->oobbuf + temp,
chip->buf + info->page_main_size + offset, len);
}
Or even make it a helper function which is inlined if that is deemed more
elegant.
--
Florian
WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <florian@openwrt.org>
To: Sourav Poddar <sourav.poddar@ti.com>
Cc: artem.bityutskiy@linux.intel.com, linux-mtd@lists.infradead.org,
David Woodhouse <dwmw2@infradead.org>,
manonuevo@micron.com, tqnguyen@micron.com, balbi@ti.com,
rnayak@ti.com, linux-omap@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCHv2] drivers: mtd: spinand: Add generic spinand frameowrk.
Date: Thu, 04 Jul 2013 08:21:59 +0100 [thread overview]
Message-ID: <1390226.n8Vjs1lthe@lenovo> (raw)
In-Reply-To: <51D4FD7F.3020104@ti.com>
Hello,
Le jeudi 4 juillet 2013 10:13:43 Sourav Poddar a écrit :
> >
> > Can this somehow be made a runtime thing?
>
> Ahh..I think we might opt for a device tree entry and based on that
> check for ECC.
Ok, sounds good too.
>
> > [snip]
> >
> >> + if (count< oob_num&& ops->oobbuf&& chip->oobbuf) {
> >> + int size;
> >> + int offset, len, temp;
> >> +
> >> + /* repack spare to oob */
> >> + memset(chip->oobbuf, 0,
> >> info->ecclayout->oobavail);
> >> +
> >> + temp = 0;
> >> + offset = info->ecclayout->oobfree[0].offset;
> >> + len = info->ecclayout->oobfree[0].length;
> >> + memcpy(chip->oobbuf + temp,
> >> + chip->buf + info->page_main_size +
> >> offset, len);>
> > Sounds like a for look might be useful here
>
> I dont think so, there is a while loop above under which it happens.
> We are increasing count at the bottom of the while loop. So, I think
> this should work fine.
What I meant here, is that you could use a for loop to repeat 4 times the same
following pattern, such that it becomes:
for (j = 0; j < 4; j++0 {
temp += len;
offset = info->ecclayout->oobfree[j].offset;
len = info->ecclayout->oobfree[j].length;
memcpy(chip->oobbuf + temp,
chip->buf + info->page_main_size + offset, len);
}
Or even make it a helper function which is inlined if that is deemed more
elegant.
--
Florian
next prev parent reply other threads:[~2013-07-04 7:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-03 11:31 [PATCHv2] drivers: mtd: spinand: Add generic spinand frameowrk Sourav Poddar
2013-07-03 11:31 ` Sourav Poddar
2013-07-03 11:31 ` Sourav Poddar
2013-07-03 17:17 ` Florian Fainelli
2013-07-03 17:17 ` Florian Fainelli
2013-07-04 4:43 ` Sourav Poddar
2013-07-04 4:43 ` Sourav Poddar
2013-07-04 4:43 ` Sourav Poddar
2013-07-04 7:21 ` Florian Fainelli [this message]
2013-07-04 7:21 ` Florian Fainelli
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=1390226.n8Vjs1lthe@lenovo \
--to=florian@openwrt.org \
--cc=artem.bityutskiy@linux.intel.com \
--cc=balbi@ti.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=manonuevo@micron.com \
--cc=rnayak@ti.com \
--cc=sourav.poddar@ti.com \
--cc=tqnguyen@micron.com \
/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.