Merge tag 'tegra-for-5.2-arm64-soc-fixes' of git://git.kernel.org/pub/scm/linux/kerne...
[platform/kernel/linux-rpi.git] / drivers / clk / clkdev.c
index 6e787cc..2afc8df 100644 (file)
@@ -72,25 +72,26 @@ static struct clk_lookup *clk_find(const char *dev_id, const char *con_id)
        return cl;
 }
 
-static struct clk *__clk_get_sys(struct device *dev, const char *dev_id,
-                                const char *con_id)
+struct clk_hw *clk_find_hw(const char *dev_id, const char *con_id)
 {
        struct clk_lookup *cl;
-       struct clk *clk = NULL;
+       struct clk_hw *hw = ERR_PTR(-ENOENT);
 
        mutex_lock(&clocks_mutex);
-
        cl = clk_find(dev_id, con_id);
-       if (!cl)
-               goto out;
-
-       clk = clk_hw_create_clk(dev, cl->clk_hw, dev_id, con_id);
-       if (IS_ERR(clk))
-               cl = NULL;
-out:
+       if (cl)
+               hw = cl->clk_hw;
        mutex_unlock(&clocks_mutex);
 
-       return cl ? clk : ERR_PTR(-ENOENT);
+       return hw;
+}
+
+static struct clk *__clk_get_sys(struct device *dev, const char *dev_id,
+                                const char *con_id)
+{
+       struct clk_hw *hw = clk_find_hw(dev_id, con_id);
+
+       return clk_hw_create_clk(dev, hw, dev_id, con_id);
 }
 
 struct clk *clk_get_sys(const char *dev_id, const char *con_id)