mtd: atmel_nand: add a definition for the oob reserved bytes
authorJosh Wu <josh.wu@atmel.com>
Thu, 2 Apr 2015 06:12:33 +0000 (14:12 +0800)
committerBrian Norris <computersforpeace@gmail.com>
Mon, 6 Apr 2015 00:47:56 +0000 (17:47 -0700)
It's better to use a macro instead of just a number.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/nand/atmel_nand.c
drivers/mtd/nand/atmel_nand_ecc.h

index feaac9099bb971e48dd120daabf4f8c641f7c9f5..0361c199267374668ef6c6fd64caa48f0c7114cc 100644 (file)
@@ -485,7 +485,7 @@ static void pmecc_config_ecc_layout(struct nand_ecclayout *layout,
        for (i = 0; i < ecc_len; i++)
                layout->eccpos[i] = oobsize - ecc_len + i;
 
-       layout->oobfree[0].offset = 2;
+       layout->oobfree[0].offset = PMECC_OOB_RESERVED_BYTES;
        layout->oobfree[0].length =
                oobsize - ecc_len - layout->oobfree[0].offset;
 }
@@ -1254,7 +1254,8 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev,
                nand_chip->ecc.steps = mtd->writesize / sector_size;
                nand_chip->ecc.total = nand_chip->ecc.bytes *
                        nand_chip->ecc.steps;
-               if (nand_chip->ecc.total > mtd->oobsize - 2) {
+               if (nand_chip->ecc.total >
+                               mtd->oobsize - PMECC_OOB_RESERVED_BYTES) {
                        dev_err(host->dev, "No room for ECC bytes\n");
                        err_no = -EINVAL;
                        goto err;
index d4035e335ad8fbe75d8cb435b44d8b94e5260cc7..668e7358f19b76e94dc577c8e89cc7297f419b9a 100644 (file)
 /* Time out value for reading PMECC status register */
 #define PMECC_MAX_TIMEOUT_MS                   100
 
+/* Reserved bytes in oob area */
+#define PMECC_OOB_RESERVED_BYTES               2
+
 #endif