浏览代码

clk: add pr_debug & kerneldoc around clk notifiers

Both the pr_err and the additional kerneldoc aim to help when debugging
errors thrown from within a clock rate-change notifier callback.

Reported-by: Sören Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Sören Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Mike Turquette 11 年之前
父节点
当前提交
86bcfa2e87
共有 2 个文件被更改,包括 18 次插入1 次删除
  1. 4 1
      drivers/clk/clk.c
  2. 14 0
      include/linux/clk.h

+ 4 - 1
drivers/clk/clk.c

@@ -1339,8 +1339,11 @@ static int __clk_speculate_rates(struct clk *clk, unsigned long parent_rate)
 	if (clk->notifier_count)
 	if (clk->notifier_count)
 		ret = __clk_notify(clk, PRE_RATE_CHANGE, clk->rate, new_rate);
 		ret = __clk_notify(clk, PRE_RATE_CHANGE, clk->rate, new_rate);
 
 
-	if (ret & NOTIFY_STOP_MASK)
+	if (ret & NOTIFY_STOP_MASK) {
+		pr_debug("%s: clk notifier callback for clock %s aborted with error %d\n",
+				__func__, clk->name, ret);
 		goto out;
 		goto out;
+	}
 
 
 	hlist_for_each_entry(child, &clk->children, child_node) {
 	hlist_for_each_entry(child, &clk->children, child_node) {
 		ret = __clk_speculate_rates(child, new_rate);
 		ret = __clk_speculate_rates(child, new_rate);

+ 14 - 0
include/linux/clk.h

@@ -78,8 +78,22 @@ struct clk_notifier_data {
 	unsigned long		new_rate;
 	unsigned long		new_rate;
 };
 };
 
 
+/**
+ * clk_notifier_register: register a clock rate-change notifier callback
+ * @clk: clock whose rate we are interested in
+ * @nb: notifier block with callback function pointer
+ *
+ * ProTip: debugging across notifier chains can be frustrating. Make sure that
+ * your notifier callback function prints a nice big warning in case of
+ * failure.
+ */
 int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
 int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
 
 
+/**
+ * clk_notifier_unregister: unregister a clock rate-change notifier callback
+ * @clk: clock whose rate we are no longer interested in
+ * @nb: notifier block which will be unregistered
+ */
 int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
 int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
 
 
 /**
 /**