From patchwork Thu Jun 7 06:54:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 926174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411brh3Sr7z9s1b for ; Thu, 7 Jun 2018 16:55:00 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=neuling.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 411brh2MvlzF32g for ; Thu, 7 Jun 2018 16:55:00 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=neuling.org X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 411brL3k9VzF32n for ; Thu, 7 Jun 2018 16:54:42 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=neuling.org Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 411brK6K9Pz9s78; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 9F13AEE7924; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Thu, 7 Jun 2018 16:54:37 +1000 Message-Id: <20180607065438.18257-10-mikey@neuling.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607065438.18257-1-mikey@neuling.org> References: <20180607065438.18257-1-mikey@neuling.org> Subject: [Pdbg] [PATCH 10/11] htm: Few code cleanups X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Remove unused arguments. Remove unused pause command. Make < 80 cols Signed-off-by: Michael Neuling --- 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; } }