mtd: use %*ph[CN] to dump small buffers
There is new format specified that helps to dump small buffers. It makes the code simpler and nicer. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Jiandong Zheng <jdzheng@broadcom.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
parent
513d57e1db
commit
13e859745c
|
@ -659,23 +659,15 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
|
||||||
#ifdef ECC_DEBUG
|
#ifdef ECC_DEBUG
|
||||||
printk("%s(%d): Millennium Plus ECC error (from=0x%x:\n",
|
printk("%s(%d): Millennium Plus ECC error (from=0x%x:\n",
|
||||||
__FILE__, __LINE__, (int)from);
|
__FILE__, __LINE__, (int)from);
|
||||||
printk(" syndrome= %02x:%02x:%02x:%02x:%02x:"
|
printk(" syndrome= %*phC\n", 6, syndrome);
|
||||||
"%02x\n",
|
printk(" eccbuf= %*phC\n", 6, eccbuf);
|
||||||
syndrome[0], syndrome[1], syndrome[2],
|
|
||||||
syndrome[3], syndrome[4], syndrome[5]);
|
|
||||||
printk(" eccbuf= %02x:%02x:%02x:%02x:%02x:"
|
|
||||||
"%02x\n",
|
|
||||||
eccbuf[0], eccbuf[1], eccbuf[2],
|
|
||||||
eccbuf[3], eccbuf[4], eccbuf[5]);
|
|
||||||
#endif
|
#endif
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PSYCHO_DEBUG
|
#ifdef PSYCHO_DEBUG
|
||||||
printk("ECC DATA at %lx: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n",
|
printk("ECC DATA at %lx: %*ph\n", (long)from, 6, eccbuf);
|
||||||
(long)from, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3],
|
|
||||||
eccbuf[4], eccbuf[5]);
|
|
||||||
#endif
|
#endif
|
||||||
/* disable the ECC engine */
|
/* disable the ECC engine */
|
||||||
WriteDOC(DOC_ECC_DIS, docptr , Mplus_ECCConf);
|
WriteDOC(DOC_ECC_DIS, docptr , Mplus_ECCConf);
|
||||||
|
|
|
@ -919,19 +919,13 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t from,
|
||||||
eccconf1 = doc_register_readb(docg3, DOC_ECCCONF1);
|
eccconf1 = doc_register_readb(docg3, DOC_ECCCONF1);
|
||||||
|
|
||||||
if (nboob >= DOC_LAYOUT_OOB_SIZE) {
|
if (nboob >= DOC_LAYOUT_OOB_SIZE) {
|
||||||
doc_dbg("OOB - INFO: %02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
|
doc_dbg("OOB - INFO: %*phC\n", 7, oobbuf);
|
||||||
oobbuf[0], oobbuf[1], oobbuf[2], oobbuf[3],
|
|
||||||
oobbuf[4], oobbuf[5], oobbuf[6]);
|
|
||||||
doc_dbg("OOB - HAMMING: %02x\n", oobbuf[7]);
|
doc_dbg("OOB - HAMMING: %02x\n", oobbuf[7]);
|
||||||
doc_dbg("OOB - BCH_ECC: %02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
|
doc_dbg("OOB - BCH_ECC: %*phC\n", 7, oobbuf + 8);
|
||||||
oobbuf[8], oobbuf[9], oobbuf[10], oobbuf[11],
|
|
||||||
oobbuf[12], oobbuf[13], oobbuf[14]);
|
|
||||||
doc_dbg("OOB - UNUSED: %02x\n", oobbuf[15]);
|
doc_dbg("OOB - UNUSED: %02x\n", oobbuf[15]);
|
||||||
}
|
}
|
||||||
doc_dbg("ECC checks: ECCConf1=%x\n", eccconf1);
|
doc_dbg("ECC checks: ECCConf1=%x\n", eccconf1);
|
||||||
doc_dbg("ECC HW_ECC: %02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
|
doc_dbg("ECC HW_ECC: %*phC\n", 7, hwecc);
|
||||||
hwecc[0], hwecc[1], hwecc[2], hwecc[3], hwecc[4],
|
|
||||||
hwecc[5], hwecc[6]);
|
|
||||||
|
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
if (is_prot_seq_error(docg3))
|
if (is_prot_seq_error(docg3))
|
||||||
|
|
|
@ -154,19 +154,10 @@ static int bcm_umi_bch_read_page_hwecc(struct mtd_info *mtd,
|
||||||
#if defined(NAND_BCM_UMI_DEBUG)
|
#if defined(NAND_BCM_UMI_DEBUG)
|
||||||
printk(KERN_WARNING "%s uncorr_err sectorIdx=%d\n",
|
printk(KERN_WARNING "%s uncorr_err sectorIdx=%d\n",
|
||||||
__func__, sectorIdx);
|
__func__, sectorIdx);
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING "%s data %*ph\n",
|
||||||
"%s data %02x %02x %02x %02x "
|
__func__, 8, datap);
|
||||||
"%02x %02x %02x %02x\n",
|
printk(KERN_WARNING "%s ecc %*ph\n",
|
||||||
__func__, datap[0], datap[1], datap[2], datap[3],
|
__func__, 13, eccCalc);
|
||||||
datap[4], datap[5], datap[6], datap[7]);
|
|
||||||
printk(KERN_WARNING
|
|
||||||
"%s ecc %02x %02x %02x %02x "
|
|
||||||
"%02x %02x %02x %02x %02x %02x "
|
|
||||||
"%02x %02x %02x\n",
|
|
||||||
__func__, eccCalc[0], eccCalc[1], eccCalc[2],
|
|
||||||
eccCalc[3], eccCalc[4], eccCalc[5], eccCalc[6],
|
|
||||||
eccCalc[7], eccCalc[8], eccCalc[9], eccCalc[10],
|
|
||||||
eccCalc[11], eccCalc[12]);
|
|
||||||
BUG();
|
BUG();
|
||||||
#endif
|
#endif
|
||||||
mtd->ecc_stats.failed++;
|
mtd->ecc_stats.failed++;
|
||||||
|
|
|
@ -457,10 +457,8 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
|
||||||
diff1 = read_ecc[1] ^ calc_ecc[1];
|
diff1 = read_ecc[1] ^ calc_ecc[1];
|
||||||
diff2 = read_ecc[2] ^ calc_ecc[2];
|
diff2 = read_ecc[2] ^ calc_ecc[2];
|
||||||
|
|
||||||
pr_debug("%s: rd %02x%02x%02x calc %02x%02x%02x diff %02x%02x%02x\n",
|
pr_debug("%s: rd %*phN calc %*phN diff %02x%02x%02x\n",
|
||||||
__func__,
|
__func__, 3, read_ecc, 3, calc_ecc,
|
||||||
read_ecc[0], read_ecc[1], read_ecc[2],
|
|
||||||
calc_ecc[0], calc_ecc[1], calc_ecc[2],
|
|
||||||
diff0, diff1, diff2);
|
diff0, diff1, diff2);
|
||||||
|
|
||||||
if (diff0 == 0 && diff1 == 0 && diff2 == 0)
|
if (diff0 == 0 && diff1 == 0 && diff2 == 0)
|
||||||
|
@ -562,8 +560,7 @@ static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
|
||||||
ecc_code[1] = readb(info->regs + S3C2410_NFECC + 1);
|
ecc_code[1] = readb(info->regs + S3C2410_NFECC + 1);
|
||||||
ecc_code[2] = readb(info->regs + S3C2410_NFECC + 2);
|
ecc_code[2] = readb(info->regs + S3C2410_NFECC + 2);
|
||||||
|
|
||||||
pr_debug("%s: returning ecc %02x%02x%02x\n", __func__,
|
pr_debug("%s: returning ecc %*phN\n", __func__, 3, ecc_code);
|
||||||
ecc_code[0], ecc_code[1], ecc_code[2]);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -578,8 +575,7 @@ static int s3c2412_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
|
||||||
ecc_code[1] = ecc >> 8;
|
ecc_code[1] = ecc >> 8;
|
||||||
ecc_code[2] = ecc >> 16;
|
ecc_code[2] = ecc >> 16;
|
||||||
|
|
||||||
pr_debug("calculate_ecc: returning ecc %02x,%02x,%02x\n",
|
pr_debug("%s: returning ecc %*phN\n", __func__, 3, ecc_code);
|
||||||
ecc_code[0], ecc_code[1], ecc_code[2]);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue