lkml.org 
[lkml]   [2020]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 3/5] clk: composite: Allow gate ops with only .is_enabled op
Date
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(-)

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
\
 
 \ /
  Last update: 2020-11-26 13:46    [W:0.037 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site