From patchwork Tue Nov 20 04:19:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1000265 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42zXYm5LmSz9s4s for ; Tue, 20 Nov 2018 15:20:28 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="J39kk48D"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42zXYm3DRszF3TC for ; Tue, 20 Nov 2018 15:20:28 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="J39kk48D"; dkim-atps=neutral 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42zXYH5PTNzF3QJ for ; Tue, 20 Nov 2018 15:20:03 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="J39kk48D"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 42zXYH2qb7z9s3q; Tue, 20 Nov 2018 15:20:03 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1542687603; bh=mePzTCiIctybCSr7dowZMuzXbrgiCk1b3tQ8Etzitb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J39kk48DpgDpzHU+wUyXRfdVUDb+3QNKagOw0Jvn50saOlFc9K80lpzOCtS90KGLD qgPrdb3mDqnX6aKLo056azBMzUAWp82FZg6NCdOg6rBXpUg56fGYc5SCpxHt1VY48q jzNvBmLHTkSEjXpQdpljWdevucIcsz+VjNpRUjO3VsXyd1v2DGF0Co5XlCXoQ7Pyjd us72CpalKMX28g6pkS4RDAdjVmgvgKNLkq9ujgEwhVrW8gnlS19KGyusblwId5eBuj yi/3QAMxzMmCBHDMhSUPRqwyS7vhUaha5frIoPC80djz1p68rXPXqVn8zpWr5lvNXb ubxCoCQyKwWIQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Tue, 20 Nov 2018 15:19:50 +1100 Message-Id: <20181120041953.402413-7-amitay@ozlabs.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181120041953.402413-1-amitay@ozlabs.org> References: <20181120041953.402413-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 6/9] main: Drop unused iterators with callbacks X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 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: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- src/main.c | 61 ------------------------------------------------------ src/main.h | 8 ------- 2 files changed, 69 deletions(-) diff --git a/src/main.c b/src/main.c index 8c83a49..6693349 100644 --- a/src/main.c +++ b/src/main.c @@ -529,67 +529,6 @@ bool target_selected(struct pdbg_target *target) return path_target_selected(target); } -/* Returns the sum of return codes. This can be used to count how many targets the callback was run on. */ -int for_each_child_target(char *class, struct pdbg_target *parent, - int (*cb)(struct pdbg_target *, uint32_t, uint64_t *, uint64_t *), - uint64_t *arg1, uint64_t *arg2) -{ - int rc = 0; - struct pdbg_target *target; - uint32_t index; - enum pdbg_target_status status; - - pdbg_for_each_target(class, parent, target) { - if (!target_selected(target)) - continue; - - index = pdbg_target_index(target); - assert(index != -1); - status = pdbg_target_status(target); - if (status != PDBG_TARGET_ENABLED) - continue; - - rc += cb(target, index, arg1, arg2); - } - - return rc; -} - -int for_each_target(char *class, int (*cb)(struct pdbg_target *, uint32_t, uint64_t *, uint64_t *), uint64_t *arg1, uint64_t *arg2) -{ - struct pdbg_target *target; - uint32_t index; - enum pdbg_target_status status; - int rc = 0; - - pdbg_for_each_class_target(class, target) { - if (!target_selected(target)) - continue; - - index = pdbg_target_index(target); - assert(index != -1); - status = pdbg_target_status(target); - if (status != PDBG_TARGET_ENABLED) - continue; - - rc += cb(target, index, arg1, arg2); - } - - return rc; -} - -void for_each_target_release(char *class) -{ - struct pdbg_target *target; - - pdbg_for_each_class_target(class, target) { - if (!target_selected(target)) - continue; - - pdbg_target_release(target); - } -} - static bool target_selection(void) { switch (backend) { diff --git a/src/main.h b/src/main.h index b1366d9..a97826c 100644 --- a/src/main.h +++ b/src/main.h @@ -30,11 +30,3 @@ static inline bool target_is_disabled(struct pdbg_target *target) void target_select(struct pdbg_target *target); void target_unselect(struct pdbg_target *target); bool target_selected(struct pdbg_target *target); - -/* Returns the sum of return codes. This can be used to count how many targets the callback was run on. */ -int for_each_child_target(char *class, struct pdbg_target *parent, - int (*cb)(struct pdbg_target *, uint32_t, uint64_t *, uint64_t *), - uint64_t *arg1, uint64_t *arg2); - -int for_each_target(char *class, int (*cb)(struct pdbg_target *, uint32_t, uint64_t *, uint64_t *), uint64_t *arg1, uint64_t *arg2); -void for_each_target_release(char *class);