aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd/nand.h
diff options
context:
space:
mode:
authorJosh Wu <josh.wu@atmel.com>2012-06-25 06:07:45 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-07-06 13:17:07 -0400
commitfdbad98dff8007f2b8bee6698b5d25ebba0471c9 (patch)
tree823d68f687ad90108ec6a4c53d17cb3bde1b3950 /include/linux/mtd/nand.h
parent3dfe41a4c705223c66373968327407e11c2fb1a1 (diff)
mtd: nand: teach write_page and write_page_raw return an error code
There is an implemention of hardware ECC write page function which may return an error indication. For instance, using Atmel HW PMECC to write one page into a nand flash, the hardware engine will compute the BCH ecc code for this page. so we need read a the status register to theck whether the ecc code is generated. But we cannot assume the status register always can be ready, for example, incorrect hardware configuration or hardware issue, in such case we need write_page() to return a error code. Since the definition of 'write_page' function in struct nand_ecc_ctrl is 'void'. So this patch will: 1. add return 'int' value for 'write_page' function. 2. to be consitent, add return 'int' value for 'write_page_raw' fuctions too. 3. add code to test the return value, and if negative, indicate an error happend when write page with ECC. 4. fix the compile warning in all impacted nand flash driver. Note: I couldn't compile-test all of these easily, as some had ARCH dependencies. Signed-off-by: Josh Wu <josh.wu@atmel.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include/linux/mtd/nand.h')
-rw-r--r--include/linux/mtd/nand.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index a81ac89a6950..6dce5a7154bb 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -355,13 +355,13 @@ struct nand_ecc_ctrl {
355 uint8_t *calc_ecc); 355 uint8_t *calc_ecc);
356 int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, 356 int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
357 uint8_t *buf, int oob_required, int page); 357 uint8_t *buf, int oob_required, int page);
358 void (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, 358 int (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
359 const uint8_t *buf, int oob_required); 359 const uint8_t *buf, int oob_required);
360 int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, 360 int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip,
361 uint8_t *buf, int oob_required, int page); 361 uint8_t *buf, int oob_required, int page);
362 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip, 362 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
363 uint32_t offs, uint32_t len, uint8_t *buf); 363 uint32_t offs, uint32_t len, uint8_t *buf);
364 void (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, 364 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
365 const uint8_t *buf, int oob_required); 365 const uint8_t *buf, int oob_required);
366 int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, 366 int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip,
367 int page); 367 int page);