fix BUG: sleeping function called from invalid context at kernel/mutex.c
author陈亮 <cl@rock-chips.com>
Thu, 26 Jun 2014 11:27:24 +0000 (04:27 -0700)
committer陈亮 <cl@rock-chips.com>
Thu, 26 Jun 2014 11:27:42 +0000 (04:27 -0700)
arch/arm/mach-rockchip/dvfs.c

index d6c70be7a862c9aecf9d4330ed3950a3d0589ff9..6b12e0338b3c018c1937f8f971cc4f234f31a8e1 100644 (file)
@@ -62,26 +62,28 @@ static int clk_pd_gpu_notifier_call(struct notifier_block *nb,
 {
        int ret;
 
-       mutex_lock(&switch_vdd_gpu_mutex);
        switch (event) {
        case RK_CLK_PD_PREPARE:
+               mutex_lock(&switch_vdd_gpu_mutex);
                pd_gpu_off = 0;
                if (early_suspend) {
                        if (!regulator_is_enabled(vdd_gpu_regulator))
                                ret = regulator_enable(vdd_gpu_regulator);
                }
+               mutex_unlock(&switch_vdd_gpu_mutex);
                break;
        case RK_CLK_PD_UNPREPARE:
+               mutex_lock(&switch_vdd_gpu_mutex);
                pd_gpu_off = 1;
                if (early_suspend) {
                        if (regulator_is_enabled(vdd_gpu_regulator))
                                ret = regulator_disable(vdd_gpu_regulator);
                }
+               mutex_unlock(&switch_vdd_gpu_mutex);
                break;
        default:
                break;
        }
-       mutex_unlock(&switch_vdd_gpu_mutex);
 
        return NOTIFY_OK;
 }
@@ -136,7 +138,6 @@ static struct notifier_block early_suspend_notifier = {
                .notifier_call = early_suspend_notifier_call,
 };
 
-
 static void dvfs_volt_up_delay(struct vd_node *vd, int new_volt, int old_volt)
 {
        int u_time;