diff options
author | Sai Gurrappadi <sgurrappadi@nvidia.com> | 2014-05-22 15:06:06 -0700 |
---|---|---|
committer | Riham Haidar <rhaidar@nvidia.com> | 2014-05-27 19:24:25 -0700 |
commit | e30ddfe3996be5159dc71763c3c260ca836cd71d (patch) | |
tree | 579df4edc0627f9369c2b0eae9293a454a050dde /kernel | |
parent | cf4af0aee12c2a9be2f4f985862fa9154d867f99 (diff) |
PM QoS: Fix pmqos notifiers in pm_qos_enabled_set
Send out the notifiers if the enabled flag has been changed. This will
ensure that the notifier fires in all cases.
Bug 1516219
Change-Id: Ie97422f61a9ad56f0ce194a99ce69193d429eadc
Signed-off-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
Reviewed-on: http://git-master/r/413433
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/qos.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 0e53f4cd4dbc..d9b07e2ca213 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c @@ -1149,7 +1149,6 @@ EXPORT_SYMBOL_GPL(pm_qos_read_max_bound); static int pm_qos_enabled_set(const char *arg, const struct kernel_param *kp) { bool old; - s32 prev[PM_QOS_NUM_CLASSES], curr[PM_QOS_NUM_CLASSES]; int ret, i; struct pm_qos_constraints *c; struct pm_qos_bounded_constraint *parent; @@ -1161,33 +1160,31 @@ static int pm_qos_enabled_set(const char *arg, const struct kernel_param *kp) __FUNCTION__, arg); return ret; } + mutex_lock(&pm_qos_lock); + for (i = 1; i < PM_QOS_NUM_CLASSES; i++) { c = pm_qos_array[i]->constraints; - prev[i] = pm_qos_read_value(c); - if (c->parent_class) { int class = c->parent_class; parent = pm_qos_bounded_obj_array[class]->bounds; pm_qos_set_bounded_targets(parent); - curr[i] = pm_qos_read_value(c); } else if (old && !pm_qos_enabled) { /* got disabled */ - curr[i] = c->default_value; - pm_qos_set_value(pm_qos_array[i]->constraints, curr[i]); + pm_qos_set_value(c, c->default_value); } else if (!old && pm_qos_enabled) { /* got enabled */ - curr[i] = pm_qos_get_value(c); - pm_qos_set_value(pm_qos_array[i]->constraints, curr[i]); + pm_qos_set_value(c, pm_qos_get_value(c)); } + + if (old != pm_qos_enabled) + blocking_notifier_call_chain(c->notifiers, + (unsigned long)pm_qos_read_value(c), + NULL); } - for (i = 1; i < PM_QOS_NUM_CLASSES; i++) - if (prev[i] != curr[i]) - blocking_notifier_call_chain( - pm_qos_array[i]->constraints->notifiers, - (unsigned long)curr[i], - NULL); + mutex_unlock(&pm_qos_lock); + return ret; } |