aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-10-20 17:31:00 -0400
committerDave Jones <davej@redhat.com>2006-10-21 01:33:12 -0400
commit914f7c31b0bea0ccf3bf474d0b99d803f7985097 (patch)
tree06c8ff4bf0f12170904bf681ffaedd14f368a7c8 /drivers
parent95dd722700dc9bbb000d51cab07dde48720e9178 (diff)
[CPUFREQ] handle sysfs errors
Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c10
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c12
-rw-r--r--drivers/cpufreq/cpufreq_userspace.c11
3 files changed, 29 insertions, 4 deletions
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index c4c578defabf..8fe13ec1e50b 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -453,6 +453,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
453 unsigned int cpu = policy->cpu; 453 unsigned int cpu = policy->cpu;
454 struct cpu_dbs_info_s *this_dbs_info; 454 struct cpu_dbs_info_s *this_dbs_info;
455 unsigned int j; 455 unsigned int j;
456 int rc;
456 457
457 this_dbs_info = &per_cpu(cpu_dbs_info, cpu); 458 this_dbs_info = &per_cpu(cpu_dbs_info, cpu);
458 459
@@ -469,6 +470,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
469 break; 470 break;
470 471
471 mutex_lock(&dbs_mutex); 472 mutex_lock(&dbs_mutex);
473
474 rc = sysfs_create_group(&policy->kobj, &dbs_attr_group);
475 if (rc) {
476 mutex_unlock(&dbs_mutex);
477 return rc;
478 }
479
472 for_each_cpu_mask(j, policy->cpus) { 480 for_each_cpu_mask(j, policy->cpus) {
473 struct cpu_dbs_info_s *j_dbs_info; 481 struct cpu_dbs_info_s *j_dbs_info;
474 j_dbs_info = &per_cpu(cpu_dbs_info, j); 482 j_dbs_info = &per_cpu(cpu_dbs_info, j);
@@ -481,7 +489,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
481 this_dbs_info->enable = 1; 489 this_dbs_info->enable = 1;
482 this_dbs_info->down_skip = 0; 490 this_dbs_info->down_skip = 0;
483 this_dbs_info->requested_freq = policy->cur; 491 this_dbs_info->requested_freq = policy->cur;
484 sysfs_create_group(&policy->kobj, &dbs_attr_group); 492
485 dbs_enable++; 493 dbs_enable++;
486 /* 494 /*
487 * Start the timerschedule work, when this governor 495 * Start the timerschedule work, when this governor
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 291cfe9400a1..cbde076b5715 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -473,6 +473,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
473 unsigned int cpu = policy->cpu; 473 unsigned int cpu = policy->cpu;
474 struct cpu_dbs_info_s *this_dbs_info; 474 struct cpu_dbs_info_s *this_dbs_info;
475 unsigned int j; 475 unsigned int j;
476 int rc;
476 477
477 this_dbs_info = &per_cpu(cpu_dbs_info, cpu); 478 this_dbs_info = &per_cpu(cpu_dbs_info, cpu);
478 479
@@ -501,6 +502,16 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
501 return -ENOSPC; 502 return -ENOSPC;
502 } 503 }
503 } 504 }
505
506 rc = sysfs_create_group(&policy->kobj, &dbs_attr_group);
507 if (rc) {
508 if (dbs_enable == 1)
509 destroy_workqueue(kondemand_wq);
510 dbs_enable--;
511 mutex_unlock(&dbs_mutex);
512 return rc;
513 }
514
504 for_each_cpu_mask(j, policy->cpus) { 515 for_each_cpu_mask(j, policy->cpus) {
505 struct cpu_dbs_info_s *j_dbs_info; 516 struct cpu_dbs_info_s *j_dbs_info;
506 j_dbs_info = &per_cpu(cpu_dbs_info, j); 517 j_dbs_info = &per_cpu(cpu_dbs_info, j);
@@ -510,7 +521,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
510 j_dbs_info->prev_cpu_wall = get_jiffies_64(); 521 j_dbs_info->prev_cpu_wall = get_jiffies_64();
511 } 522 }
512 this_dbs_info->enable = 1; 523 this_dbs_info->enable = 1;
513 sysfs_create_group(&policy->kobj, &dbs_attr_group);
514 /* 524 /*
515 * Start the timerschedule work, when this governor 525 * Start the timerschedule work, when this governor
516 * is used for first time 526 * is used for first time
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
index a06c204589cd..2a4eb0bfaf30 100644
--- a/drivers/cpufreq/cpufreq_userspace.c
+++ b/drivers/cpufreq/cpufreq_userspace.c
@@ -131,19 +131,26 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy,
131 unsigned int event) 131 unsigned int event)
132{ 132{
133 unsigned int cpu = policy->cpu; 133 unsigned int cpu = policy->cpu;
134 int rc = 0;
135
134 switch (event) { 136 switch (event) {
135 case CPUFREQ_GOV_START: 137 case CPUFREQ_GOV_START:
136 if (!cpu_online(cpu)) 138 if (!cpu_online(cpu))
137 return -EINVAL; 139 return -EINVAL;
138 BUG_ON(!policy->cur); 140 BUG_ON(!policy->cur);
139 mutex_lock(&userspace_mutex); 141 mutex_lock(&userspace_mutex);
142 rc = sysfs_create_file (&policy->kobj,
143 &freq_attr_scaling_setspeed.attr);
144 if (rc)
145 goto start_out;
146
140 cpu_is_managed[cpu] = 1; 147 cpu_is_managed[cpu] = 1;
141 cpu_min_freq[cpu] = policy->min; 148 cpu_min_freq[cpu] = policy->min;
142 cpu_max_freq[cpu] = policy->max; 149 cpu_max_freq[cpu] = policy->max;
143 cpu_cur_freq[cpu] = policy->cur; 150 cpu_cur_freq[cpu] = policy->cur;
144 cpu_set_freq[cpu] = policy->cur; 151 cpu_set_freq[cpu] = policy->cur;
145 sysfs_create_file (&policy->kobj, &freq_attr_scaling_setspeed.attr);
146 dprintk("managing cpu %u started (%u - %u kHz, currently %u kHz)\n", cpu, cpu_min_freq[cpu], cpu_max_freq[cpu], cpu_cur_freq[cpu]); 152 dprintk("managing cpu %u started (%u - %u kHz, currently %u kHz)\n", cpu, cpu_min_freq[cpu], cpu_max_freq[cpu], cpu_cur_freq[cpu]);
153start_out:
147 mutex_unlock(&userspace_mutex); 154 mutex_unlock(&userspace_mutex);
148 break; 155 break;
149 case CPUFREQ_GOV_STOP: 156 case CPUFREQ_GOV_STOP:
@@ -180,7 +187,7 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy,
180 mutex_unlock(&userspace_mutex); 187 mutex_unlock(&userspace_mutex);
181 break; 188 break;
182 } 189 }
183 return 0; 190 return rc;
184} 191}
185 192
186 193