[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190116220429.9136-3-andreas@kemnade.info>
Date: Wed, 16 Jan 2019 23:04:28 +0100
From: Andreas Kemnade <andreas@...nade.info>
To: t-kristo@...com, mturquette@...libre.com, sboyd@...nel.org,
linux-omap@...r.kernel.org, linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org, bcousson@...libre.com,
paul@...an.com, tony@...mide.com, letux-kernel@...nphoenux.org
Cc: Andreas Kemnade <andreas@...nade.info>
Subject: [PATCH v3 2/3] 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@...nade.info>
---
v3: replace CLK_IS_BASIC check
New in v2
drivers/clk/ti/autoidle.c | 20 ++++++++++++++++----
1 file 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)
*/
int omap2_clk_deny_idle(struct clk *clk)
{
- struct clk_hw_omap *c = to_clk_hw_omap(__clk_get_hw(clk));
+ struct clk_hw *hw = __clk_get_hw(clk);
- return _omap2_clk_deny_idle(c);
+ if (omap2_clk_is_hw_omap(hw)) {
+ struct clk_hw_omap *c = to_clk_hw_omap(hw);
+
+ return _omap2_clk_deny_idle(c);
+ }
+
+ return -EINVAL;
}
/**
@@ -95,9 +101,15 @@ int omap2_clk_deny_idle(struct clk *clk)
*/
int omap2_clk_allow_idle(struct clk *clk)
{
- struct clk_hw_omap *c = to_clk_hw_omap(__clk_get_hw(clk));
+ struct clk_hw *hw = __clk_get_hw(clk);
+
+ if (omap2_clk_is_hw_omap(hw)) {
+ struct clk_hw_omap *c = to_clk_hw_omap(hw);
+
+ return _omap2_clk_allow_idle(c);
+ }
- return _omap2_clk_allow_idle(c);
+ return -EINVAL;
}
static void _allow_autoidle(struct clk_ti_autoidle *clk)
--
2.11.0
Powered by blists - more mailing lists