diff options
author | Michael Neuling <mikey@neuling.org> | 2018-06-07 16:54:37 +1000 |
---|---|---|
committer | Alistair Popple <alistair@popple.id.au> | 2018-06-15 14:33:11 +1000 |
commit | 11ed228ee3cd7a67913d4d0add0e7cca9b5e9f38 (patch) | |
tree | 77c510968893c26487b249ea22cb0d8d661c2d93 | |
parent | 08eef521d374c6fc46d7adb02f2958c10323086f (diff) | |
download | pdbg-11ed228ee3cd7a67913d4d0add0e7cca9b5e9f38.tar.gz pdbg-11ed228ee3cd7a67913d4d0add0e7cca9b5e9f38.zip |
htm: Few code cleanups
Remove unused arguments.
Remove unused pause command.
Make < 80 cols
Signed-off-by: Michael Neuling <mikey@neuling.org>
-rw-r--r-- | libpdbg/htm.c | 32 | ||||
-rw-r--r-- | libpdbg/target.h | 1 | ||||
-rw-r--r-- | src/htm.c | 26 |
3 files changed, 16 insertions, 43 deletions
diff --git a/libpdbg/htm.c b/libpdbg/htm.c index 7009c40..da381f5 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 abdc0be..716ba42 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 *); }; @@ -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; } } |