#define PASS_CPU_STATS_MAX_COUNT 20
-/*
- * FIXME: Current notifier of PASS didn't pass separate user_data parameter
- * on callback function. So, PASS must need global pass_policy instance. This
- * code must be modified after changing PASS's notifier feature.
- */
-static struct pass_policy *policy_pmqos[PASS_RESOURCE_MAX];
-static int num_policy_pmqos = 0;
-
/*
* is_enabled - Check the state of PASS governor
* @policy: instance of pass_policy structure
}
/*
- * pass_notifier_booting_done - Callback function of DEVICE_NOTIFIER_BOOTING_
- * DONE notifier
+ * pass_notifier_booting_done - Callback func of DEVICE_NOTIFIER_BOOTING_DONE
* @data: NULL, this parameter isn't used
+ * @user_data: the instance of struct pass_policy
*/
static int pass_notifier_booting_done(void *data, void *user_data)
{
- int i;
-
- if (num_policy_pmqos == 0)
- return 0;
+ struct pass_policy *policy = user_data;
/* Start PASS governor if 'pass_support' in pass.conf is true */
- for (i = 0; i < num_policy_pmqos; i++) {
- if (policy_pmqos[i]->state == PASS_ON
- && policy_pmqos[i]->governor != NULL) {
- policy_pmqos[i]->governor->update(policy_pmqos[i],
- PASS_GOV_START);
- }
- }
+ if (policy->state == PASS_ON)
+ pass_governor_update(policy, PASS_GOV_START);
return 0;
}
+/*
+ * pass_notifier_pmqos - Callback func of DEVICE_NOTIFIER_PMQOS
+ * @data: the scenario name
+ * @user_data: the instance of struct pass_policy
+ */
static int pass_notifier_pmqos(void *data, void *user_data)
{
- int i;
-
- if (num_policy_pmqos == 0)
- return 0;
+ struct pass_policy *policy = user_data;
- for (i = 0; i < num_policy_pmqos; i++) {
- if (policy_pmqos[i]->state == PASS_ON
- && policy_pmqos[i]->governor != NULL) {
- pass_notifier_pmqos_func(policy_pmqos[i], data);
- }
- }
+ if (policy->state == PASS_ON)
+ pass_notifier_pmqos_func(policy, data);
return 0;
}
register_notifier(DEVICE_NOTIFIER_BOOTING_DONE,
pass_notifier_booting_done, policy);
- /*
- * FIXME: Current notifier of PASS didn't pass separate user_data
- * parameter on callback function. So, PASS must need global pass_policy
- * instance. This code must be modified after changing PASS's
- * notifier feature.
- */
- policy_pmqos[num_policy_pmqos++] = policy;
-
return 0;
}
if (policy->hotplug)
free(policy->hotplug->sequence);
- if (num_policy_pmqos > 0) {
- for (i = 0; i < num_policy_pmqos; i++)
- policy_pmqos[i] = NULL;
- num_policy_pmqos = 0;
- }
-
/* Set pass_policy structure as default value */
policy->pass_cpu_threshold = 0;
policy->up_threshold = 0;