From: Leonard Crestez <leonard.crestez@nxp.com>
To: Stephen Boyd <sboyd@kernel.org>,
Jan Kiszka <jan.kiszka@siemens.com>,
Kieran Bingham <kbingham@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/3] scripts/gdb: Add $lx_clk_core_lookup function
Date: Mon, 22 Apr 2019 08:26:57 +0000 [thread overview]
Message-ID: <ebda22b2d3f7e35db5809bf21f4f9ee3ac38f5d9.1555921081.git.leonard.crestez@nxp.com> (raw)
In-Reply-To: <cover.1555921081.git.leonard.crestez@nxp.com>
Finding an individual clk_core requires walking the tree which can be
quite complicated so add a helper for easy access.
(gdb) print *(struct clk_scu*)$lx_clk_core_lookup("uart0_clk")->hw
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
scripts/gdb/linux/clk.py | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/scripts/gdb/linux/clk.py b/scripts/gdb/linux/clk.py
index a9129d865c5d..6bf71976b55d 100644
--- a/scripts/gdb/linux/clk.py
+++ b/scripts/gdb/linux/clk.py
@@ -42,5 +42,28 @@ class LxClkSummary(gdb.Command):
for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_orphan_list")):
self.show_subtree(clk, 0)
LxClkSummary()
+
+
+class LxClkCoreLookup(gdb.Function):
+ """Find struct clk_core by name"""
+
+ def __init__(self):
+ super(LxClkCoreLookup, self).__init__("lx_clk_core_lookup")
+
+ def lookup_hlist(self, hlist_head, name):
+ for child in clk_core_for_each_child(hlist_head):
+ if child['name'].string() == name:
+ return child
+ result = self.lookup_hlist(child['children'], name)
+ if result:
+ return result
+
+ def invoke(self, name):
+ name = name.string()
+ return (self.lookup_hlist(gdb.parse_and_eval("clk_root_list"), name) or
+ self.lookup_hlist(gdb.parse_and_eval("clk_orphan_list"), name))
+
+
+LxClkCoreLookup()
--
2.17.1
next prev parent reply other threads:[~2019-04-22 8:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-22 8:26 [PATCH 0/3] scripts/gdb: Initial clk support Leonard Crestez
2019-04-22 8:26 ` [PATCH 1/3] scripts/gdb: Add hlist utilities Leonard Crestez
2019-04-22 20:41 ` Stephen Boyd
2019-04-23 9:20 ` Leonard Crestez
2019-04-22 8:26 ` Leonard Crestez [this message]
[not found] ` <155596430227.15276.13435242792506854365@swboyd.mtv.corp.google.com>
2019-04-23 11:12 ` [PATCH 3/3] scripts/gdb: Add $lx_clk_core_lookup function Leonard Crestez
2019-04-23 18:16 ` Stephen Boyd
2019-04-22 8:26 ` [PATCH 2/3] scripts/gdb: Initial clk support: lx-clk-summary Leonard Crestez
2019-04-22 20:22 ` Stephen Boyd
2019-04-22 20:40 ` [PATCH 0/3] scripts/gdb: Initial clk support Stephen Boyd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ebda22b2d3f7e35db5809bf21f4f9ee3ac38f5d9.1555921081.git.leonard.crestez@nxp.com \
--to=leonard.crestez@nxp.com \
--cc=akpm@linux-foundation.org \
--cc=jan.kiszka@siemens.com \
--cc=kbingham@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®