governor.c (6f50fa2a6f1395ad5f59ce7b87730f1f3ea19d76) governor.c (cb5d8c45ab6c3daf8269e550cfb2d5018a876fe3)
1/*
2 * governor.c - governor support
3 *
4 * (C) 2006-2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
5 * Shaohua Li <shaohua.li@intel.com>
6 * Adam Belay <abelay@novell.com>
7 *
8 * This code is licenced under the GPL.

--- 6 unchanged lines hidden (view full) ---

15#include <linux/pm_qos.h>
16
17#include "cpuidle.h"
18
19char param_governor[CPUIDLE_NAME_LEN];
20
21LIST_HEAD(cpuidle_governors);
22struct cpuidle_governor *cpuidle_curr_governor;
1/*
2 * governor.c - governor support
3 *
4 * (C) 2006-2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
5 * Shaohua Li <shaohua.li@intel.com>
6 * Adam Belay <abelay@novell.com>
7 *
8 * This code is licenced under the GPL.

--- 6 unchanged lines hidden (view full) ---

15#include <linux/pm_qos.h>
16
17#include "cpuidle.h"
18
19char param_governor[CPUIDLE_NAME_LEN];
20
21LIST_HEAD(cpuidle_governors);
22struct cpuidle_governor *cpuidle_curr_governor;
23struct cpuidle_governor *cpuidle_prev_governor;
23
24/**
24
25/**
25 * __cpuidle_find_governor - finds a governor of the specified name
26 * cpuidle_find_governor - finds a governor of the specified name
26 * @str: the name
27 *
28 * Must be called with cpuidle_lock acquired.
29 */
27 * @str: the name
28 *
29 * Must be called with cpuidle_lock acquired.
30 */
30static struct cpuidle_governor * __cpuidle_find_governor(const char *str)
31struct cpuidle_governor *cpuidle_find_governor(const char *str)
31{
32 struct cpuidle_governor *gov;
33
34 list_for_each_entry(gov, &cpuidle_governors, governor_list)
35 if (!strncasecmp(str, gov->name, CPUIDLE_NAME_LEN))
36 return gov;
37
38 return NULL;

--- 43 unchanged lines hidden (view full) ---

82
83 if (!gov || !gov->select)
84 return -EINVAL;
85
86 if (cpuidle_disabled())
87 return -ENODEV;
88
89 mutex_lock(&cpuidle_lock);
32{
33 struct cpuidle_governor *gov;
34
35 list_for_each_entry(gov, &cpuidle_governors, governor_list)
36 if (!strncasecmp(str, gov->name, CPUIDLE_NAME_LEN))
37 return gov;
38
39 return NULL;

--- 43 unchanged lines hidden (view full) ---

83
84 if (!gov || !gov->select)
85 return -EINVAL;
86
87 if (cpuidle_disabled())
88 return -ENODEV;
89
90 mutex_lock(&cpuidle_lock);
90 if (__cpuidle_find_governor(gov->name) == NULL) {
91 if (cpuidle_find_governor(gov->name) == NULL) {
91 ret = 0;
92 list_add_tail(&gov->governor_list, &cpuidle_governors);
93 if (!cpuidle_curr_governor ||
94 !strncasecmp(param_governor, gov->name, CPUIDLE_NAME_LEN) ||
95 (cpuidle_curr_governor->rating < gov->rating &&
96 strncasecmp(param_governor, cpuidle_curr_governor->name,
97 CPUIDLE_NAME_LEN)))
98 cpuidle_switch_governor(gov);

--- 18 unchanged lines hidden ---
92 ret = 0;
93 list_add_tail(&gov->governor_list, &cpuidle_governors);
94 if (!cpuidle_curr_governor ||
95 !strncasecmp(param_governor, gov->name, CPUIDLE_NAME_LEN) ||
96 (cpuidle_curr_governor->rating < gov->rating &&
97 strncasecmp(param_governor, cpuidle_curr_governor->name,
98 CPUIDLE_NAME_LEN)))
99 cpuidle_switch_governor(gov);

--- 18 unchanged lines hidden ---