From: "Bjorn Eriksson" <mdeans@algonet.se>
To: <mtd@infradead.org>
Subject: Three change suggestions to nand.c and friends.
Date: Fri, 13 Oct 2000 17:26:16 +0200 [thread overview]
Message-ID: <000b01c03529$edc4c1c0$0800a8c0@win95.inteloop.se> (raw)
1) Right now the code needs the moddi3() helper to perform it's checks. I
suggest adding the requirement that {.oobblock} must be a power of two.
Also, the '(to + len)' part can be rewritten as 'len' since (a+b)%c ->
(a%c+b%c)%c.
+++ mtd/nand.c Fri Oct 13 16:50:37 2000
@@ -30,13 +31,69 @@
#define set_current_state(x) current->state = (x);
#endif
+#ifdef CONFIG_MTD_OOBBLOCK_POWOf2
+#define OOBblockMOD(numer, denom) ((numer) & (denom-1))
+#else
+#define OOBblockMOD(numer, denom) ((numer) % (denom))
+#endif
@@ -350,7 +411,7 @@
#endif
/* Do not allow unaligned writes */
- if ((to % mtd->oobblock) || ((to + len) % mtd->oobblock)) {
+ if (OOBblockMOD(to, mtd->oobblock) || OOBblockMOD(len,
mtd->oobblock)) {
DEBUG (MTD_DEBUG_LEVEL1,
"nand_write_ecc: Unaligned address\n");
return -EINVAL;
=============================================
2) I've also rewritten nand.c changing all 'NAND_CTRL |= this->CLE;' ->
NAND_SET_CMD et.al. Different hardware different support code.
=====================
3) I moved nand_flash_ids[] to a new file, nand_ids.h since nand.h is
included in several different places and not all .c-files that #include it
needs nand_flash_ids[] (thus creating dups).
Opinions, ideas? Shall I commit?
//Björnen.
To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org
next reply other threads:[~2000-10-13 15:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-10-13 15:26 Bjorn Eriksson [this message]
2000-10-13 15:35 ` Three change suggestions to nand.c and friends David Woodhouse
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='000b01c03529$edc4c1c0$0800a8c0@win95.inteloop.se' \
--to=mdeans@algonet.se \
--cc=mtd@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.