mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 04:42:04 -04:00
devfreq: Do not allow tunable updates when device is suspended
Tunables update accesses the monitor's registers for some devices. When the device is suspended, the clocks for those devices are turned off and updating the tunables of a suspended device causes the device to crash. Fix this by checking the flag dev_suspended before allowing the tunable updates. Change-Id: I3a0938edf761a9ea6d39ffeec19f35c228d5c306 Signed-off-by: Rama Aparna Mallavarapu <aparnam@codeaurora.org> [avajid@codeaurora.org: updated to utilize suspend_count from upstream and resolved minor merge conflicts] Signed-off-by: Amir Vajid <avajid@codeaurora.org>
This commit is contained in:
parent
db4f4a0933
commit
5e33579a6a
1 changed files with 15 additions and 3 deletions
|
|
@ -1274,14 +1274,16 @@ static ssize_t polling_interval_store(struct device *dev,
|
|||
unsigned int value;
|
||||
int ret;
|
||||
|
||||
if (!df->governor)
|
||||
return -EINVAL;
|
||||
|
||||
ret = sscanf(buf, "%u", &value);
|
||||
if (ret != 1)
|
||||
return -EINVAL;
|
||||
|
||||
event_mutex_lock(df);
|
||||
if (!df->governor || atomic_read(&df->suspend_count) > 0) {
|
||||
dev_warn(dev, "device suspended, operation not allowed\n");
|
||||
event_mutex_unlock(df);
|
||||
return -EINVAL;
|
||||
}
|
||||
df->governor->event_handler(df, DEVFREQ_GOV_INTERVAL, &value);
|
||||
ret = count;
|
||||
event_mutex_unlock(df);
|
||||
|
|
@ -1302,6 +1304,11 @@ static ssize_t min_freq_store(struct device *dev, struct device_attribute *attr,
|
|||
return -EINVAL;
|
||||
|
||||
event_mutex_lock(df);
|
||||
if (atomic_read(&df->suspend_count) > 0) {
|
||||
dev_warn(dev, "device suspended, min freq not allowed\n");
|
||||
event_mutex_unlock(df);
|
||||
return -EINVAL;
|
||||
}
|
||||
mutex_lock(&df->lock);
|
||||
|
||||
if (value) {
|
||||
|
|
@ -1348,6 +1355,11 @@ static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr,
|
|||
return -EINVAL;
|
||||
|
||||
event_mutex_lock(df);
|
||||
if (atomic_read(&df->suspend_count) > 0) {
|
||||
event_mutex_unlock(df);
|
||||
dev_warn(dev, "device suspended, max freq not allowed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
mutex_lock(&df->lock);
|
||||
|
||||
if (value) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue