ARM: tegra: fix warning during LP0
Deepak Nibade [Wed, 11 Sep 2013 09:38:17 +0000 (14:38 +0530)]
- with CONFIG_DEBUG_ATOMIC_SLEEP enabled, below warning was seen
BUG: sleeping function called from invalid context at
/kernel/kernel/mutex.c:85

- function 'tegra_get_clock_by_name()' was being called from
  atomic context in 'tegra_lp0_cpu_mode()'

- move function tegra_get_clock_by_name("cclk_lp")
  to separate init function and call it through subsys_initcall()
  to avoid this warning during LP0

Bug 1355279
Bug 1318641

Change-Id: I42df042051938d75366884946e7f660522f3c26c
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/273034
(cherry picked from commit 9c126a72c41aa66fb9bf394426e331d379aa5c40)
Reviewed-on: http://git-master/r/275055
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sachin Nikam <snikam@nvidia.com>

arch/arm/mach-tegra/pm-t3.c

index a691876..a405bdb 100644 (file)
 #define CLK_RST_CONTROLLER_PLLX_MISC_0 \
        (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0xE4)
 
+static struct clk *cclk_lp;
+
 static int cluster_switch_prolog_clock(unsigned int flags)
 {
        u32 reg;
@@ -651,15 +653,20 @@ void tegra_lp0_resume_mc(void)
        tegra_mc_timing_restore();
 }
 
+static int __init get_clock_cclk_lp(void)
+{
+       if (!cclk_lp)
+               cclk_lp = tegra_get_clock_by_name("cclk_lp");
+       return 0;
+}
+
+subsys_initcall(get_clock_cclk_lp);
+
 void tegra_lp0_cpu_mode(bool enter)
 {
-       static struct clk *cclk_lp;
        static bool entered_on_g = false;
        unsigned int flags;
 
-       if (!cclk_lp)
-               cclk_lp = tegra_get_clock_by_name("cclk_lp");
-
        if (enter)
                entered_on_g = !is_lp_cluster();