clk: ti: fix linker error with !SOC_OMAP4
authorArnd Bergmann <arnd@arndb.de>
Wed, 19 Apr 2017 21:43:10 +0000 (23:43 +0200)
committerStephen Boyd <sboyd@codeaurora.org>
Sat, 22 Apr 2017 02:01:18 +0000 (19:01 -0700)
When none of the OMAP4-generation SoCs are enabled, we run into a link
error for am43xx/am43xx:

drivers/clk/ti/dpll.o: In function `of_ti_am3_dpll_x2_setup':
dpll.c:(.init.text+0xd8): undefined reference to `clkhwops_omap4_dpllmx'

This is easily fixed by adding another #ifdef.

While looking at the code, I also spotted another problem with the
assignment of hw_ops variable that is not used again later. I'm
changing this to setting clk_hw->ops instead, which I guess is what
was intended here.

Fixes: 473adbf4e028 ("clk: ti: dpll44xx: fix clksel register initialization")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Tero Kristo <t-kristo@ti.com>
[sboyd@codeaurora.org: Replaced fixes tag with correct one]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/ti/dpll.c

index 96d84888c6c54903c5cf6ebb39baad2e757eb4a3..d4e4444bc5ca3687aa07fa1c6c19b8ad77f955d7 100644 (file)
@@ -312,7 +312,6 @@ static void _register_dpll_x2(struct device_node *node,
        struct clk_hw_omap *clk_hw;
        const char *name = node->name;
        const char *parent_name;
-       int ret;
 
        parent_name = of_clk_get_parent_name(node, 0);
        if (!parent_name) {
@@ -332,16 +331,21 @@ static void _register_dpll_x2(struct device_node *node,
        init.parent_names = &parent_name;
        init.num_parents = 1;
 
+#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
+       defined(CONFIG_SOC_DRA7XX)
        if (hw_ops == &clkhwops_omap4_dpllmx) {
+               int ret;
+
                /* Check if register defined, if not, drop hw-ops */
                ret = of_property_count_elems_of_size(node, "reg", 1);
                if (ret <= 0) {
-                       hw_ops = NULL;
+                       clk_hw->ops = NULL;
                } else if (ti_clk_get_reg_addr(node, 0, &clk_hw->clksel_reg)) {
                        kfree(clk_hw);
                        return;
                }
        }
+#endif
 
        /* register the clock */
        clk = ti_clk_register(NULL, &clk_hw->hw, name);