From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-mtd@lists.infradead.org
Cc: Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Akinobu Mita <akinobu.mita@gmail.com>,
Artem Bityutskiy <dedekind1@gmail.com>
Subject: [PATCH 4/6] mtd: nandsim: use NS_RAW_OFFSET()
Date: Sun, 28 Jul 2013 11:21:56 +0900 [thread overview]
Message-ID: <1374978118-11418-4-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1374978118-11418-1-git-send-email-akinobu.mita@gmail.com>
Use NS_RAW_OFFSET() to calculate the page offset in flash RAM image by
(row, column) address.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
---
drivers/mtd/nand/nandsim.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 7aa7b19..0ff53ef 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -1489,7 +1489,7 @@ static void read_page(struct nandsim *ns, int num)
ns->regs.row, ns->regs.column + ns->regs.off);
if (do_read_error(ns, num))
return;
- pos = (loff_t)ns->regs.row * ns->geom.pgszoob + ns->regs.column + ns->regs.off;
+ pos = (loff_t)NS_RAW_OFFSET(ns) + ns->regs.off;
tx = read_file(ns, ns->cfile, ns->buf.byte, num, pos);
if (tx != num) {
NS_ERR("read_page: read error for page %d ret %ld\n", ns->regs.row, (long)tx);
@@ -1558,7 +1558,7 @@ static int prog_page(struct nandsim *ns, int num)
NS_DBG("prog_page: writing page %d\n", ns->regs.row);
pg_off = ns->file_buf + ns->regs.column + ns->regs.off;
- off = (loff_t)ns->regs.row * ns->geom.pgszoob + ns->regs.column + ns->regs.off;
+ off = (loff_t)NS_RAW_OFFSET(ns) + ns->regs.off;
if (!test_bit(ns->regs.row, ns->pages_written)) {
all = 1;
memset(ns->file_buf, 0xff, ns->geom.pgszoob);
--
1.8.3.1
next prev parent reply other threads:[~2013-07-28 2:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-28 2:21 [PATCH 1/6] mtd: nandsim: convert pages_written[] to bitmap Akinobu Mita
2013-07-28 2:21 ` [PATCH 2/6] mtd: nandsim: use kasprintf() Akinobu Mita
2013-07-28 2:21 ` [PATCH 3/6] mtd: nandsim: simplify NS_RAW_OFFSET() Akinobu Mita
2013-07-28 2:21 ` Akinobu Mita [this message]
2013-07-28 2:21 ` [PATCH 5/6] mtd: nandsim: remove unused code Akinobu Mita
2013-07-28 2:21 ` [PATCH 6/6] mtd: nandsim: remove unused ns->geom.oobshift Akinobu Mita
2013-08-02 14:38 ` [PATCH 1/6] mtd: nandsim: convert pages_written[] to bitmap Artem Bityutskiy
2013-08-02 15:46 ` Artem Bityutskiy
2013-08-02 15:59 ` Akinobu Mita
2013-08-05 13:02 ` Artem Bityutskiy
2013-08-05 23:02 ` Akinobu Mita
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=1374978118-11418-4-git-send-email-akinobu.mita@gmail.com \
--to=akinobu.mita@gmail.com \
--cc=computersforpeace@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--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