]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
Fix to be error handled when 10ms delayed for cpu_on
authorcasionwoo <casionwoo@gmail.com>
Tue, 4 Oct 2016 11:04:08 +0000 (20:04 +0900)
committerStefano Stabellini <sstabellini@kernel.org>
Tue, 4 Oct 2016 20:34:02 +0000 (13:34 -0700)
Comment of origin code said "wait max 10 ms until cpu is on"
Origin code expects to print "CPU%d power enable failed", if cpu do not on until 10ms
But actual code do not reach to print even it wait 10 ms (actually it waits 11ms not 10ms)
Because the comparing is like bellow
"if ( timeout-- == 0 )"
So I modified the code to wait 10ms and print the error statement
Let me simulate about origin code and modified code.

Origin code)

timeout    delayed time   timeout
(before while)     (mdelay(1)) (timeout--)
  10     1 9
  9 2 8
  8 3 7
  7 4 6
  6 5 5
  5 6 4
  4 7 3
  3 8 2
  2 9 1
  1 10 0
  0 11 -1

Modified code)

timeout    delayed time   timeout
(before while)     (mdelay(1)) (--timeout)
  10     1 9
  9 2 8
  8 3 7
  7 4 6
  6 5 5
  5 6 4
  4 7 3
  3 8 2
  2 9 1
  1 10 0

Signed-off-by: JEUNGWOO, YOO <casionwoo@gmail.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/platforms/exynos5.c

index c43934f742db8fe109e6aaa470928e63a7d4908b..9edd8665ca7056b4ba74758194f3c5a1da3bb4ec 100644 (file)
@@ -175,10 +175,10 @@ static int exynos5_cpu_power_up(void __iomem *power, int cpu)
         /* wait max 10 ms until cpu is on */
         while ( exynos_cpu_power_state(power, cpu) != S5P_CORE_LOCAL_PWR_EN )
         {
-            if ( timeout-- == 0 )
-                break;
-
             mdelay(1);
+
+            if ( --timeout == 0 )
+                break;
         }
 
         if ( timeout == 0 )