This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / cpufreq / cpufreq_ondemand.c
index bc31cac..a9320ae 100644 (file)
@@ -10,6 +10,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/smp.h>
@@ -25,6 +26,7 @@
 #include <linux/kmod.h>
 #include <linux/workqueue.h>
 #include <linux/jiffies.h>
+#include <linux/config.h>
 #include <linux/kernel_stat.h>
 #include <linux/percpu.h>
 
@@ -81,7 +83,7 @@ struct dbs_tuners {
        unsigned int            down_threshold;
 };
 
-static struct dbs_tuners dbs_tuners_ins = {
+struct dbs_tuners dbs_tuners_ins = {
        .up_threshold           = DEF_FREQUENCY_UP_THRESHOLD,
        .down_threshold         = DEF_FREQUENCY_DOWN_THRESHOLD,
        .sampling_down_factor   = DEF_SAMPLING_DOWN_FACTOR,
@@ -99,8 +101,10 @@ static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf)
 }
 
 #define define_one_ro(_name)                                   \
-static struct freq_attr _name =                                \
-__ATTR(_name, 0444, show_##_name, NULL)
+static struct freq_attr _name = {                              \
+       .attr = { .name = __stringify(_name), .mode = 0444 },   \
+       .show = show_##_name,                                   \
+}
 
 define_one_ro(sampling_rate_max);
 define_one_ro(sampling_rate_min);
@@ -123,13 +127,13 @@ static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused,
        unsigned int input;
        int ret;
        ret = sscanf (buf, "%u", &input);
+       down(&dbs_sem);
        if (ret != 1 )
-               return -EINVAL;
+               goto out;
 
-       down(&dbs_sem);
        dbs_tuners_ins.sampling_down_factor = input;
+out:
        up(&dbs_sem);
-
        return count;
 }
 
@@ -139,16 +143,13 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused,
        unsigned int input;
        int ret;
        ret = sscanf (buf, "%u", &input);
-
        down(&dbs_sem);
-       if (ret != 1 || input > MAX_SAMPLING_RATE || input < MIN_SAMPLING_RATE) {
-               up(&dbs_sem);
-               return -EINVAL;
-       }
+       if (ret != 1 || input > MAX_SAMPLING_RATE || input < MIN_SAMPLING_RATE)
+               goto out;
 
        dbs_tuners_ins.sampling_rate = input;
+out:
        up(&dbs_sem);
-
        return count;
 }
 
@@ -158,18 +159,15 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused,
        unsigned int input;
        int ret;
        ret = sscanf (buf, "%u", &input);
-
        down(&dbs_sem);
        if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || 
                        input < MIN_FREQUENCY_UP_THRESHOLD ||
-                       input <= dbs_tuners_ins.down_threshold) {
-               up(&dbs_sem);
-               return -EINVAL;
-       }
+                       input <= dbs_tuners_ins.down_threshold)
+               goto out;
 
        dbs_tuners_ins.up_threshold = input;
+out:
        up(&dbs_sem);
-
        return count;
 }
 
@@ -179,24 +177,24 @@ static ssize_t store_down_threshold(struct cpufreq_policy *unused,
        unsigned int input;
        int ret;
        ret = sscanf (buf, "%u", &input);
-
        down(&dbs_sem);
        if (ret != 1 || input > MAX_FREQUENCY_DOWN_THRESHOLD || 
                        input < MIN_FREQUENCY_DOWN_THRESHOLD ||
-                       input >= dbs_tuners_ins.up_threshold) {
-               up(&dbs_sem);
-               return -EINVAL;
-       }
+                       input >= dbs_tuners_ins.up_threshold)
+               goto out;
 
        dbs_tuners_ins.down_threshold = input;
+out:
        up(&dbs_sem);
-
        return count;
 }
 
-#define define_one_rw(_name) \
-static struct freq_attr _name = \
-__ATTR(_name, 0644, show_##_name, store_##_name)
+#define define_one_rw(_name)                                   \
+static struct freq_attr _name = {                              \
+       .attr = { .name = __stringify(_name), .mode = 0644 },   \
+       .show = show_##_name,                                   \
+       .store = store_##_name,                                 \
+}
 
 define_one_rw(sampling_rate);
 define_one_rw(sampling_down_factor);