From patchwork Fri May 8 04:24:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1285760 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) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49JHLK1jnmz9sSk for ; Fri, 8 May 2020 14:25:13 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (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.a=rsa-sha256 header.s=201707 header.b=CDHnzRD9; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49JHLK0sqqzDqvT for ; Fri, 8 May 2020 14:25:13 +1000 (AEST) 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49JHLB1yZvzDqss for ; Fri, 8 May 2020 14:25:06 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (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.a=rsa-sha256 header.s=201707 header.b=CDHnzRD9; 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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 49JHL92G1Hz9sRf; Fri, 8 May 2020 14:25:05 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1588911905; bh=R0QDbF3tCxMNhlUPfb7xQF8rsVPC4tzle4P+5bW5dcs=; h=From:To:Cc:Subject:Date:From; b=CDHnzRD9aBm16wJIpCSurvPDFXklyocpmnYw0FyKmpWVDAA+6bu3U1uhfO+Xvt4NX KnodpnnpA+laykysfqaCirRbqzvNeVpCCtFqJWB7fNzTe4e7jB/mnO7UYiuWPPOaMH lHyrElWgrj/5w/dY+txNUyOe1DzT4j2SnykGK+NH93MYfDQUR7ffQkEqKTi/uGqliE 5dklxwfIPbnRjAZhNtuckZ8qbljNl+YDMC+G8ALPHdlOSBZd9ugronNbkSApyUfY/F kB7wJB/fG5fCj/K/CKST3MiICaI5n6zvatEg1nzbUtxq1GUhpmBkp6O6gynDVUc7qV ZX1+PLbSdrDgA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 8 May 2020 14:24:45 +1000 Message-Id: <20200508042446.346553-1-amitay@ozlabs.org> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Subject: [Pdbg] [PATCH] libpdbg: Process all nodes for finding system-path attribute 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" Even if a node is virtual and linked, it might have children that have system-path attribute and they need to be processed. So instead of stopping the traverse for linked virtual targets, skip virtual targets during processing. Signed-off-by: Amitay Isaacs --- libpdbg/device.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libpdbg/device.c b/libpdbg/device.c index 4d22da4..4665dce 100644 --- a/libpdbg/device.c +++ b/libpdbg/device.c @@ -661,6 +661,10 @@ static void pdbg_targets_init_virtual(struct pdbg_target *node, struct pdbg_targ const char *system_path; size_t len; + /* Skip virtual nodes */ + if (target_is_virtual(node)) + goto skip; + system_path = (const char *)pdbg_target_property(node, "system-path", &len); if (!system_path) goto skip; @@ -679,21 +683,18 @@ static void pdbg_targets_init_virtual(struct pdbg_target *node, struct pdbg_targ if (!vnode) goto skip; - assert(target_is_virtual(vnode)); - /* - * If virtual node is not linked, then link with node; - * otherwise skip + * If the virtual node is linked, dt_find_by_path will return the + * linked target. So if we found a virtual target, then it's + * definitely not linked. */ - if (!vnode->vnode) + if (target_is_virtual(vnode)) { + assert(!vnode->vnode); dt_link_virtual(node, vnode); + } skip: list_for_each(&node->children, child, list) { - /* If a virtual node is already linked, skip */ - if (target_is_virtual(child) && child->vnode) - continue; - pdbg_targets_init_virtual(child, root); } }