clk: imx: clk-composite-8m: Switch to clk_hw based API
authorPeng Fan <peng.fan@nxp.com>
Thu, 12 Dec 2019 02:58:48 +0000 (02:58 +0000)
committerShawn Guo <shawnguo@kernel.org>
Mon, 23 Dec 2019 03:50:44 +0000 (11:50 +0800)
Switch the imx8m_clk_hw_composite_flags function to clk_hw based API,
rename accordingly and add a macro for clk based legacy. This allows
us to move closer to a clear split between consumer and provider clk
APIs.

Reviewed-by: Abel Vesa <abel.vesa@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
drivers/clk/imx/clk-composite-8m.c
drivers/clk/imx/clk.h

index 388bdb94f841da0a153cb024346832d282e853b8..e0f25983e80fc7cfa1f9d9f093d253dd993666da 100644 (file)
@@ -123,7 +123,7 @@ static const struct clk_ops imx8m_clk_composite_divider_ops = {
        .set_rate = imx8m_clk_composite_divider_set_rate,
 };
 
-struct clk *imx8m_clk_composite_flags(const char *name,
+struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,
                                        const char * const *parent_names,
                                        int num_parents, void __iomem *reg,
                                        unsigned long flags)
@@ -169,7 +169,7 @@ struct clk *imx8m_clk_composite_flags(const char *name,
        if (IS_ERR(hw))
                goto fail;
 
-       return hw->clk;
+       return hw;
 
 fail:
        kfree(gate);
index caee661664c11a27c2a65d5a0c96c3763893e3e1..46cbac4d89a512e5293dfe4dfbc3b56eb127ae35 100644 (file)
@@ -460,19 +460,34 @@ struct clk_hw *imx_clk_hw_cpu(const char *name, const char *parent_name,
                struct clk *div, struct clk *mux, struct clk *pll,
                struct clk *step);
 
-struct clk *imx8m_clk_composite_flags(const char *name,
-                                       const char * const *parent_names,
-                                       int num_parents, void __iomem *reg,
-                                       unsigned long flags);
-
-#define __imx8m_clk_composite(name, parent_names, reg, flags) \
-       imx8m_clk_composite_flags(name, parent_names, \
+struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,
+                                           const char * const *parent_names,
+                                           int num_parents,
+                                           void __iomem *reg,
+                                           unsigned long flags);
+
+#define imx8m_clk_composite_flags(name, parent_names, num_parents, reg, \
+                                 flags) \
+       to_clk(imx8m_clk_hw_composite_flags(name, parent_names, \
+                               num_parents, reg, flags))
+
+#define __imx8m_clk_hw_composite(name, parent_names, reg, flags) \
+       imx8m_clk_hw_composite_flags(name, parent_names, \
                ARRAY_SIZE(parent_names), reg, \
                flags | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE)
 
+#define __imx8m_clk_composite(name, parent_names, reg, flags) \
+       to_clk(__imx8m_clk_hw_composite(name, parent_names, reg, flags))
+
+#define imx8m_clk_hw_composite(name, parent_names, reg) \
+       __imx8m_clk_hw_composite(name, parent_names, reg, 0)
+
 #define imx8m_clk_composite(name, parent_names, reg) \
        __imx8m_clk_composite(name, parent_names, reg, 0)
 
+#define imx8m_clk_hw_composite_critical(name, parent_names, reg) \
+       __imx8m_clk_hw_composite(name, parent_names, reg, CLK_IS_CRITICAL)
+
 #define imx8m_clk_composite_critical(name, parent_names, reg) \
        __imx8m_clk_composite(name, parent_names, reg, CLK_IS_CRITICAL)