diff mbox series

[3/4] htm: Remove size from dump

Message ID 20180628020256.27494-3-mikey@neuling.org
State Accepted
Headers show
Series [1/4] pdbg: Fix htm return codes | expand

Commit Message

Michael Neuling June 28, 2018, 2:02 a.m. UTC
This isn't used and just complicates things.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---
 libpdbg/htm.c     | 13 ++++++-------
 libpdbg/libpdbg.h |  2 +-
 libpdbg/target.h  |  2 +-
 src/htm.c         |  2 +-
 4 files changed, 9 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/libpdbg/htm.c b/libpdbg/htm.c
index 4e0c7aaa23..d9b1bbd48d 100644
--- a/libpdbg/htm.c
+++ b/libpdbg/htm.c
@@ -218,14 +218,14 @@  int htm_status(struct pdbg_target *target)
 	return htm ? htm->status(htm) : -1;
 }
 
-int htm_dump(struct pdbg_target *target, uint64_t size, char *filename)
+int htm_dump(struct pdbg_target *target, char *filename)
 {
 	struct htm *htm = check_and_convert(target);
 
 	if (!htm || !filename)
 		return -1;
 
-	return htm->dump(htm, 0, filename);
+	return htm->dump(htm, filename);
 }
 
 int htm_record(struct pdbg_target *target, char *filename)
@@ -972,11 +972,12 @@  static int do_htm_status(struct htm *htm)
  * FIXME:
  *   Look for eyecatcher 0xacef_f000 at start, otherwise assume wrapping
  */
-static int do_htm_dump(struct htm *htm, uint64_t size, char *filename)
+static int do_htm_dump(struct htm *htm, char *filename)
 {
 	char *trace_file;
 	struct htm_status status;
 	uint64_t trace[0x1000];
+	uint64_t size;
 	int trace_fd, dump_fd;
 	uint32_t chip_id;
 	size_t r;
@@ -996,9 +997,7 @@  static int do_htm_dump(struct htm *htm, uint64_t size, char *filename)
 	if (chip_id == -1)
 		return -1;
 
-	/* If size is zero they must want the entire thing */
-	if (size == 0)
-		size = status.mem_last - status.mem_base;
+	size = status.mem_last - status.mem_base;
 
 	printf("Dumping %" PRIi64 "i MB to %s\n", size >> 20, filename);
 	if (status.mem_last - status.mem_base > size) {
@@ -1063,7 +1062,7 @@  static int do_htm_record(struct htm *htm, char *filename)
 	if (do_htm_stop(htm) < 0)
 		return -1;
 
-	if (do_htm_dump(htm, 0, filename) < 0)
+	if (do_htm_dump(htm, filename) < 0)
 		return -1;
 
 
diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
index 6b635a9b78..1c345cb1d7 100644
--- a/libpdbg/libpdbg.h
+++ b/libpdbg/libpdbg.h
@@ -165,7 +165,7 @@  struct thread_state {
 int htm_start(struct pdbg_target *target);
 int htm_stop(struct pdbg_target *target);
 int htm_status(struct pdbg_target *target);
-int htm_dump(struct pdbg_target *target, uint64_t size, char *filename);
+int htm_dump(struct pdbg_target *target, char *filename);
 int htm_record(struct pdbg_target *target, char *filename);
 
 int adu_getmem(struct pdbg_target *target, uint64_t addr, uint8_t *ouput, uint64_t size);
diff --git a/libpdbg/target.h b/libpdbg/target.h
index 9d2ad90bcf..6c2fa1770e 100644
--- a/libpdbg/target.h
+++ b/libpdbg/target.h
@@ -94,7 +94,7 @@  struct htm {
 	int (*start)(struct htm *);
 	int (*stop)(struct htm *);
 	int (*status)(struct htm *);
-	int (*dump)(struct htm *, uint64_t, char *);
+	int (*dump)(struct htm *, char *);
 	int (*record)(struct htm *, char *);
 };
 #define target_to_htm(x) container_of(x, struct htm, target)
diff --git a/src/htm.c b/src/htm.c
index 02e55c1833..97c7d14434 100644
--- a/src/htm.c
+++ b/src/htm.c
@@ -166,7 +166,7 @@  static int run_dump(enum htm_type type)
 		/* size = 0 will dump everything */
 		printf("Dumping HTM@");
 		print_htm_address(type, target);
-		if (htm_dump(target, 0, filename) != 1) {
+		if (htm_dump(target, filename) != 1) {
 			printf("Couldn't dump HTM@");
 			print_htm_address(type, target);
 		}