diff options
| author | Andreas Kemnade <andreas@kemnade.info> | 2019-01-16 17:04:28 -0500 |
|---|---|---|
| committer | Tero Kristo <t-kristo@ti.com> | 2019-02-15 09:47:55 -0500 |
| commit | fddf4e29a6ce97d693e2a2e759f495ddc4ac2474 (patch) | |
| tree | ca7c9ca8141252582abaa10865bdfe81e8d120a6 | |
| parent | d277ce2d3a75c6c116a6119c3745694f5941eff5 (diff) | |
clk: ti: check clock type before doing autoidle ops
Code might use autoidle api with clocks not being omap2 clocks,
so check if clock type is really omap2.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
| -rw-r--r-- | drivers/clk/ti/autoidle.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c index 964e97b5478a..1cae226759dd 100644 --- a/drivers/clk/ti/autoidle.c +++ b/drivers/clk/ti/autoidle.c | |||
| @@ -82,9 +82,15 @@ static int _omap2_clk_allow_idle(struct clk_hw_omap *clk) | |||
| 82 | */ | 82 | */ |
| 83 | int omap2_clk_deny_idle(struct clk *clk) | 83 | int omap2_clk_deny_idle(struct clk *clk) |
| 84 | { | 84 | { |
| 85 | struct clk_hw_omap *c = to_clk_hw_omap(__clk_get_hw(clk)); | 85 | struct clk_hw *hw = __clk_get_hw(clk); |
| 86 | 86 | ||
| 87 | return _omap2_clk_deny_idle(c); | 87 | if (omap2_clk_is_hw_omap(hw)) { |
| 88 | struct clk_hw_omap *c = to_clk_hw_omap(hw); | ||
| 89 | |||
| 90 | return _omap2_clk_deny_idle(c); | ||
| 91 | } | ||
| 92 | |||
| 93 | return -EINVAL; | ||
| 88 | } | 94 | } |
| 89 | 95 | ||
| 90 | /** | 96 | /** |
| @@ -95,9 +101,15 @@ int omap2_clk_deny_idle(struct clk *clk) | |||
| 95 | */ | 101 | */ |
| 96 | int omap2_clk_allow_idle(struct clk *clk) | 102 | int omap2_clk_allow_idle(struct clk *clk) |
| 97 | { | 103 | { |
| 98 | struct clk_hw_omap *c = to_clk_hw_omap(__clk_get_hw(clk)); | 104 | struct clk_hw *hw = __clk_get_hw(clk); |
| 105 | |||
| 106 | if (omap2_clk_is_hw_omap(hw)) { | ||
| 107 | struct clk_hw_omap *c = to_clk_hw_omap(hw); | ||
| 108 | |||
| 109 | return _omap2_clk_allow_idle(c); | ||
| 110 | } | ||
| 99 | 111 | ||
| 100 | return _omap2_clk_allow_idle(c); | 112 | return -EINVAL; |
| 101 | } | 113 | } |
| 102 | 114 | ||
| 103 | static void _allow_autoidle(struct clk_ti_autoidle *clk) | 115 | static void _allow_autoidle(struct clk_ti_autoidle *clk) |
