From: Kyungmin Park <kyungmin.park@samsung.com>
To: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: [PATCH] OneNAND: Use address instead block, page in bufferram
Date: Tue, 09 Jan 2007 02:10:12 +0000 (GMT) [thread overview]
Message-ID: <32289320.317881168308612503.JavaMail.weblogic@ep_ml29> (raw)
[PATCH] OneNAND: Use address instead of block, page in bufferram
we use the address itself instead of block, page in bufferam.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
--
@@ -587,19 +601,18 @@ static int onenand_write_bufferram(struct mtd_info *mtd, int area,
static int onenand_check_bufferram(struct mtd_info *mtd, loff_t addr)
{
struct onenand_chip *this = mtd->priv;
- int block, page;
int i;
+#ifdef DEBUG_BUFFERRAM
+ int block, page;
block = (int) (addr >> this->erase_shift);
- page = (int) (addr >> this->page_shift);
- page &= this->page_mask;
+ page = (int) (addr >> this->page_shift) & this->page_mask;
+#endif
i = ONENAND_CURRENT_BUFFERRAM(this);
/* Is there valid data? */
- if (this->bufferram[i].block == block &&
- this->bufferram[i].page == page &&
- this->bufferram[i].valid)
+ if (this->bufferram[i].addr == addr && this->bufferram[i].valid)
return 1;
return 0;
@@ -617,24 +630,25 @@ static int onenand_update_bufferram(struct mtd_info *mtd, loff_t addr,
int valid)
{
struct onenand_chip *this = mtd->priv;
- int block, page;
int i;
+#ifdef DEBUG_BUFFERRAM
+ int block, page;
block = (int) (addr >> this->erase_shift);
- page = (int) (addr >> this->page_shift);
- page &= this->page_mask;
+ page = (int) (addr >> this->page_shift) & this->page_mask;
+#endif
/* Invalidate BufferRAM */
for (i = 0; i < MAX_BUFFERRAM; i++) {
- if (this->bufferram[i].block == block &&
- this->bufferram[i].page == page)
+ if (this->bufferram[i].addr == addr) {
this->bufferram[i].valid = 0;
+ break;
+ }
}
/* Update BufferRAM */
i = ONENAND_CURRENT_BUFFERRAM(this);
- this->bufferram[i].block = block;
- this->bufferram[i].page = page;
+ this->bufferram[i].addr = addr;
this->bufferram[i].valid = valid;
return 0;
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index f775a7a..46e052f 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -47,9 +47,8 @@ typedef enum {
* @valid: valid flag
*/
struct onenand_bufferram {
- int block;
- int page;
- int valid;
+ loff_t addr;
+ int valid;
};
/**
next reply other threads:[~2007-01-09 2:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-09 2:10 Kyungmin Park [this message]
2007-01-10 13:11 ` [PATCH] OneNAND: Use address instead block, page in bufferram Adrian Hunter
-- strict thread matches above, loose matches on Subject: below --
2007-01-11 2:20 Kyungmin Park
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=32289320.317881168308612503.JavaMail.weblogic@ep_ml29 \
--to=kyungmin.park@samsung.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