Commit 92175044 authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[CPUFREQ] More misc cleanups.

- CPUFREQ_ALL_CPUS is not a valid argument any more, don't mention it
  in include/linux/cpufreq.h
- without a driver->init() function a cpufreq driver isn't even
  loaded, so remove that check in the per-CPU initialization
- whitespace and clarification changes to linux/cpufreq.

All from Dominik again..
parent 77533ee3
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#define CPUFREQ_ALL_CPUS ((NR_CPUS))
/** /**
* cpufreq_parse_policy - parse a policy string * cpufreq_parse_policy - parse a policy string
* @input_string: the string to parse. * @input_string: the string to parse.
......
...@@ -32,17 +32,15 @@ ...@@ -32,17 +32,15 @@
int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
#define CPUFREQ_TRANSITION_NOTIFIER (0) #define CPUFREQ_TRANSITION_NOTIFIER (0)
#define CPUFREQ_POLICY_NOTIFIER (1) #define CPUFREQ_POLICY_NOTIFIER (1)
#define CPUFREQ_ALL_CPUS ((NR_CPUS))
/********************** cpufreq policy notifiers *********************/ /********************** cpufreq policy notifiers *********************/
#define CPUFREQ_POLICY_POWERSAVE (1) #define CPUFREQ_POLICY_POWERSAVE (1)
#define CPUFREQ_POLICY_PERFORMANCE (2) #define CPUFREQ_POLICY_PERFORMANCE (2)
#define CPUFREQ_POLICY_GOVERNOR (3) #define CPUFREQ_POLICY_GOVERNOR (3)
/* Frequency values here are CPU kHz so that hardware which doesn't run /* Frequency values here are CPU kHz so that hardware which doesn't run
* with some frequencies can complain without having to guess what per * with some frequencies can complain without having to guess what per
...@@ -53,31 +51,34 @@ int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); ...@@ -53,31 +51,34 @@ int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
struct cpufreq_governor; struct cpufreq_governor;
#define CPUFREQ_ETERNAL (-1) #define CPUFREQ_ETERNAL (-1)
struct cpufreq_cpuinfo { struct cpufreq_cpuinfo {
unsigned int max_freq; unsigned int max_freq;
unsigned int min_freq; unsigned int min_freq;
unsigned int transition_latency; unsigned int transition_latency; /* in 10^(-9) s */
}; };
struct cpufreq_policy { struct cpufreq_policy {
unsigned int cpu; /* cpu nr or CPUFREQ_ALL_CPUS */ unsigned int cpu; /* cpu nr */
unsigned int min; /* in kHz */ struct cpufreq_cpuinfo cpuinfo;/* see above */
unsigned int max; /* in kHz */
unsigned int cur; /* in kHz, only needed if cpufreq unsigned int min; /* in kHz */
unsigned int max; /* in kHz */
unsigned int cur; /* in kHz, only needed if cpufreq
* governors are used */ * governors are used */
unsigned int policy; /* see above */ unsigned int policy; /* see above */
struct cpufreq_governor *governor; /* see below */ struct cpufreq_governor *governor; /* see below */
struct cpufreq_cpuinfo cpuinfo; /* see above */
struct kobject kobj;
struct semaphore lock; /* CPU ->setpolicy or ->target may struct semaphore lock; /* CPU ->setpolicy or ->target may
only be called once a time */ only be called once a time */
struct kobject kobj;
struct completion kobj_unregister; struct completion kobj_unregister;
}; };
#define CPUFREQ_ADJUST (0) #define CPUFREQ_ADJUST (0)
#define CPUFREQ_INCOMPATIBLE (1) #define CPUFREQ_INCOMPATIBLE (1)
#define CPUFREQ_NOTIFY (2) #define CPUFREQ_NOTIFY (2)
/******************** cpufreq transition notifiers *******************/ /******************** cpufreq transition notifiers *******************/
...@@ -86,7 +87,7 @@ struct cpufreq_policy { ...@@ -86,7 +87,7 @@ struct cpufreq_policy {
#define CPUFREQ_POSTCHANGE (1) #define CPUFREQ_POSTCHANGE (1)
struct cpufreq_freqs { struct cpufreq_freqs {
unsigned int cpu; /* cpu nr or CPUFREQ_ALL_CPUS */ unsigned int cpu; /* cpu nr */
unsigned int old; unsigned int old;
unsigned int new; unsigned int new;
}; };
...@@ -127,11 +128,11 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mu ...@@ -127,11 +128,11 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mu
#define CPUFREQ_GOV_LIMITS 3 #define CPUFREQ_GOV_LIMITS 3
struct cpufreq_governor { struct cpufreq_governor {
char name[CPUFREQ_NAME_LEN]; char name[CPUFREQ_NAME_LEN];
int (*governor) (struct cpufreq_policy *policy, int (*governor) (struct cpufreq_policy *policy,
unsigned int event); unsigned int event);
struct list_head governor_list; struct list_head governor_list;
struct module *owner; struct module *owner;
}; };
/* pass a target to the cpufreq driver /* pass a target to the cpufreq driver
...@@ -156,18 +157,22 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor); ...@@ -156,18 +157,22 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor);
struct freq_attr; struct freq_attr;
struct cpufreq_driver { struct cpufreq_driver {
struct module *owner;
char name[CPUFREQ_NAME_LEN];
struct cpufreq_policy *policy;
/* needed by all drivers */ /* needed by all drivers */
int (*init) (struct cpufreq_policy *policy);
int (*verify) (struct cpufreq_policy *policy); int (*verify) (struct cpufreq_policy *policy);
struct cpufreq_policy *policy;
char name[CPUFREQ_NAME_LEN];
/* define one out of two */ /* define one out of two */
int (*setpolicy) (struct cpufreq_policy *policy); int (*setpolicy) (struct cpufreq_policy *policy);
int (*target) (struct cpufreq_policy *policy, int (*target) (struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq,
unsigned int relation); unsigned int relation);
struct module *owner;
/* optional, for the moment */ /* optional */
int (*init) (struct cpufreq_policy *policy);
int (*exit) (struct cpufreq_policy *policy); int (*exit) (struct cpufreq_policy *policy);
struct freq_attr **attr; struct freq_attr **attr;
}; };
......
...@@ -337,11 +337,9 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) ...@@ -337,11 +337,9 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
*/ */
policy = &cpufreq_driver->policy[cpu]; policy = &cpufreq_driver->policy[cpu];
policy->cpu = cpu; policy->cpu = cpu;
if (cpufreq_driver->init) { ret = cpufreq_driver->init(policy);
ret = cpufreq_driver->init(policy); if (ret)
if (ret) goto out;
goto out;
}
/* set default policy on this CPU */ /* set default policy on this CPU */
down(&cpufreq_driver_sem); down(&cpufreq_driver_sem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment