Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1a12f46af1af1a4b7b9c7ae7ab2c8ded3481a4ba
Commit:     1a12f46af1af1a4b7b9c7ae7ab2c8ded3481a4ba
Parent:     4839f0481d8b985aabd6653ba42cf09e2abcc2bd
Author:     Thomas Knobloch <[EMAIL PROTECTED]>
AuthorDate: Thu May 3 07:39:37 2007 +0100
Committer:  David Woodhouse <[EMAIL PROTECTED]>
CommitDate: Thu May 3 07:39:37 2007 +0100

    [MTD] [NAND] Tidy up handling of page number in nand_block_bad()
    
    Further to the previous patch fixing the calculation of page number,
    both branches are using the same result. Clean up the function
    accordingly, calculating it (and also masking with pagemask) only in one
    place.
    
    Signed-off-by: Thomas Knobloch <[EMAIL PROTECTED]>
    Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
    Signed-off-by: David Woodhouse <[EMAIL PROTECTED]>
---
 drivers/mtd/nand/nand_base.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 04de315..7e68203 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -303,28 +303,27 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t 
ofs, int getchip)
        struct nand_chip *chip = mtd->priv;
        u16 bad;
 
+       page = (int)(ofs >> chip->page_shift) & chip->pagemask;
+
        if (getchip) {
-               page = (int)(ofs >> chip->page_shift);
                chipnr = (int)(ofs >> chip->chip_shift);
 
                nand_get_device(chip, mtd, FL_READING);
 
                /* Select the NAND device */
                chip->select_chip(mtd, chipnr);
-       } else
-               page = (int)(ofs >> chip->page_shift);
+       }
 
        if (chip->options & NAND_BUSWIDTH_16) {
                chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos & 0xFE,
-                             page & chip->pagemask);
+                             page);
                bad = cpu_to_le16(chip->read_word(mtd));
                if (chip->badblockpos & 0x1)
                        bad >>= 8;
                if ((bad & 0xFF) != 0xff)
                        res = 1;
        } else {
-               chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos,
-                             page & chip->pagemask);
+               chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos, page);
                if (chip->read_byte(mtd) != 0xff)
                        res = 1;
        }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to