@@ -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;
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.vesa@nxp.com> --- drivers/clk/clk-composite.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)