From: alex.elder@linaro.org (Alex Elder)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clk: support hardware-specific debugfs entries
Date: Thu, 26 Dec 2013 08:26:41 -0600 [thread overview]
Message-ID: <52BC3CA1.7000701@linaro.org> (raw)
Add a new clk_ops->debug_init method to allow a clock hardware
driver to populate the clock's debugfs directory with entries
beyond those common for every clock.
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/clk/clk.c | 4 ++++
include/linux/clk-provider.h | 10 ++++++++++
2 files changed, 14 insertions(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 2cf2ea6..c82a1bc 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -268,6 +268,10 @@ static int clk_debug_create_one(struct clk *clk,
struct dentry *pdentry)
if (!d)
goto err_out;
+ if (clk->ops->debug_init)
+ if (clk->ops->debug_init(clk->hw, clk->dentry))
+ goto err_out;
+
ret = 0;
goto out;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 7e59253..4812512 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -31,6 +31,7 @@
#define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate
change */
struct clk_hw;
+struct dentry;
/**
* struct clk_ops - Callback operations for hardware clocks; these are to
@@ -108,6 +109,12 @@ struct clk_hw;
* which is likely helpful for most .set_rate implementation.
* Returns 0 on success, -EERROR otherwise.
*
+ * @debug_init: Set up type-specific debugfs entries for this clock. This
+ * is called once, after the debugfs directory entry for this
+ * clock has been created. The dentry pointer representing that
+ * directory is provided as an argument. Called with
+ * prepare_lock held. Returns 0 on success, -EERROR otherwise.
+ *
* The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow
* implementations to split any work between atomic (enable) and sleepable
* (prepare) contexts. If enabling a clock requires code that might sleep,
@@ -140,6 +147,9 @@ struct clk_ops {
int (*set_rate)(struct clk_hw *hw, unsigned long,
unsigned long);
void (*init)(struct clk_hw *hw);
+#ifdef CONFIG_COMMON_CLK_DEBUG
+ int (*debug_init)(struct clk_hw *hw, struct dentry *dentry);
+#endif
};
/**
--
1.7.9.5
next reply other threads:[~2013-12-26 14:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-26 14:26 Alex Elder [this message]
2013-12-26 14:50 ` [PATCH] clk: support hardware-specific debugfs entries Gerhard Sittig
2013-12-26 15:02 ` Alex Elder
-- strict thread matches above, loose matches on Subject: below --
2013-12-30 5:58 Alex Elder
2013-12-30 5:59 ` Alex Elder
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=52BC3CA1.7000701@linaro.org \
--to=alex.elder@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).