linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: support hardware-specific debugfs entries
@ 2013-12-26 14:26 Alex Elder
  2013-12-26 14:50 ` Gerhard Sittig
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Elder @ 2013-12-26 14:26 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] clk: support hardware-specific debugfs entries
  2013-12-26 14:26 [PATCH] clk: support hardware-specific debugfs entries Alex Elder
@ 2013-12-26 14:50 ` Gerhard Sittig
  2013-12-26 15:02   ` Alex Elder
  0 siblings, 1 reply; 5+ messages in thread
From: Gerhard Sittig @ 2013-12-26 14:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Dec 26, 2013 at 08:26 -0600, Alex Elder wrote:
> 
> @@ -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
>  };

Please note that this CONFIG_COMMON_CLK_DEBUG switch may go away
(or get replaced) soon.  Mike plans to effectively enable common
clock debugging as soon as debugfs is in effect (which I welcome
very much).

So you should monitor current development and adjust your patch,
or be prepared for breakage and fixing afterwards.  I'd suggest
to just declare the .debug_init member unconditionally now.
Since Mike's patch very likely gets accepted, and nothing will
break when yours gets added later (regardless of the number of
review iterations it will see).


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] clk: support hardware-specific debugfs entries
  2013-12-26 14:50 ` Gerhard Sittig
@ 2013-12-26 15:02   ` Alex Elder
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Elder @ 2013-12-26 15:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/26/2013 08:50 AM, Gerhard Sittig wrote:
> On Thu, Dec 26, 2013 at 08:26 -0600, Alex Elder wrote:
>>
>> @@ -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
>>  };
> 
> Please note that this CONFIG_COMMON_CLK_DEBUG switch may go away
> (or get replaced) soon.  Mike plans to effectively enable common
> clock debugging as soon as debugfs is in effect (which I welcome
> very much).

Fine with me.  I'll wait for further feedback before sending
out an updated patch.  Thanks.

					-Alex

> 
> So you should monitor current development and adjust your patch,
> or be prepared for breakage and fixing afterwards.  I'd suggest
> to just declare the .debug_init member unconditionally now.
> Since Mike's patch very likely gets accepted, and nothing will
> break when yours gets added later (regardless of the number of
> review iterations it will see).
> 
> 
> virtually yours
> Gerhard Sittig
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] clk: support hardware-specific debugfs entries
@ 2013-12-30  5:58 Alex Elder
  2013-12-30  5:59 ` Alex Elder
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Elder @ 2013-12-30  5:58 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
v2: - Define debug_init unconditionally (suggested by Gerhard Sittig).

 drivers/clk/clk.c            |    4 ++++
 include/linux/clk-provider.h |    8 ++++++++
 2 files changed, 12 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..76ba2b2 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,7 @@ struct clk_ops {
 	int		(*set_rate)(struct clk_hw *hw, unsigned long,
 				    unsigned long);
 	void		(*init)(struct clk_hw *hw);
+	int		(*debug_init)(struct clk_hw *hw, struct dentry *dentry);
 };
 
 /**
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] clk: support hardware-specific debugfs entries
  2013-12-30  5:58 Alex Elder
@ 2013-12-30  5:59 ` Alex Elder
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Elder @ 2013-12-30  5:59 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/29/2013 11:58 PM, Alex Elder wrote:
> 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.

Sorry, forgot to indicate "v2" in the Subject line...	-Alex

> Signed-off-by: Alex Elder <elder@linaro.org>
> ---
> v2: - Define debug_init unconditionally (suggested by Gerhard Sittig).

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-12-30  5:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-26 14:26 [PATCH] clk: support hardware-specific debugfs entries Alex Elder
2013-12-26 14:50 ` 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

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).