From patchwork Thu Aug 16 05:57:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 958109 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 41rbGn0Wwtz9s4v for ; Thu, 16 Aug 2018 15:58:09 +1000 (AEST) 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="qd5ytZR+"; 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 41rbGm5tfMzDr5t for ; Thu, 16 Aug 2018 15:58:08 +1000 (AEST) 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="qd5ytZR+"; 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41rbGf2QD9zDqgF for ; Thu, 16 Aug 2018 15:58:02 +1000 (AEST) 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="qd5ytZR+"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 41rbGf07lpz9s4Z; Thu, 16 Aug 2018 15:58:02 +1000 (AEST) 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=1534399082; bh=vZCpewo9F0hpSwnxiPlSj9DsZujjVRPy6ckEo+Ao7Jc=; h=From:To:Cc:Subject:Date:From; b=qd5ytZR+Y00ntwxjvHntJIfGJ0CFX1vl2eZF8SO9HuM8lZiQu2k4vmmEaMU09d8do nKgcV7wNkzNpTyPMKS+9tCx1HTFMEaA0OseZA0/tvn1hrWtnBnmWG8eCax69tst3Jl Pg9RnZ6dCIzmmz/PFA13cxeYsFnv+mnToVktyVZeTmlBJW6Hlz+4GymsVg1pRbAEMQ iBYjUIyCpwuEnaYX2WXPAEZ08su+NSHfqhoIyJwcUmmuoRKemvdHLRKE9UIR1KjutF KgK6fY4+IcUkU16pXItDoggH/3wX7Z65mgOIg1R3ZlhpFAM+fS2hTbIbozbGIP1KA0 B+yikt2JPF40A== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 16 Aug 2018 15:57:52 +1000 Message-Id: <20180816055756.1011374-1-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.1 Subject: [Pdbg] [PATCH 1/5] libpdbg: Remove unused variable X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.27 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 MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- libpdbg/libpdbg.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index 694085c..f0bca0c 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -11,9 +11,6 @@ struct pdbg_target; struct pdbg_target_class; - -struct pdbg_taget *pdbg_root_target; - /* loops/iterators */ struct pdbg_target *__pdbg_next_target(const char *klass, struct pdbg_target *parent, struct pdbg_target *last); struct pdbg_target *__pdbg_next_child_target(struct pdbg_target *parent, struct pdbg_target *last); From patchwork Thu Aug 16 05:57:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 958110 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41rbGs45gYz9s4v for ; Thu, 16 Aug 2018 15:58:13 +1000 (AEST) 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="PYjw1Rzh"; 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 41rbGr68WzzDr42 for ; Thu, 16 Aug 2018 15:58:12 +1000 (AEST) 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="PYjw1Rzh"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41rbGf6hP1zDqmF for ; Thu, 16 Aug 2018 15:58:02 +1000 (AEST) 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="PYjw1Rzh"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 41rbGf26wNz9s4v; Thu, 16 Aug 2018 15:58:02 +1000 (AEST) 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=1534399082; bh=YivbJTN3vHVy/As3qIlXWUIgWyjcCdKAmS/hrGR4/Yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PYjw1RzhjvDmFR4MgjxUR5XPKgKXPZ+tYp+4qHiUksBcJEWUaJeGC0gcj0dlxIv7A oWrAVjzDWgoLQpJF8ArIpk3PPkiM/zbSme6XxY2aX2L7FEr5DlWH+UktM5ZbCCMH7S uozymLGTvq9ygFb2ysMxvtgY9vDodSF2sRe1esnAxiTrvYEDKuEa1d9pZ1XoPgJHeC PV7jmdwafHzReBiKYUuFB72PRiFLsrKQb/FY+hUOXeh28dhuTEIfbg1oIxmxj2ohkD gLOB0W+N8NOWZMF8wICFbvyzMKH8XBK3mQ/nrPqgEQ3neVS8Vxt1F1comPzuiL7+yD LEPq24p2qv2AQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 16 Aug 2018 15:57:53 +1000 Message-Id: <20180816055756.1011374-2-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180816055756.1011374-1-amitay@ozlabs.org> References: <20180816055756.1011374-1-amitay@ozlabs.org> Subject: [Pdbg] [PATCH 2/5] libpdbg: Add a function to get root of the device tree X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.27 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 MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- libpdbg/libpdbg.h | 1 + libpdbg/target.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index f0bca0c..a5a52b3 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -91,6 +91,7 @@ char *pdbg_target_class_name(struct pdbg_target *target); char *pdbg_target_name(struct pdbg_target *target); void *pdbg_target_priv(struct pdbg_target *target); void pdbg_target_priv_set(struct pdbg_target *target, void *priv); +struct pdbg_target *pdbg_target_root(void); /* Procedures */ int fsi_read(struct pdbg_target *target, uint32_t addr, uint32_t *val); diff --git a/libpdbg/target.c b/libpdbg/target.c index be3b845..1d308cc 100644 --- a/libpdbg/target.c +++ b/libpdbg/target.c @@ -413,3 +413,8 @@ void pdbg_target_priv_set(struct pdbg_target *target, void *priv) { target->priv = priv; } + +struct pdbg_target *pdbg_target_root(void) +{ + return dt_root; +} From patchwork Thu Aug 16 05:57:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 958111 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 41rbGz4lJWz9s4v for ; Thu, 16 Aug 2018 15:58:19 +1000 (AEST) 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="IucDyAdz"; 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 41rbGz2YRXzDqmF for ; Thu, 16 Aug 2018 15:58:19 +1000 (AEST) 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="IucDyAdz"; 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41rbGg1ynDzDqnw for ; Thu, 16 Aug 2018 15:58:03 +1000 (AEST) 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="IucDyAdz"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 41rbGf6C8qz9s5b; Thu, 16 Aug 2018 15:58:02 +1000 (AEST) 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=1534399082; bh=Cub1SkESBvxVAKvFIoTrzBdYMPIr5/cThIBtTFG7CLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IucDyAdzK7k2o9kPV8ART2ZEtwCK1aMQU2WLW47r+HJLMla4S6/kDd2rDaUMDLEIa lNEuWoYmLDTaM05jcwK/OcLKU1SMbUMG6Ai3jt9LqeBMo8qg2HnyQvZlPqGruYmMzt 04G5hg740+JufEfleO197YCqngM/5X/RJuPPVt1OiYq1XhHqAN2UP/25V70iq5wuCI LQhs9WPI/0vPRKTRjAr65wY3zOpb5cIjonEPzNICNp40REYBmMnb9qr9bP4Zo2fQR2 mJrnQ7CGd+GYUMyeif3MkVRepPPyeGiPc3yWdxpz/LTt0yMUOuphudV6aiRreNxrg8 eaTBVZmt/iCKg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 16 Aug 2018 15:57:54 +1000 Message-Id: <20180816055756.1011374-3-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180816055756.1011374-1-amitay@ozlabs.org> References: <20180816055756.1011374-1-amitay@ozlabs.org> Subject: [Pdbg] [PATCH 3/5] libpdbg: Rename dt_new_root to dt_new_node X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.27 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 MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" dt_new_root is not really creating a new root node. It's just creating a new node that is not attached to the tree. Signed-off-by: Amitay Isaacs --- libpdbg/device.c | 9 ++------- libpdbg/device.h | 4 ++-- libpdbg/target.c | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/libpdbg/device.c b/libpdbg/device.c index e5b78f4..7442e29 100644 --- a/libpdbg/device.c +++ b/libpdbg/device.c @@ -51,7 +51,7 @@ static void free_name(const char *name) free((char *)name); } -static struct pdbg_target *new_node(const char *name, const void *fdt, int node_offset) +struct pdbg_target *dt_new_node(const char *name, const void *fdt, int node_offset) { struct hw_unit_info *hw_info = NULL; const struct fdt_property *prop; @@ -108,11 +108,6 @@ static struct pdbg_target *new_node(const char *name, const void *fdt, int node_ return node; } -struct pdbg_target *dt_new_root(const char *name, const void *fdt, int offset) -{ - return new_node(name, fdt, offset); -} - static const char *get_unitname(const struct pdbg_target *node) { const char *c = strchr(node->dn_name, '@'); @@ -771,7 +766,7 @@ int dt_expand_node(struct pdbg_target *node, const void *fdt, int fdt_node) break; case FDT_BEGIN_NODE: name = fdt_get_name(fdt, offset, NULL); - child = dt_new_root(name, fdt, offset); + child = dt_new_node(name, fdt, offset); assert(child); nextoffset = dt_expand_node(child, fdt, offset); diff --git a/libpdbg/device.h b/libpdbg/device.h index 05d6c12..cb5bc10 100644 --- a/libpdbg/device.h +++ b/libpdbg/device.h @@ -46,8 +46,8 @@ extern u32 last_phandle; extern struct pdbg_target *dt_root; extern struct pdbg_target *dt_chosen; -/* Create a root node: ie. a parentless one. */ -struct pdbg_target *dt_new_root(const char *name, const void *fdt, int offset); +/* Create a new node. */ +struct pdbg_target *dt_new_node(const char *name, const void *fdt, int offset); /* Graft a root node into this tree. */ bool dt_attach_root(struct pdbg_target *parent, struct pdbg_target *root); diff --git a/libpdbg/target.c b/libpdbg/target.c index 1d308cc..341141c 100644 --- a/libpdbg/target.c +++ b/libpdbg/target.c @@ -276,7 +276,7 @@ struct hw_unit_info *find_compatible_target(const char *compat) void pdbg_targets_init(void *fdt) { - dt_root = dt_new_root("", NULL, 0); + dt_root = dt_new_node("", NULL, 0); dt_expand(fdt); } From patchwork Thu Aug 16 05:57:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 958112 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 41rbH242kBz9s4Z for ; Thu, 16 Aug 2018 15:58:22 +1000 (AEST) 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="w+/Abgta"; 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 41rbH21x0SzDrDF for ; Thu, 16 Aug 2018 15:58:22 +1000 (AEST) 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="w+/Abgta"; 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41rbGg4k8HzDqp5 for ; Thu, 16 Aug 2018 15:58:03 +1000 (AEST) 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="w+/Abgta"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 41rbGg1bBbz9s5c; Thu, 16 Aug 2018 15:58:03 +1000 (AEST) 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=1534399083; bh=g9dsXZF7mrQzlK1iDh4koXPEEfT7eiklIWfJn0M7yZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w+/AbgtaKYzkxMPh4BYWAAsuqhJhs9Eeh8w+VqAa77zUzBrtKI8MpwY1uJOh4Nes5 fUbfpX76QTWWNTIyDSF2jlhOrUbMD5C20MjOZxWs9YEfpOPoti3NDZnQO1SsA+3c0G DFkxiplsFaEq+v1CXIWW9ZJ8+vSdKPOxJqFf0amvUht9wycN6kl8tiQyu7EHHKuOfV OuzbkZZagLFcuLzS7/MP8gPJT6SOmQNgHZkqqnnD4//nlY0Tu8iTf27eC6ZVbFO1yE YmYj/DsM13prnQqmpEg+RQUgmEDYETsJsVsLeCbF0Qwj9+WjyQ8tDqI6jqTuSqdfoR JkpiTGZ1CNhZw== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 16 Aug 2018 15:57:55 +1000 Message-Id: <20180816055756.1011374-4-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180816055756.1011374-1-amitay@ozlabs.org> References: <20180816055756.1011374-1-amitay@ozlabs.org> Subject: [Pdbg] [PATCH 4/5] libpdbg: Add an api to get device-tree node name X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.27 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 MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- libpdbg/libpdbg.c | 5 +++++ libpdbg/libpdbg.h | 1 + 2 files changed, 6 insertions(+) diff --git a/libpdbg/libpdbg.c b/libpdbg/libpdbg.c index b801e5a..522bec9 100644 --- a/libpdbg/libpdbg.c +++ b/libpdbg/libpdbg.c @@ -127,6 +127,11 @@ char *pdbg_target_name(struct pdbg_target *target) return target->name; } +const char *pdbg_target_dn_name(struct pdbg_target *target) +{ + return target->dn_name; +} + void pdbg_set_target_property(struct pdbg_target *target, const char *name, const void *val, size_t size) { struct dt_property *p; diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index a5a52b3..56dd03a 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -89,6 +89,7 @@ uint32_t pdbg_target_index(struct pdbg_target *target); uint32_t pdbg_parent_index(struct pdbg_target *target, char *klass); char *pdbg_target_class_name(struct pdbg_target *target); char *pdbg_target_name(struct pdbg_target *target); +const char *pdbg_target_dn_name(struct pdbg_target *target); void *pdbg_target_priv(struct pdbg_target *target); void pdbg_target_priv_set(struct pdbg_target *target, void *priv); struct pdbg_target *pdbg_target_root(void); From patchwork Thu Aug 16 05:57:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 958113 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 41rbH54Y4hz9s4Z for ; Thu, 16 Aug 2018 15:58:25 +1000 (AEST) 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="pIynG7ka"; 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 41rbH52MvZzDr5t for ; Thu, 16 Aug 2018 15:58:25 +1000 (AEST) 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="pIynG7ka"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41rbGh0TPXzDqgF for ; Thu, 16 Aug 2018 15:58:04 +1000 (AEST) 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="pIynG7ka"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 41rbGg4SZBz9s4Z; Thu, 16 Aug 2018 15:58:03 +1000 (AEST) 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=1534399083; bh=cK5o2XRDjGQwjPNsL8wx1jYlGrAyvrii0mvTwyBUFY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pIynG7kaJcUX/fjoTzTvdUQSdEL+snsgJ59UeDaZybAgtbIRUumDlKAPw7PYWDq2I DMZSBCszgoBnAObMWTB04ICX0KZH1djGRwEuqE9tFYInEKIDuJGEyErTmZEOz6UWcs yyvRc1nqOqbubt3S06rmi8j2gSAXawkGY9Pnj/PtY03nYgV+OwmEkwyqotUDyPQHnd wm0j2TpC1yCgS4SuXaGb3IUQxSUi2VKT2mtU0RMJU94Z7zkaP5zaWFaRDvn1PY0Ziu ViFQ1Hioif2bDXXHAF+N7u3h28bZJOZwSShndEfbcRLA71E+dUOJNWcHbrXm5Zypbz FaZlJVwJ8EqIQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 16 Aug 2018 15:57:56 +1000 Message-Id: <20180816055756.1011374-5-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180816055756.1011374-1-amitay@ozlabs.org> References: <20180816055756.1011374-1-amitay@ozlabs.org> Subject: [Pdbg] [PATCH 5/5] libpdbg: Return immediate parent if class is NULL X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.27 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 MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" This avoids the segfault if class is NULL. Also, this api can be used to traverse the tree by explicitly setting class=NULL. Signed-off-by: Amitay Isaacs --- libpdbg/libpdbg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libpdbg/libpdbg.c b/libpdbg/libpdbg.c index 522bec9..810e045 100644 --- a/libpdbg/libpdbg.c +++ b/libpdbg/libpdbg.c @@ -89,6 +89,9 @@ struct pdbg_target *pdbg_target_parent(const char *class, struct pdbg_target *ta { struct pdbg_target *parent; + if (!class) + return target->parent; + for (parent = target->parent; parent && parent->parent; parent = parent->parent) { if (!strcmp(class, pdbg_target_class_name(parent))) return parent;