aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-08-07 16:34:20 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-10-14 06:10:20 -0400
commitef6075fbfca9139f428d52d60e671da38aa2e212 (patch)
tree077b0265e67e46e09f6d3dcf35a45fbbe6e20748 /drivers/mtd
parent0169b49d52400a6035cd0f2ccd08bcba061a1a9b (diff)
UBI: use linux print_hex_dump(), not home-grown one
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/debug.c37
-rw-r--r--drivers/mtd/ubi/debug.h2
-rw-r--r--drivers/mtd/ubi/io.c2
3 files changed, 3 insertions, 38 deletions
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
index 310341e5cd43..785137435185 100644
--- a/drivers/mtd/ubi/debug.c
+++ b/drivers/mtd/ubi/debug.c
@@ -42,7 +42,8 @@ void ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr)
42 dbg_msg("data_offset %d", be32_to_cpu(ec_hdr->data_offset)); 42 dbg_msg("data_offset %d", be32_to_cpu(ec_hdr->data_offset));
43 dbg_msg("hdr_crc %#08x", be32_to_cpu(ec_hdr->hdr_crc)); 43 dbg_msg("hdr_crc %#08x", be32_to_cpu(ec_hdr->hdr_crc));
44 dbg_msg("erase counter header hexdump:"); 44 dbg_msg("erase counter header hexdump:");
45 ubi_dbg_hexdump(ec_hdr, UBI_EC_HDR_SIZE); 45 print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4,
46 (void *)ec_hdr, UBI_EC_HDR_SIZE, 1);
46} 47}
47 48
48/** 49/**
@@ -187,38 +188,4 @@ void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req)
187 dbg_msg("the 1st 16 characters of the name: %s", nm); 188 dbg_msg("the 1st 16 characters of the name: %s", nm);
188} 189}
189 190
190#define BYTES_PER_LINE 32
191
192/**
193 * ubi_dbg_hexdump - dump a buffer.
194 * @ptr: the buffer to dump
195 * @size: buffer size which must be multiple of 4 bytes
196 */
197void ubi_dbg_hexdump(const void *ptr, int size)
198{
199 int i, k = 0, rows, columns;
200 const uint8_t *p = ptr;
201
202 size = ALIGN(size, 4);
203 rows = size/BYTES_PER_LINE + size % BYTES_PER_LINE;
204 for (i = 0; i < rows; i++) {
205 int j;
206
207 cond_resched();
208 columns = min(size - k, BYTES_PER_LINE) / 4;
209 if (columns == 0)
210 break;
211 printk(KERN_DEBUG "%5d: ", i * BYTES_PER_LINE);
212 for (j = 0; j < columns; j++) {
213 int n, N;
214
215 N = size - k > 4 ? 4 : size - k;
216 for (n = 0; n < N; n++)
217 printk("%02x", p[k++]);
218 printk(" ");
219 }
220 printk("\n");
221 }
222}
223
224#endif /* CONFIG_MTD_UBI_DEBUG_MSG */ 191#endif /* CONFIG_MTD_UBI_DEBUG_MSG */
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h
index ff8f39548cd8..467722eb618b 100644
--- a/drivers/mtd/ubi/debug.h
+++ b/drivers/mtd/ubi/debug.h
@@ -59,7 +59,6 @@ void ubi_dbg_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx);
59void ubi_dbg_dump_sv(const struct ubi_scan_volume *sv); 59void ubi_dbg_dump_sv(const struct ubi_scan_volume *sv);
60void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type); 60void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type);
61void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); 61void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req);
62void ubi_dbg_hexdump(const void *buf, int size);
63 62
64#else 63#else
65 64
@@ -72,7 +71,6 @@ void ubi_dbg_hexdump(const void *buf, int size);
72#define ubi_dbg_dump_sv(sv) ({}) 71#define ubi_dbg_dump_sv(sv) ({})
73#define ubi_dbg_dump_seb(seb, type) ({}) 72#define ubi_dbg_dump_seb(seb, type) ({})
74#define ubi_dbg_dump_mkvol_req(req) ({}) 73#define ubi_dbg_dump_mkvol_req(req) ({})
75#define ubi_dbg_hexdump(buf, size) ({})
76 74
77#endif /* CONFIG_MTD_UBI_DEBUG_MSG */ 75#endif /* CONFIG_MTD_UBI_DEBUG_MSG */
78 76
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index d42ec687b014..928476394d55 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -1252,7 +1252,7 @@ static int paranoid_check_all_ff(const struct ubi_device *ubi, int pnum,
1252fail: 1252fail:
1253 ubi_err("paranoid check failed for PEB %d", pnum); 1253 ubi_err("paranoid check failed for PEB %d", pnum);
1254 dbg_msg("hex dump of the %d-%d region", offset, offset + len); 1254 dbg_msg("hex dump of the %d-%d region", offset, offset + len);
1255 ubi_dbg_hexdump(buf, len); 1255 print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4, buf, len, 1);
1256 err = 1; 1256 err = 1;
1257error: 1257error:
1258 ubi_dbg_dump_stack(); 1258 ubi_dbg_dump_stack();