From: Gaurav Sarode Date: Wed, 16 Jul 2014 19:58:40 +0000 (-0700) Subject: ARM: tegra: clock:Fix Sleeping while atomic in LP0 X-Git-Tag: daily-2014.11.07.1_l4t/l4t-r21~81 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/sojka/nv-tegra/linux-3.10.git/commitdiff_plain/ab0d361622b38d6663de3206579caaa6f2de054d ARM: tegra: clock:Fix Sleeping while atomic in LP0 After enabling CONFIG_DEBUG_ATOMIC_SLEEP,during LP0 we see warning regarding sleep in atomic region for clk_enable and clk_disable. To fix this, we need to use clk_enable_locked and clk_disable_locked instead.These functions do not acquire locks. Bug 1534913 Change-Id: I7ca661a8030308107c3467d9d524c79b6ec374e8 Signed-off-by: Gaurav Sarode Reviewed-on: http://git-master/r/438904 (cherry picked from commit 908ff199970a093a022f4434afc1689ba979bfed) Reviewed-on: http://git-master/r/440467 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Matthew Pedro Reviewed-by: Bibek Basu Reviewed-by: Venkat Moganty --- diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c index 76b6594a0ff..a3428d23cff 100644 --- a/arch/arm/mach-tegra/clock.c +++ b/arch/arm/mach-tegra/clock.c @@ -261,7 +261,7 @@ void clk_init(struct clk *c) mutex_unlock(&clock_list_lock); } -static int clk_enable_locked(struct clk *c) +int clk_enable_locked(struct clk *c) { int ret = 0; @@ -296,7 +296,7 @@ static int clk_enable_locked(struct clk *c) return ret; } -static void clk_disable_locked(struct clk *c) +void clk_disable_locked(struct clk *c) { if (c->refcnt == 0) { WARN(1, "Attempting to disable clock %s with refcnt 0", c->name); diff --git a/arch/arm/mach-tegra/clock.h b/arch/arm/mach-tegra/clock.h index 2ed6d117512..2b95bc31f6f 100644 --- a/arch/arm/mach-tegra/clock.h +++ b/arch/arm/mach-tegra/clock.h @@ -382,6 +382,8 @@ long clk_round_rate_locked(struct clk *c, unsigned long rate); int tegra_clk_shared_bus_update(struct clk *c); void tegra3_set_cpu_skipper_delay(int delay); unsigned long tegra_clk_measure_input_freq(void); +int clk_enable_locked(struct clk *c); +void clk_disable_locked(struct clk *c); #ifdef CONFIG_ARCH_TEGRA_2x_SOC static inline bool tegra_clk_is_parent_allowed(struct clk *c, struct clk *p) { return true; } diff --git a/arch/arm/mach-tegra/tegra12_clocks.c b/arch/arm/mach-tegra/tegra12_clocks.c index b96c2a91216..a621bf490e8 100644 --- a/arch/arm/mach-tegra/tegra12_clocks.c +++ b/arch/arm/mach-tegra/tegra12_clocks.c @@ -9678,8 +9678,8 @@ static void tegra12_clk_resume(void) /* emc switched to the new parent by low level code, but ref count and s/w state need to be updated */ - clk_disable(p); - clk_enable(tegra_clk_emc.parent); + clk_disable_locked(p); + clk_enable_locked(tegra_clk_emc.parent); } rate = clk_get_rate_all_locked(&tegra_clk_emc);