diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2012-08-02 09:06:47 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-09-29 09:59:28 -0400 |
commit | 13e859745cf8cf0e6602759b1ef2abcb9ced7991 (patch) | |
tree | 3b5543f7bed728c20bb201a0c977c504bb19c892 | |
parent | 513d57e1db53870cdc11e60df77c57c8b3897fdf (diff) |
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>
-rw-r--r-- | drivers/mtd/devices/doc2001plus.c | 14 | ||||
-rw-r--r-- | drivers/mtd/devices/docg3.c | 12 | ||||
-rw-r--r-- | drivers/mtd/nand/bcm_umi_bch.c | 17 | ||||
-rw-r--r-- | drivers/mtd/nand/s3c2410.c | 12 |
4 files changed, 14 insertions, 41 deletions
diff --git a/drivers/mtd/devices/doc2001plus.c b/drivers/mtd/devices/doc2001plus.c index 04eb2e4aa50f..4f2220ad8924 100644 --- a/drivers/mtd/devices/doc2001plus.c +++ b/drivers/mtd/devices/doc2001plus.c | |||
@@ -659,23 +659,15 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
659 | #ifdef ECC_DEBUG | 659 | #ifdef ECC_DEBUG |
660 | printk("%s(%d): Millennium Plus ECC error (from=0x%x:\n", | 660 | printk("%s(%d): Millennium Plus ECC error (from=0x%x:\n", |
661 | __FILE__, __LINE__, (int)from); | 661 | __FILE__, __LINE__, (int)from); |
662 | printk(" syndrome= %02x:%02x:%02x:%02x:%02x:" | 662 | printk(" syndrome= %*phC\n", 6, syndrome); |
663 | "%02x\n", | 663 | printk(" eccbuf= %*phC\n", 6, eccbuf); |
664 | syndrome[0], syndrome[1], syndrome[2], | ||
665 | syndrome[3], syndrome[4], syndrome[5]); | ||
666 | printk(" eccbuf= %02x:%02x:%02x:%02x:%02x:" | ||
667 | "%02x\n", | ||
668 | eccbuf[0], eccbuf[1], eccbuf[2], | ||
669 | eccbuf[3], eccbuf[4], eccbuf[5]); | ||
670 | #endif | 664 | #endif |
671 | ret = -EIO; | 665 | ret = -EIO; |
672 | } | 666 | } |
673 | } | 667 | } |
674 | 668 | ||
675 | #ifdef PSYCHO_DEBUG | 669 | #ifdef PSYCHO_DEBUG |
676 | printk("ECC DATA at %lx: %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", | 670 | printk("ECC DATA at %lx: %*ph\n", (long)from, 6, eccbuf); |
677 | (long)from, eccbuf[0], eccbuf[1], eccbuf[2], eccbuf[3], | ||
678 | eccbuf[4], eccbuf[5]); | ||
679 | #endif | 671 | #endif |
680 | /* disable the ECC engine */ | 672 | /* disable the ECC engine */ |
681 | WriteDOC(DOC_ECC_DIS, docptr , Mplus_ECCConf); | 673 | WriteDOC(DOC_ECC_DIS, docptr , Mplus_ECCConf); |
diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c index f70854d728fe..d34d83b8f9c2 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c | |||
@@ -919,19 +919,13 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t from, | |||
919 | eccconf1 = doc_register_readb(docg3, DOC_ECCCONF1); | 919 | eccconf1 = doc_register_readb(docg3, DOC_ECCCONF1); |
920 | 920 | ||
921 | if (nboob >= DOC_LAYOUT_OOB_SIZE) { | 921 | if (nboob >= DOC_LAYOUT_OOB_SIZE) { |
922 | doc_dbg("OOB - INFO: %02x:%02x:%02x:%02x:%02x:%02x:%02x\n", | 922 | doc_dbg("OOB - INFO: %*phC\n", 7, oobbuf); |
923 | oobbuf[0], oobbuf[1], oobbuf[2], oobbuf[3], | ||
924 | oobbuf[4], oobbuf[5], oobbuf[6]); | ||
925 | doc_dbg("OOB - HAMMING: %02x\n", oobbuf[7]); | 923 | doc_dbg("OOB - HAMMING: %02x\n", oobbuf[7]); |
926 | doc_dbg("OOB - BCH_ECC: %02x:%02x:%02x:%02x:%02x:%02x:%02x\n", | 924 | doc_dbg("OOB - BCH_ECC: %*phC\n", 7, oobbuf + 8); |
927 | oobbuf[8], oobbuf[9], oobbuf[10], oobbuf[11], | ||
928 | oobbuf[12], oobbuf[13], oobbuf[14]); | ||
929 | doc_dbg("OOB - UNUSED: %02x\n", oobbuf[15]); | 925 | doc_dbg("OOB - UNUSED: %02x\n", oobbuf[15]); |
930 | } | 926 | } |
931 | doc_dbg("ECC checks: ECCConf1=%x\n", eccconf1); | 927 | doc_dbg("ECC checks: ECCConf1=%x\n", eccconf1); |
932 | doc_dbg("ECC HW_ECC: %02x:%02x:%02x:%02x:%02x:%02x:%02x\n", | 928 | doc_dbg("ECC HW_ECC: %*phC\n", 7, hwecc); |
933 | hwecc[0], hwecc[1], hwecc[2], hwecc[3], hwecc[4], | ||
934 | hwecc[5], hwecc[6]); | ||
935 | 929 | ||
936 | ret = -EIO; | 930 | ret = -EIO; |
937 | if (is_prot_seq_error(docg3)) | 931 | if (is_prot_seq_error(docg3)) |
diff --git a/drivers/mtd/nand/bcm_umi_bch.c b/drivers/mtd/nand/bcm_umi_bch.c index c8799a001833..ce39c8705d62 100644 --- a/drivers/mtd/nand/bcm_umi_bch.c +++ b/drivers/mtd/nand/bcm_umi_bch.c | |||
@@ -154,19 +154,10 @@ static int bcm_umi_bch_read_page_hwecc(struct mtd_info *mtd, | |||
154 | #if defined(NAND_BCM_UMI_DEBUG) | 154 | #if defined(NAND_BCM_UMI_DEBUG) |
155 | printk(KERN_WARNING "%s uncorr_err sectorIdx=%d\n", | 155 | printk(KERN_WARNING "%s uncorr_err sectorIdx=%d\n", |
156 | __func__, sectorIdx); | 156 | __func__, sectorIdx); |
157 | printk(KERN_WARNING | 157 | printk(KERN_WARNING "%s data %*ph\n", |
158 | "%s data %02x %02x %02x %02x " | 158 | __func__, 8, datap); |
159 | "%02x %02x %02x %02x\n", | 159 | printk(KERN_WARNING "%s ecc %*ph\n", |
160 | __func__, datap[0], datap[1], datap[2], datap[3], | 160 | __func__, 13, eccCalc); |
161 | datap[4], datap[5], datap[6], datap[7]); | ||
162 | printk(KERN_WARNING | ||
163 | "%s ecc %02x %02x %02x %02x " | ||
164 | "%02x %02x %02x %02x %02x %02x " | ||
165 | "%02x %02x %02x\n", | ||
166 | __func__, eccCalc[0], eccCalc[1], eccCalc[2], | ||
167 | eccCalc[3], eccCalc[4], eccCalc[5], eccCalc[6], | ||
168 | eccCalc[7], eccCalc[8], eccCalc[9], eccCalc[10], | ||
169 | eccCalc[11], eccCalc[12]); | ||
170 | BUG(); | 161 | BUG(); |
171 | #endif | 162 | #endif |
172 | mtd->ecc_stats.failed++; | 163 | mtd->ecc_stats.failed++; |
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index e71f7a951bf0..8ae9399fb4c8 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c | |||
@@ -457,10 +457,8 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat, | |||
457 | diff1 = read_ecc[1] ^ calc_ecc[1]; | 457 | diff1 = read_ecc[1] ^ calc_ecc[1]; |
458 | diff2 = read_ecc[2] ^ calc_ecc[2]; | 458 | diff2 = read_ecc[2] ^ calc_ecc[2]; |
459 | 459 | ||
460 | pr_debug("%s: rd %02x%02x%02x calc %02x%02x%02x diff %02x%02x%02x\n", | 460 | pr_debug("%s: rd %*phN calc %*phN diff %02x%02x%02x\n", |
461 | __func__, | 461 | __func__, 3, read_ecc, 3, calc_ecc, |
462 | read_ecc[0], read_ecc[1], read_ecc[2], | ||
463 | calc_ecc[0], calc_ecc[1], calc_ecc[2], | ||
464 | diff0, diff1, diff2); | 462 | diff0, diff1, diff2); |
465 | 463 | ||
466 | if (diff0 == 0 && diff1 == 0 && diff2 == 0) | 464 | 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, | |||
562 | ecc_code[1] = readb(info->regs + S3C2410_NFECC + 1); | 560 | ecc_code[1] = readb(info->regs + S3C2410_NFECC + 1); |
563 | ecc_code[2] = readb(info->regs + S3C2410_NFECC + 2); | 561 | ecc_code[2] = readb(info->regs + S3C2410_NFECC + 2); |
564 | 562 | ||
565 | pr_debug("%s: returning ecc %02x%02x%02x\n", __func__, | 563 | pr_debug("%s: returning ecc %*phN\n", __func__, 3, ecc_code); |
566 | ecc_code[0], ecc_code[1], ecc_code[2]); | ||
567 | 564 | ||
568 | return 0; | 565 | return 0; |
569 | } | 566 | } |
@@ -578,8 +575,7 @@ static int s3c2412_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, | |||
578 | ecc_code[1] = ecc >> 8; | 575 | ecc_code[1] = ecc >> 8; |
579 | ecc_code[2] = ecc >> 16; | 576 | ecc_code[2] = ecc >> 16; |
580 | 577 | ||
581 | pr_debug("calculate_ecc: returning ecc %02x,%02x,%02x\n", | 578 | pr_debug("%s: returning ecc %*phN\n", __func__, 3, ecc_code); |
582 | ecc_code[0], ecc_code[1], ecc_code[2]); | ||
583 | 579 | ||
584 | return 0; | 580 | return 0; |
585 | } | 581 | } |