/* Maximum number of power modes manageable per cpu */
#define MAX_MODE 5
-/* Iterator for power mode */
-#define for_each_mode(mode, array, pos) \
- for ((pos) = 0, (mode) = (array)[0]; \
- (mode) = (array)[(pos)], \
- (pos) < MAX_MODE; (pos)++)
-
/*
* Main struct of CPUPM
* Each cpu has its own data structure and main purpose of this struct is to
{
struct exynos_cpupm *pm;
struct power_mode *mode;
- int pos;
+ int i;
spin_lock(&cpupm_lock);
pm = &per_cpu(cpupm, cpu);
- for_each_mode(mode, pm->modes, pos) {
+ for (i = 0; i < MAX_MODE; i++) {
+ mode = pm->modes[i];
+
if (IS_NULL(mode))
break;
{
struct exynos_cpupm *pm;
struct power_mode *mode;
- int pos;
+ int i;
spin_lock(&cpupm_lock);
pm = &per_cpu(cpupm, cpu);
- for_each_mode(mode, pm->modes, pos) {
+ for (i = 0; i < MAX_MODE; i++) {
+ mode = pm->modes[i];
if (IS_NULL(mode))
break;
{
struct exynos_cpupm *pm;
struct power_mode *mode;
- int pos;
+ int i;
spin_lock(&cpupm_lock);
pm = &per_cpu(cpupm, cpu);
set_state_powerdown(pm);
/* Try to enter power mode */
- for_each_mode(mode, pm->modes, pos) {
+ for (i = 0; i < MAX_MODE; i++) {
+ mode = pm->modes[i];
if (IS_NULL(mode))
break;
{
struct exynos_cpupm *pm;
struct power_mode *mode;
- int pos;
+ int i;
spin_lock(&cpupm_lock);
pm = &per_cpu(cpupm, cpu);
/* Make settings to exit from mode */
- for_each_mode(mode, pm->modes, pos) {
+ for (i = 0; i < MAX_MODE; i++) {
+ mode = pm->modes[i];
if (IS_NULL(mode))
break;
add_mode(struct power_mode **modes, struct power_mode *new)
{
struct power_mode *mode;
- int pos;
+ int i;
- for_each_mode(mode, modes, pos) {
+ for (i = 0; i < MAX_MODE; i++) {
+ mode = modes[i];
if (IS_NULL(mode)) {
- modes[pos] = new;
+ modes[i] = new;
return;
}
}