samsung: emc: Fix emc_enabled/disabled bug
authorYoungtae Lee <yt0729.lee@samsung.com>
Fri, 15 Jun 2018 10:11:52 +0000 (19:11 +0900)
committerlakkyung.jung <lakkyung.jung@samsung.com>
Mon, 23 Jul 2018 05:59:37 +0000 (14:59 +0900)
Change-Id: Ie6fd186d2932367b1cfc5f2305d6248cc67eebe7
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
drivers/soc/samsung/exynos-emc.c

index 19ba035a96aa663c90ba8cc24bfd9d05e00bf9e0..89aed239a942269ccea115c5efa3307689664b06 100644 (file)
@@ -960,32 +960,37 @@ static ssize_t store_enabled(struct kobject *kobj,
        return ret ? ret : count;
 }
 
-static void __emc_set_enable(void)
+static void __emc_set_disable(void)
 {
        struct emc_mode *base_mode = emc_get_base_mode();
 
-       exynos_cpuhp_request("EMC", base_mode->cpus, emc.ctrl_type);
+       spin_lock(&emc_lock);
+       emc.enabled = false;
+       emc.user_mode = 0;
        emc.cur_mode = emc.req_mode = base_mode;
        emc.event = 0;
+       smp_wmb();
+       spin_unlock(&emc_lock);
 
-       if (emc.task)
-               kthread_unpark(emc.task);
+       exynos_cpuhp_request("EMC",
+               base_mode->cpus, emc.ctrl_type);
 
-       pr_info("EMC: Start hotplug governor\n");
+       pr_info("EMC: Stop hotplug governor\n");
 }
 
-static void __emc_set_disable(void)
+static void __emc_set_enable(void)
 {
        struct emc_mode *base_mode = emc_get_base_mode();
 
-       if (emc.task)
-               kthread_park(emc.task);
-
-       exynos_cpuhp_request("EMC", base_mode->cpus, emc.ctrl_type);
+       spin_lock(&emc_lock);
+       emc.user_mode = 0;
        emc.cur_mode = emc.req_mode = base_mode;
        emc.event = 0;
+       emc.enabled = true;
+       smp_wmb();
+       spin_unlock(&emc_lock);
 
-       pr_info("EMC: Stop hotplug governor\n");
+       pr_info("EMC: Start hotplug governor\n");
 }
 
 static int emc_set_enable(bool enable)
@@ -1011,8 +1016,6 @@ static int emc_set_enable(bool enable)
                        goto skip;
                }
 
-       emc.enabled = enable;
-       smp_wmb();
        spin_unlock(&emc_lock);
 
        if (start)