Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 508082 | Differences between
and this patch

Collapse All | Expand All

(-)a/drivers/cpuidle/governors/ladder.c (-1 / +11 lines)
Lines 192-195 static int __init init_ladder(void) Link Here
192
	return cpuidle_register_governor(&ladder_governor);
192
	return cpuidle_register_governor(&ladder_governor);
193
}
193
}
194
194
195
postcore_initcall(init_ladder);
195
/**
196
 * exit_ladder - exits the governor
197
 */
198
static void __exit exit_ladder(void)
199
{
200
	cpuidle_unregister_governor(&ladder_governor);
201
}
202
203
MODULE_LICENSE("GPL");
204
module_init(init_ladder);
205
module_exit(exit_ladder);
(-)a/drivers/cpuidle/governors/menu.c (-1 / +11 lines)
Lines 540-543 static int __init init_menu(void) Link Here
540
	return cpuidle_register_governor(&menu_governor);
540
	return cpuidle_register_governor(&menu_governor);
541
}
541
}
542
542
543
postcore_initcall(init_menu);
543
/**
544
 * exit_menu - exits the governor
545
 */
546
static void __exit exit_menu(void)
547
{
548
	cpuidle_unregister_governor(&menu_governor);
549
}
550
551
MODULE_LICENSE("GPL");
552
module_init(init_menu);
553
module_exit(exit_menu);
(-)a/Documentation/cpuidle/governor.txt (+1 lines)
Lines 25-28 kernel configuration and platform will be selected by cpuidle. Link Here
25
25
26
Interfaces:
26
Interfaces:
27
extern int cpuidle_register_governor(struct cpuidle_governor *gov);
27
extern int cpuidle_register_governor(struct cpuidle_governor *gov);
28
extern void cpuidle_unregister_governor(struct cpuidle_governor *gov);
28
struct cpuidle_governor
29
struct cpuidle_governor
(-)a/drivers/cpuidle/governor.c (+43 lines)
Lines 96-98 int cpuidle_register_governor(struct cpuidle_governor *gov) Link Here
96
96
97
	return ret;
97
	return ret;
98
}
98
}
99
100
/**
101
 * cpuidle_replace_governor - find a replacement governor
102
 * @exclude_rating: the rating that will be skipped while looking for
103
 * new governor.
104
 */
105
static struct cpuidle_governor *cpuidle_replace_governor(int exclude_rating)
106
{
107
	struct cpuidle_governor *gov;
108
	struct cpuidle_governor *ret_gov = NULL;
109
	unsigned int max_rating = 0;
110
111
	list_for_each_entry(gov, &cpuidle_governors, governor_list) {
112
		if (gov->rating == exclude_rating)
113
			continue;
114
		if (gov->rating > max_rating) {
115
			max_rating = gov->rating;
116
			ret_gov = gov;
117
		}
118
	}
119
120
	return ret_gov;
121
}
122
123
/**
124
 * cpuidle_unregister_governor - unregisters a governor
125
 * @gov: the governor
126
 */
127
void cpuidle_unregister_governor(struct cpuidle_governor *gov)
128
{
129
	if (!gov)
130
		return;
131
132
	mutex_lock(&cpuidle_lock);
133
	if (gov == cpuidle_curr_governor) {
134
		struct cpuidle_governor *new_gov;
135
		new_gov = cpuidle_replace_governor(gov->rating);
136
		cpuidle_switch_governor(new_gov);
137
	}
138
	list_del(&gov->governor_list);
139
	mutex_unlock(&cpuidle_lock);
140
}
141
(-)a/include/linux/cpuidle.h (+6 lines)
Lines 195-204 struct cpuidle_governor { Link Here
195
};
195
};
196
196
197
#ifdef CONFIG_CPU_IDLE
197
#ifdef CONFIG_CPU_IDLE
198
198
extern int cpuidle_register_governor(struct cpuidle_governor *gov);
199
extern int cpuidle_register_governor(struct cpuidle_governor *gov);
200
extern void cpuidle_unregister_governor(struct cpuidle_governor *gov);
201
199
#else
202
#else
203
200
static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
204
static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
201
{return 0;}
205
{return 0;}
206
static inline void cpuidle_unregister_governor(struct cpuidle_governor *gov) { }
207
202
#endif
208
#endif
203
209
204
#ifdef CONFIG_ARCH_HAS_CPU_RELAX
210
#ifdef CONFIG_ARCH_HAS_CPU_RELAX

Return to bug 508082