clk: fixed: Add comment to clk_fixed_set_rate
authorDaniel Thompson <daniel.thompson@linaro.org>
Wed, 10 Jun 2015 20:04:54 +0000 (21:04 +0100)
committerStephen Boyd <sboyd@codeaurora.org>
Wed, 10 Jun 2015 21:19:43 +0000 (14:19 -0700)
Currently it is not made explicit why clk_fixed_set_rate() can ignore
its arguments and unconditionally return success. Add a comment
to explain this.

We also mark the clk_ops table const since it should never be
modified at runtime.

Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/clk-fixed-factor.c
include/linux/clk-provider.h

index e186db263d5ea8fde61f94f1428c7e2c57eebab4..fccabe497f6e5db42f6585acd9ecb1c4440bcb4e 100644 (file)
@@ -55,10 +55,16 @@ static long clk_factor_round_rate(struct clk_hw *hw, unsigned long rate,
 static int clk_factor_set_rate(struct clk_hw *hw, unsigned long rate,
                                unsigned long parent_rate)
 {
+       /*
+        * We must report success but we can do so unconditionally because
+        * clk_factor_round_rate returns values that ensure this call is a
+        * nop.
+        */
+
        return 0;
 }
 
-struct clk_ops clk_fixed_factor_ops = {
+const struct clk_ops clk_fixed_factor_ops = {
        .round_rate = clk_factor_round_rate,
        .set_rate = clk_factor_set_rate,
        .recalc_rate = clk_factor_recalc_rate,
index 2e5df069ca34cf328b61de10104b4401c16a52d1..4a943d13625b2a0f1721148e45f52e92596b5483 100644 (file)
@@ -459,7 +459,7 @@ struct clk_fixed_factor {
        unsigned int    div;
 };
 
-extern struct clk_ops clk_fixed_factor_ops;
+extern const struct clk_ops clk_fixed_factor_ops;
 struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
                const char *parent_name, unsigned long flags,
                unsigned int mult, unsigned int div);