Some composite clocks might be enabled/disabled from outside the
clock framework. So allow the composite clock register successfully
with only the .is_enabled op for gate ops.

Signed-off-by: Abel Vesa <abel.v...@nxp.com>
---
 drivers/clk/clk-composite.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index 2ddb54f..29f00a9 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -278,17 +278,18 @@ static struct clk_hw *__clk_hw_register_composite(struct 
device *dev,
        }
 
        if (gate_hw && gate_ops) {
-               if (!gate_ops->is_enabled || !gate_ops->enable ||
-                   !gate_ops->disable) {
-                       hw = ERR_PTR(-EINVAL);
-                       goto err;
-               }
-
                composite->gate_hw = gate_hw;
                composite->gate_ops = gate_ops;
-               clk_composite_ops->is_enabled = clk_composite_is_enabled;
-               clk_composite_ops->enable = clk_composite_enable;
-               clk_composite_ops->disable = clk_composite_disable;
+               if (gate_ops->is_enabled) {
+                       clk_composite_ops->is_enabled = 
clk_composite_is_enabled;
+               } else {
+                       hw = ERR_PTR(-EINVAL);
+                       goto err;
+               }
+               if (gate_ops->enable)
+                       clk_composite_ops->enable = clk_composite_enable;
+               if (gate_ops->disable)
+                       clk_composite_ops->disable = clk_composite_disable;
        }
 
        init.ops = clk_composite_ops;
-- 
2.7.4

Reply via email to