* published by the Free Software Foundation.
*/
+#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/smp.h>
#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>
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,
}
#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);
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;
}
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;
}
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;
}
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);