Skip to content

Commit ef6075f

Browse files
Artem BityutskiyArtem Bityutskiy
authored andcommitted
UBI: use linux print_hex_dump(), not home-grown one
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
1 parent 0169b49 commit ef6075f

3 files changed

Lines changed: 3 additions & 38 deletions

File tree

‎drivers/mtd/ubi/debug.c‎

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ void ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr)
4242
dbg_msg("data_offset %d", be32_to_cpu(ec_hdr->data_offset));
4343
dbg_msg("hdr_crc %#08x", be32_to_cpu(ec_hdr->hdr_crc));
4444
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);
4647
}
4748

4849
/**
@@ -187,38 +188,4 @@ void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req)
187188
dbg_msg("the 1st 16 characters of the name: %s", nm);
188189
}
189190

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-
*/
197-
void 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-
224191
#endif /* CONFIG_MTD_UBI_DEBUG_MSG */

‎drivers/mtd/ubi/debug.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ void ubi_dbg_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx);
5959
void ubi_dbg_dump_sv(const struct ubi_scan_volume *sv);
6060
void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type);
6161
void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req);
62-
void ubi_dbg_hexdump(const void *buf, int size);
6362

6463
#else
6564

@@ -72,7 +71,6 @@ void ubi_dbg_hexdump(const void *buf, int size);
7271
#define ubi_dbg_dump_sv(sv) ({})
7372
#define ubi_dbg_dump_seb(seb, type) ({})
7473
#define ubi_dbg_dump_mkvol_req(req) ({})
75-
#define ubi_dbg_hexdump(buf, size) ({})
7674

7775
#endif /* CONFIG_MTD_UBI_DEBUG_MSG */
7876

‎drivers/mtd/ubi/io.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ static int paranoid_check_all_ff(const struct ubi_device *ubi, int pnum,
12521252
fail:
12531253
ubi_err("paranoid check failed for PEB %d", pnum);
12541254
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);
12561256
err = 1;
12571257
error:
12581258
ubi_dbg_dump_stack();

0 commit comments

Comments
 (0)