mtd: nand/fsmc: Use dev_err to report error scenario

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Mar 26 20:59:18 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=712c4add03277197168210bb628b8273e36adf76
Commit:     712c4add03277197168210bb628b8273e36adf76
Parent:     82b9dbe2e0f6870bf385b759b91e403b62a60c5e
Author:     Vipin Kumar <vipin.kumar at st.com>
AuthorDate: Wed Mar 14 11:47:16 2012 +0530
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Tue Mar 27 00:59:49 2012 +0100

    mtd: nand/fsmc: Use dev_err to report error scenario
    
    fsmc controller takes time to calculate the bch8 codes and the error offsets.
    The calculate logic checks for completion upto a timeout. This patch adds a
    error print when this timer expires and the ecc or error offsets are not yet
    calculated.
    
    Signed-off-by: Vipin Kumar <vipin.kumar at st.com>
    Reviewed-by: Viresh Kumar <viresh.kumar at st.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/fsmc_nand.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
index 56b6619..c41f45f 100644
--- a/drivers/mtd/nand/fsmc_nand.c
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -296,6 +296,7 @@ struct fsmc_nand_data {
 
 	struct fsmc_eccplace	*ecc_place;
 	unsigned int		bank;
+	struct device		*dev;
 	struct clk		*clk;
 
 	struct fsmc_nand_timings *dev_timings;
@@ -457,6 +458,11 @@ static int fsmc_read_hwecc_ecc4(struct mtd_info *mtd, const uint8_t *data,
 			cond_resched();
 	} while (!time_after_eq(jiffies, deadline));
 
+	if (time_after_eq(jiffies, deadline)) {
+		dev_err(host->dev, "calculate ecc timed out\n");
+		return -ETIMEDOUT;
+	}
+
 	ecc_tmp = readl(&regs->bank_regs[bank].ecc1);
 	ecc[0] = (uint8_t) (ecc_tmp >> 0);
 	ecc[1] = (uint8_t) (ecc_tmp >> 8);
@@ -793,6 +799,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 	host->select_chip = pdata->select_bank;
 	host->partitions = pdata->partitions;
 	host->nr_partitions = pdata->nr_partitions;
+	host->dev = &pdev->dev;
 	host->dev_timings = pdata->nand_timings;
 	regs = host->regs_va;
 



More information about the linux-mtd-cvs mailing list