[Pdbg] [PATCH 10/11] htm: Few code cleanups

Michael Neuling mikey at neuling.org
Thu Jun 7 16:54:37 AEST 2018


Remove unused arguments.

Remove unused pause command.

Make < 80 cols

Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 libpdbg/htm.c    | 32 +++-----------------------------
 libpdbg/target.h |  1 -
 src/htm.c        | 26 +++++++++++++-------------
 3 files changed, 16 insertions(+), 43 deletions(-)

diff --git a/libpdbg/htm.c b/libpdbg/htm.c
index 7009c40081..da381f5811 100644
--- a/libpdbg/htm.c
+++ b/libpdbg/htm.c
@@ -214,13 +214,6 @@ int htm_reset(struct pdbg_target *target, uint64_t *base, uint64_t *size)
 	return htm ? htm->reset(htm, base, size) : -1;
 }
 
-int htm_pause(struct pdbg_target *target)
-{
-	struct htm *htm = check_and_convert(target);
-
-	return htm ? htm->pause(htm) : -1;
-}
-
 int htm_status(struct pdbg_target *target)
 {
 	struct htm *htm = check_and_convert(target);
@@ -645,7 +638,9 @@ static int get_trace_base(struct htm *htm, uint64_t *base)
 
 static bool is_resetable(struct htm_status *status)
 {
-	return status->state == COMPLETE || status->state == REPAIR || status->state == INIT;
+	return status->state == COMPLETE ||
+		status->state == REPAIR ||
+		status->state == INIT;
 }
 
 static bool is_configured(struct htm *htm)
@@ -761,25 +756,6 @@ static int do_htm_reset(struct htm *htm, uint64_t *r_base, uint64_t *r_size)
 	return 1;
 }
 
-static int do_htm_pause(struct htm *htm)
-{
-	struct htm_status status;
-
-	if (HTM_ERR(get_status(htm, &status)))
-		return -1;
-
-	if (status.state == UNINITIALIZED) {
-		PR_INFO("* Skipping PAUSE trigger, HTM appears uninitialized\n");
-		return 0;
-	}
-
-	PR_INFO("* Sending PAUSE trigger to HTM\n");
-	if (HTM_ERR(pib_write(&htm->target, HTM_SCOM_TRIGGER, HTM_TRIG_PAUSE)))
-		return -1;
-
-	return 0;
-}
-
 static int do_htm_status(struct htm *htm)
 {
 	struct htm_status status;
@@ -985,7 +961,6 @@ static struct htm nhtm = {
 	.start = do_htm_start,
 	.stop = do_htm_stop,
 	.reset = do_htm_reset,
-	.pause = do_htm_pause,
 	.status = do_htm_status,
 	.dump = do_htm_dump,
 };
@@ -1001,7 +976,6 @@ static struct htm chtm = {
 	.start = do_htm_start,
 	.stop = do_htm_stop,
 	.reset = do_htm_reset,
-	.pause = do_htm_pause,
 	.status = do_htm_status,
 	.dump = do_htm_dump,
 };
diff --git a/libpdbg/target.h b/libpdbg/target.h
index abdc0beb20..716ba42bef 100644
--- a/libpdbg/target.h
+++ b/libpdbg/target.h
@@ -94,7 +94,6 @@ struct htm {
 	int (*start)(struct htm *);
 	int (*stop)(struct htm *);
 	int (*reset)(struct htm *, uint64_t *, uint64_t *);
-	int (*pause)(struct htm *);
 	int (*status)(struct htm *);
 	int (*dump)(struct htm *, uint64_t, const char *);
 };
diff --git a/src/htm.c b/src/htm.c
index 62b8569259..f2fc8cfb52 100644
--- a/src/htm.c
+++ b/src/htm.c
@@ -81,7 +81,7 @@ static char *get_htm_dump_filename(void)
 	return filename;
 }
 
-static int run_start(enum htm_type type, int optind, int argc, char *argv[])
+static int run_start(enum htm_type type)
 {
 	struct pdbg_target *target;
 	int rc = 0;
@@ -105,7 +105,7 @@ static int run_start(enum htm_type type, int optind, int argc, char *argv[])
 	return rc;
 }
 
-static int run_stop(enum htm_type type, int optind, int argc, char *argv[])
+static int run_stop(enum htm_type type)
 {
 	struct pdbg_target *target;
 	int rc = 0;
@@ -129,7 +129,7 @@ static int run_stop(enum htm_type type, int optind, int argc, char *argv[])
 	return rc;
 }
 
-static int run_status(enum htm_type type, int optind, int argc, char *argv[])
+static int run_status(enum htm_type type)
 {
 	struct pdbg_target *target;
 	int rc = 0;
@@ -153,7 +153,7 @@ static int run_status(enum htm_type type, int optind, int argc, char *argv[])
 	return rc;
 }
 
-static int run_reset(enum htm_type type, int optind, int argc, char *argv[])
+static int run_reset(enum htm_type type)
 {
 	uint64_t old_base = 0, base, size;
 	struct pdbg_target *target;
@@ -186,7 +186,7 @@ static int run_reset(enum htm_type type, int optind, int argc, char *argv[])
 	return rc;
 }
 
-static int run_dump(enum htm_type type, int optind, int argc, char *argv[])
+static int run_dump(enum htm_type type)
 {
 	struct pdbg_target *target;
 	char *filename;
@@ -218,34 +218,34 @@ static int run_dump(enum htm_type type, int optind, int argc, char *argv[])
 	return rc;
 }
 
-static int run_trace(enum htm_type type, int optind, int argc, char *argv[])
+static int run_trace(enum htm_type type)
 {
 	int rc;
 
-	rc = run_reset(type, optind, argc, argv);
+	rc = run_reset(type);
 	if (rc == 0) {
 		printf("No HTM units were reset.\n");
 		printf("It is unlikely anything will start... trying anyway\n");
 	}
 
-	rc = run_start(type, optind, argc, argv);
+	rc = run_start(type);
 	if (rc == 0)
 		printf("No HTM units were started\n");
 
 	return rc;
 }
 
-static int run_analyse(enum htm_type type, int optind, int argc, char *argv[])
+static int run_analyse(enum htm_type type)
 {
 	int rc;
 
-	rc = run_stop(type, optind, argc, argv);
+	rc = run_stop(type);
 	if (rc == 0) {
 		printf("No HTM units were stopped.\n");
 		printf("It is unlikely anything will dump... trying anyway\n");
 	}
 
-	rc = run_dump(type, optind, argc, argv);
+	rc = run_dump(type);
 	if (rc == 0)
 		printf("No HTM buffers were dumped to file\n");
 
@@ -256,7 +256,7 @@ static struct {
 	const char *name;
 	const char *args;
 	const char *desc;
-	int (*fn)(enum htm_type, int, int, char **);
+	int (*fn)(enum htm_type);
 } actions[] = {
 	{ "start",  "", "Start %s HTM",               &run_start  },
 	{ "stop",   "", "Stop %s HTM",                &run_stop   },
@@ -382,7 +382,7 @@ int run_htm(int optind, int argc, char *argv[])
 	optind++;
 	for (i = 0; i < ARRAY_SIZE(actions); i++) {
 		if (strcmp(argv[optind], actions[i].name) == 0) {
-			rc = actions[i].fn(type, optind, argc, argv);
+			rc = actions[i].fn(type);
 			break;
 		}
 	}
-- 
2.17.0



More information about the Pdbg mailing list