diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-10-20 14:31:00 -0700 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-10-21 01:33:12 -0400 |
commit | 914f7c31b0bea0ccf3bf474d0b99d803f7985097 (patch) | |
tree | 06c8ff4bf0f12170904bf681ffaedd14f368a7c8 /drivers/cpufreq/cpufreq_userspace.c | |
parent | 95dd722700dc9bbb000d51cab07dde48720e9178 (diff) | |
download | op-kernel-dev-914f7c31b0bea0ccf3bf474d0b99d803f7985097.zip op-kernel-dev-914f7c31b0bea0ccf3bf474d0b99d803f7985097.tar.gz |
[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/cpufreq/cpufreq_userspace.c')
-rw-r--r-- | drivers/cpufreq/cpufreq_userspace.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c index a06c204..2a4eb0b 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, unsigned int event) { unsigned int cpu = policy->cpu; + int rc = 0; + switch (event) { case CPUFREQ_GOV_START: if (!cpu_online(cpu)) return -EINVAL; BUG_ON(!policy->cur); mutex_lock(&userspace_mutex); + rc = sysfs_create_file (&policy->kobj, + &freq_attr_scaling_setspeed.attr); + if (rc) + goto start_out; + cpu_is_managed[cpu] = 1; cpu_min_freq[cpu] = policy->min; cpu_max_freq[cpu] = policy->max; cpu_cur_freq[cpu] = policy->cur; cpu_set_freq[cpu] = policy->cur; - sysfs_create_file (&policy->kobj, &freq_attr_scaling_setspeed.attr); 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]); +start_out: mutex_unlock(&userspace_mutex); break; case CPUFREQ_GOV_STOP: @@ -180,7 +187,7 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy, mutex_unlock(&userspace_mutex); break; } - return 0; + return rc; } |