aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/debug.c
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/ubi/debug.c
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/ubi/debug.c')
-rw-r--r--drivers/mtd/ubi/debug.c37
1 files changed, 2 insertions, 35 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 */