clk: define and export clk_debugs_add_file
authorPeter De Schrijver <pdeschrijver@nvidia.com>
Thu, 26 Jun 2014 15:00:53 +0000 (18:00 +0300)
committerMike Turquette <mturquette@linaro.org>
Wed, 2 Jul 2014 23:15:55 +0000 (16:15 -0700)
Define and export a new function clk_debugs_add_file which adds a file
to a existing clock's debugfs directory. This can be used by clock
providers to add debugfs entries which are not related to a specific clock
type. Examples include the ability to measure the rate of a clock. It can
also be used by modules to create new debugfs entries. This is useful if you
want to expose features for testing which can potentially cause system
instability such as allowing to change a clock's rate from userspace.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
drivers/clk/clk.c
include/linux/clk-provider.h

index 958967d..9ad3970 100644 (file)
@@ -358,6 +358,18 @@ static void clk_debug_unregister(struct clk *clk)
        debugfs_remove_recursive(clk->dentry);
 }
 
+struct dentry *clk_debugfs_add_file(struct clk *clk, char *name, umode_t mode,
+                               void *data, const struct file_operations *fops)
+{
+       struct dentry *d = NULL;
+
+       if (clk->dentry)
+               d = debugfs_create_file(name, mode, clk->dentry, data, fops);
+
+       return d;
+}
+EXPORT_SYMBOL_GPL(clk_debugfs_add_file);
+
 /**
  * clk_debug_init - lazily create the debugfs clk tree visualization
  *
index 0c287db..411dd7e 100644 (file)
@@ -619,5 +619,10 @@ static inline void clk_writel(u32 val, u32 __iomem *reg)
 
 #endif /* platform dependent I/O accessors */
 
+#ifdef CONFIG_DEBUG_FS
+struct dentry *clk_debugfs_add_file(struct clk *clk, char *name, umode_t mode,
+                               void *data, const struct file_operations *fops);
+#endif
+
 #endif /* CONFIG_COMMON_CLK */
 #endif /* CLK_PROVIDER_H */