]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/thermal/thermal_sysfs.c
Merge branch 'pipe-exclusive-wakeup'
[linux.git] / drivers / thermal / thermal_sysfs.c
index 2241ceae7d7f15eaf09fa89ae2423ad470dd839f..aa99edb4dff7dca35439ed9536dee82f1e1c5b8c 100644 (file)
@@ -712,11 +712,14 @@ cur_state_store(struct device *dev, struct device_attribute *attr,
        if ((long)state < 0)
                return -EINVAL;
 
+       mutex_lock(&cdev->lock);
+
        result = cdev->ops->set_cur_state(cdev, state);
-       if (result)
-               return result;
-       thermal_cooling_device_stats_update(cdev, state);
-       return count;
+       if (!result)
+               thermal_cooling_device_stats_update(cdev, state);
+
+       mutex_unlock(&cdev->lock);
+       return result ? result : count;
 }
 
 static struct device_attribute