From e30ddfe3996be5159dc71763c3c260ca836cd71d Mon Sep 17 00:00:00 2001 From: Sai Gurrappadi Date: Thu, 22 May 2014 15:06:06 -0700 Subject: 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 Reviewed-on: http://git-master/r/413433 Reviewed-by: Automatic_Commit_Validation_User Tested-by: Diwakar Tundlam Reviewed-by: Diwakar Tundlam --- kernel/power/qos.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'kernel') 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; } -- cgit v1.2.3