ddrfreq: complete(&vop_req_completion) must be called after ddrfreq_work is done...
authorcl <cl@rock-chips.com>
Tue, 6 Jan 2015 12:54:14 +0000 (20:54 +0800)
committercl <cl@rock-chips.com>
Tue, 6 Jan 2015 12:54:14 +0000 (20:54 +0800)
Signed-off-by: cl <cl@rock-chips.com>
arch/arm/mach-rockchip/ddr_freq.c

index 9a9713c8f19f8b9683a25ecd63d5f2800cef4aea..15547678e6bbd5432f8bed7c8aa43edbb304a68d 100644 (file)
@@ -67,7 +67,7 @@ enum {
        DEBUG_SUSPEND = 1U << 2,
        DEBUG_VERBOSE = 1U << 3,
 };
-static int debug_mask = DEBUG_DDR;
+static int debug_mask;
 
 module_param(debug_mask, int, S_IRUGO | S_IWUSR | S_IWGRP);
 #define dprintk(mask, fmt, ...) do { if (mask & debug_mask) pr_debug(fmt, ##__VA_ARGS__); } while (0)
@@ -432,17 +432,15 @@ static int ddrfreq_task(void *data)
 
        do {
                status = ddr.sys_status;
+               timeout = ddrfreq_work(status);
+               if (old_status != status)
+                       complete(&ddrfreq_completion);
                if (vop_bandwidth_update_flag) {
                        vop_bandwidth_update_flag = 0;
 #ifdef VOP_REQ_BLOCK
                        complete(&vop_req_completion);
 #endif
                }
-
-               timeout = ddrfreq_work(status);
-               if (old_status != status) {
-                       complete(&ddrfreq_completion);
-               }
                wait_event_freezable_timeout(ddr.wait, vop_bandwidth_update_flag || (status != ddr.sys_status) || kthread_should_stop(), timeout);
                old_status = status;
        } while (!kthread_should_stop());
@@ -636,14 +634,15 @@ static long ddr_freq_ioctl(struct file *file, unsigned int cmd, unsigned long ar
        vop_bandwidth = bpvinfo->bp_vop_size;
        vop_bandwidth_update_jiffies = jiffies;
        vop_req_freq = req_freq_by_vop(vop_bandwidth);
-       if (dvfs_clk_get_rate(ddr.clk_dvfs_node) >= vop_req_freq) {
+       if (dvfs_clk_get_rate(ddr.clk_dvfs_node) >= vop_req_freq)
                ret = 0;
-       }
 
        vop_bandwidth_update_flag = 1;
        wake_up(&ddr.wait);
 #ifdef VOP_REQ_BLOCK
        wait_for_completion(&vop_req_completion);
+       if (dvfs_clk_get_rate(ddr.clk_dvfs_node) >= vop_req_freq)
+               ret = 0;
 #endif
 
        return ret;