diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-12-07 04:57:19 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-12-07 04:57:19 -0500 |
commit | 8d1413b28033c49c7f1a4d320e815d7a5531acee (patch) | |
tree | b37281abef014cd60803b81c100388d7a475d49e /drivers/cpufreq | |
parent | ed25ffa16434724f5ed825aa48734c7f3aefa203 (diff) | |
parent | 620034c84d1d939717bdfbe02c51a3fee43541c3 (diff) |
Merge branch 'master' into upstream
Conflicts:
drivers/net/netxen/netxen_nic.h
drivers/net/netxen/netxen_nic_main.c
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 10 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_conservative.c | 7 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 28 |
3 files changed, 26 insertions, 19 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index dd0c2623e27b..7a7c6e6dfe4f 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -42,7 +42,7 @@ static DEFINE_SPINLOCK(cpufreq_driver_lock); | |||
42 | 42 | ||
43 | /* internal prototypes */ | 43 | /* internal prototypes */ |
44 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); | 44 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); |
45 | static void handle_update(void *data); | 45 | static void handle_update(struct work_struct *work); |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Two notifier lists: the "policy" list is involved in the | 48 | * Two notifier lists: the "policy" list is involved in the |
@@ -665,7 +665,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
665 | mutex_init(&policy->lock); | 665 | mutex_init(&policy->lock); |
666 | mutex_lock(&policy->lock); | 666 | mutex_lock(&policy->lock); |
667 | init_completion(&policy->kobj_unregister); | 667 | init_completion(&policy->kobj_unregister); |
668 | INIT_WORK(&policy->update, handle_update, (void *)(long)cpu); | 668 | INIT_WORK(&policy->update, handle_update); |
669 | 669 | ||
670 | /* call driver. From then on the cpufreq must be able | 670 | /* call driver. From then on the cpufreq must be able |
671 | * to accept all calls to ->verify and ->setpolicy for this CPU | 671 | * to accept all calls to ->verify and ->setpolicy for this CPU |
@@ -895,9 +895,11 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
895 | } | 895 | } |
896 | 896 | ||
897 | 897 | ||
898 | static void handle_update(void *data) | 898 | static void handle_update(struct work_struct *work) |
899 | { | 899 | { |
900 | unsigned int cpu = (unsigned int)(long)data; | 900 | struct cpufreq_policy *policy = |
901 | container_of(work, struct cpufreq_policy, update); | ||
902 | unsigned int cpu = policy->cpu; | ||
901 | dprintk("handle_update for cpu %u called\n", cpu); | 903 | dprintk("handle_update for cpu %u called\n", cpu); |
902 | cpufreq_update_policy(cpu); | 904 | cpufreq_update_policy(cpu); |
903 | } | 905 | } |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index c4c578defabf..5ef5ede5b884 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -59,7 +59,7 @@ static unsigned int def_sampling_rate; | |||
59 | #define MAX_SAMPLING_DOWN_FACTOR (10) | 59 | #define MAX_SAMPLING_DOWN_FACTOR (10) |
60 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) | 60 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) |
61 | 61 | ||
62 | static void do_dbs_timer(void *data); | 62 | static void do_dbs_timer(struct work_struct *work); |
63 | 63 | ||
64 | struct cpu_dbs_info_s { | 64 | struct cpu_dbs_info_s { |
65 | struct cpufreq_policy *cur_policy; | 65 | struct cpufreq_policy *cur_policy; |
@@ -82,7 +82,7 @@ static unsigned int dbs_enable; /* number of CPUs using this policy */ | |||
82 | * is recursive for the same process. -Venki | 82 | * is recursive for the same process. -Venki |
83 | */ | 83 | */ |
84 | static DEFINE_MUTEX (dbs_mutex); | 84 | static DEFINE_MUTEX (dbs_mutex); |
85 | static DECLARE_WORK (dbs_work, do_dbs_timer, NULL); | 85 | static DECLARE_DELAYED_WORK(dbs_work, do_dbs_timer); |
86 | 86 | ||
87 | struct dbs_tuners { | 87 | struct dbs_tuners { |
88 | unsigned int sampling_rate; | 88 | unsigned int sampling_rate; |
@@ -420,7 +420,7 @@ static void dbs_check_cpu(int cpu) | |||
420 | } | 420 | } |
421 | } | 421 | } |
422 | 422 | ||
423 | static void do_dbs_timer(void *data) | 423 | static void do_dbs_timer(struct work_struct *work) |
424 | { | 424 | { |
425 | int i; | 425 | int i; |
426 | lock_cpu_hotplug(); | 426 | lock_cpu_hotplug(); |
@@ -435,7 +435,6 @@ static void do_dbs_timer(void *data) | |||
435 | 435 | ||
436 | static inline void dbs_timer_init(void) | 436 | static inline void dbs_timer_init(void) |
437 | { | 437 | { |
438 | INIT_WORK(&dbs_work, do_dbs_timer, NULL); | ||
439 | schedule_delayed_work(&dbs_work, | 438 | schedule_delayed_work(&dbs_work, |
440 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); | 439 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); |
441 | return; | 440 | return; |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index bf8aa45d4f01..e1cc5113c2ae 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -47,13 +47,17 @@ static unsigned int def_sampling_rate; | |||
47 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) | 47 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) |
48 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) | 48 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) |
49 | 49 | ||
50 | static void do_dbs_timer(void *data); | 50 | static void do_dbs_timer(struct work_struct *work); |
51 | |||
52 | /* Sampling types */ | ||
53 | enum dbs_sample {DBS_NORMAL_SAMPLE, DBS_SUB_SAMPLE}; | ||
51 | 54 | ||
52 | struct cpu_dbs_info_s { | 55 | struct cpu_dbs_info_s { |
53 | cputime64_t prev_cpu_idle; | 56 | cputime64_t prev_cpu_idle; |
54 | cputime64_t prev_cpu_wall; | 57 | cputime64_t prev_cpu_wall; |
55 | struct cpufreq_policy *cur_policy; | 58 | struct cpufreq_policy *cur_policy; |
56 | struct work_struct work; | 59 | struct delayed_work work; |
60 | enum dbs_sample sample_type; | ||
57 | unsigned int enable; | 61 | unsigned int enable; |
58 | struct cpufreq_frequency_table *freq_table; | 62 | struct cpufreq_frequency_table *freq_table; |
59 | unsigned int freq_lo; | 63 | unsigned int freq_lo; |
@@ -407,30 +411,31 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) | |||
407 | } | 411 | } |
408 | } | 412 | } |
409 | 413 | ||
410 | /* Sampling types */ | 414 | static void do_dbs_timer(struct work_struct *work) |
411 | enum {DBS_NORMAL_SAMPLE, DBS_SUB_SAMPLE}; | ||
412 | |||
413 | static void do_dbs_timer(void *data) | ||
414 | { | 415 | { |
415 | unsigned int cpu = smp_processor_id(); | 416 | unsigned int cpu = smp_processor_id(); |
416 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu); | 417 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu); |
418 | enum dbs_sample sample_type = dbs_info->sample_type; | ||
417 | /* We want all CPUs to do sampling nearly on same jiffy */ | 419 | /* We want all CPUs to do sampling nearly on same jiffy */ |
418 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); | 420 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); |
421 | |||
422 | /* Permit rescheduling of this work item */ | ||
423 | work_release(work); | ||
424 | |||
419 | delay -= jiffies % delay; | 425 | delay -= jiffies % delay; |
420 | 426 | ||
421 | if (!dbs_info->enable) | 427 | if (!dbs_info->enable) |
422 | return; | 428 | return; |
423 | /* Common NORMAL_SAMPLE setup */ | 429 | /* Common NORMAL_SAMPLE setup */ |
424 | INIT_WORK(&dbs_info->work, do_dbs_timer, (void *)DBS_NORMAL_SAMPLE); | 430 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; |
425 | if (!dbs_tuners_ins.powersave_bias || | 431 | if (!dbs_tuners_ins.powersave_bias || |
426 | (unsigned long) data == DBS_NORMAL_SAMPLE) { | 432 | sample_type == DBS_NORMAL_SAMPLE) { |
427 | lock_cpu_hotplug(); | 433 | lock_cpu_hotplug(); |
428 | dbs_check_cpu(dbs_info); | 434 | dbs_check_cpu(dbs_info); |
429 | unlock_cpu_hotplug(); | 435 | unlock_cpu_hotplug(); |
430 | if (dbs_info->freq_lo) { | 436 | if (dbs_info->freq_lo) { |
431 | /* Setup timer for SUB_SAMPLE */ | 437 | /* Setup timer for SUB_SAMPLE */ |
432 | INIT_WORK(&dbs_info->work, do_dbs_timer, | 438 | dbs_info->sample_type = DBS_SUB_SAMPLE; |
433 | (void *)DBS_SUB_SAMPLE); | ||
434 | delay = dbs_info->freq_hi_jiffies; | 439 | delay = dbs_info->freq_hi_jiffies; |
435 | } | 440 | } |
436 | } else { | 441 | } else { |
@@ -449,7 +454,8 @@ static inline void dbs_timer_init(unsigned int cpu) | |||
449 | delay -= jiffies % delay; | 454 | delay -= jiffies % delay; |
450 | 455 | ||
451 | ondemand_powersave_bias_init(); | 456 | ondemand_powersave_bias_init(); |
452 | INIT_WORK(&dbs_info->work, do_dbs_timer, NULL); | 457 | INIT_DELAYED_WORK_NAR(&dbs_info->work, do_dbs_timer); |
458 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; | ||
453 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay); | 459 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay); |
454 | } | 460 | } |
455 | 461 | ||