mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 20:33:58 -04:00
Merge "PM / devfreq: Remove dependencies between sysfs nodes and suspend count"
This commit is contained in:
commit
1c13ebd77e
1 changed files with 17 additions and 35 deletions
|
|
@ -888,31 +888,30 @@ EXPORT_SYMBOL(devm_devfreq_remove_device);
|
|||
*/
|
||||
int devfreq_suspend_device(struct devfreq *devfreq)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
if (!devfreq)
|
||||
return -EINVAL;
|
||||
|
||||
event_mutex_lock(devfreq);
|
||||
if (atomic_inc_return(&devfreq->suspend_count) > 1)
|
||||
goto unlock_out;
|
||||
return 0;
|
||||
|
||||
if (devfreq->governor) {
|
||||
event_mutex_lock(devfreq);
|
||||
ret = devfreq->governor->event_handler(devfreq,
|
||||
DEVFREQ_GOV_SUSPEND, NULL);
|
||||
event_mutex_unlock(devfreq);
|
||||
if (ret)
|
||||
goto unlock_out;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (devfreq->suspend_freq) {
|
||||
ret = devfreq_set_target(devfreq, devfreq->suspend_freq, 0);
|
||||
if (ret)
|
||||
goto unlock_out;
|
||||
return ret;
|
||||
}
|
||||
|
||||
unlock_out:
|
||||
event_mutex_unlock(devfreq);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(devfreq_suspend_device);
|
||||
|
||||
|
|
@ -926,31 +925,30 @@ EXPORT_SYMBOL(devfreq_suspend_device);
|
|||
*/
|
||||
int devfreq_resume_device(struct devfreq *devfreq)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
if (!devfreq)
|
||||
return -EINVAL;
|
||||
|
||||
event_mutex_lock(devfreq);
|
||||
if (atomic_dec_return(&devfreq->suspend_count) >= 1)
|
||||
goto unlock_out;
|
||||
return 0;
|
||||
|
||||
if (devfreq->resume_freq) {
|
||||
ret = devfreq_set_target(devfreq, devfreq->resume_freq, 0);
|
||||
if (ret)
|
||||
goto unlock_out;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (devfreq->governor) {
|
||||
event_mutex_lock(devfreq);
|
||||
ret = devfreq->governor->event_handler(devfreq,
|
||||
DEVFREQ_GOV_RESUME, NULL);
|
||||
event_mutex_unlock(devfreq);
|
||||
if (ret)
|
||||
goto unlock_out;
|
||||
return ret;
|
||||
}
|
||||
|
||||
unlock_out:
|
||||
event_mutex_unlock(devfreq);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(devfreq_resume_device);
|
||||
|
||||
|
|
@ -1155,10 +1153,6 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
|
|||
}
|
||||
|
||||
event_mutex_lock(df);
|
||||
if (atomic_read(&df->suspend_count) > 0) {
|
||||
ret = -EINVAL;
|
||||
goto gov_stop_out;
|
||||
}
|
||||
if (df->governor) {
|
||||
ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL);
|
||||
if (ret) {
|
||||
|
|
@ -1275,16 +1269,14 @@ 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);
|
||||
|
|
@ -1305,11 +1297,6 @@ 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) {
|
||||
|
|
@ -1356,11 +1343,6 @@ 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