Commit fddf4e29 authored by Andreas Kemnade's avatar Andreas Kemnade Committed by Tero Kristo
Browse files

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: default avatarAndreas Kemnade <andreas@kemnade.info>
Acked-by: default avatarTony Lindgren <tony@atomide.com>
Tested-by: default avatarKeerthy <j-keerthy@ti.com>
Signed-off-by: default avatarTero Kristo <t-kristo@ti.com>
parent d277ce2d
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -82,11 +82,17 @@ 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);

	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;
}

/**
 * omap2_clk_allow_idle - enable autoidle on an OMAP clock
 * @clk: struct clk * to enable autoidle for
@@ -95,11 +101,17 @@ 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 -EINVAL;
}

static void _allow_autoidle(struct clk_ti_autoidle *clk)
{
	u32 val;