Message ID | 1487334771-25789-3-git-send-email-mark.rutland@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CD161600C5 for <patchwork-linux-arm@patchwork.kernel.org>; Fri, 17 Feb 2017 12:33:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEDE72866E for <patchwork-linux-arm@patchwork.kernel.org>; Fri, 17 Feb 2017 12:33:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B39A7286C4; Fri, 17 Feb 2017 12:33:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5CE46286A8 for <patchwork-linux-arm@patchwork.kernel.org>; Fri, 17 Feb 2017 12:33:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=J0YdnlJijQxIo1EzsHk7clMCdfNTxDFbdPXcc1PRSg8=; b=ARYGtwA/oTLmIdtB6vd7bi5DK1 nMKNxIqWX6JWg9gO0/2vionYiVZBmJqmx97zeZXAFrpMOftM1XLcMsDcXqv2MnWdZc3ZteP8oKe/k yXdJJ7FPKVbOG2hfjfEVzKRT+ZYghLMAHI4irCFVJsQRoT77toHe8ot1qjDdy2xlDpEtTX1rJXfiV xBPW7bbdimg6tkuXRVgVRHDq5J9Kb+WBvzUleB3C5F9mWNSlA7jgOFD9TwP7Dz2l+N1cPIGcFyHgo I+UfxbBUticdaCaNAi8hpe0dTC3k0h3M/GZgeR2ay7d/zYqyRF7NMVkUqwj6NsZP04ZB3Dya28HEn aAiHVkFg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cehjZ-00060p-SL; Fri, 17 Feb 2017 12:33:57 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cehj5-0005bT-MU for linux-arm-kernel@bombadil.infradead.org; Fri, 17 Feb 2017 12:33:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=95yCtytvfRNb99ktN1pktfEKzoiOsgF/5dPjCkhBVJM=; b=jwd3e1HR1+ki5qfd1S9xMBJcw LYvAhF6jO3udYtfAOAEykz/9bvqY3wIbyFoTRgICkBeTSCJczqrwlL9BRPxZNPx8FRD7JhUZPMk/n v0kS73Jm09NKKQHc6AxRPqgdpxg/Ia8vJcFYelZB0LfMx6USEgtUyi8QIBljGErLTrb9W5/EK2lSO yvoCYs/kJQGnPTg+Y9kXSk8uHuf+D5NDb2i+5v6N748+wzOgRiYwD6kpAneMZHSle3n64TTd1wrgl bi+pTT9bRuUVLVoruBRfgcfq77l34yrMA+4pZt6eMIs9KMoIEqI30JHi1I58GB7qnrm2z7PuANBPy 5iYO2ECjQ==; Received: from foss.arm.com ([217.140.101.70]) by merlin.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cehj4-0005aP-15 for linux-arm-kernel@lists.infradead.org; Fri, 17 Feb 2017 12:33:26 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6455C806; Fri, 17 Feb 2017 04:33:02 -0800 (PST) Received: from leverpostej.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E6ACB3F23B; Fri, 17 Feb 2017 04:33:01 -0800 (PST) From: Mark Rutland <mark.rutland@arm.com> To: linux-arm-kernel@lists.infradead.org Subject: [BOOTWRAPPER PATCH 2/3] FDT.pm: add helper to get a node's full path Date: Fri, 17 Feb 2017 12:32:50 +0000 Message-Id: <1487334771-25789-3-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487334771-25789-1-git-send-email-mark.rutland@arm.com> References: <1487334771-25789-1-git-send-email-mark.rutland@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170217_073326_140704_9DDECB55 X-CRM114-Status: UNSURE ( 6.03 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: Mark Rutland <mark.rutland@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/FDT.pm b/FDT.pm index f498f09..9adf70b 100755 --- a/FDT.pm +++ b/FDT.pm @@ -278,6 +278,25 @@ sub find_by_device_type return @found; } +sub get_full_path +{ + my $self = shift; + my $cur = $self; + my @elems = (); + + # root node + if (not defined($cur->{parent})) { + return '/'; + } + + while (defined($cur->{parent})) { + unshift @elems, $cur->{name}; + unshift @elems, '/'; + $cur = $cur->{parent}; + } + return join ('', @elems); +} + sub get_property { my $self = shift;
This will be useful for subsequent patches where we want to automatically configure properties for nodes which may have arbitrary names. Signed-off-by: Mark Rutland <mark.rutland@arm.com> --- FDT.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)