sysdev: Pass attribute in sysdev_class attributes show/store
Passing the attribute to the low level IO functions allows all kinds of cleanups, by sharing low level IO code without requiring an own function for every piece of data. Also drivers can extend the attributes with own data fields and use that in the low level function. Similar to sysdev_attributes and normal attributes. This is a tree-wide sweep, converting everything in one go. No functional changes in this patch other than passing the new argument everywhere. Tested on x86, the non x86 parts are uncompiled. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
3d03ba4d1d
commit
c9be0a36f9
|
@ -58,13 +58,16 @@ static ssize_t raw_store(struct sys_device *dev,
|
||||||
static SYSDEV_ATTR(ascii, 0200, NULL, ascii_store);
|
static SYSDEV_ATTR(ascii, 0200, NULL, ascii_store);
|
||||||
static SYSDEV_ATTR(raw, 0200, NULL, raw_store);
|
static SYSDEV_ATTR(raw, 0200, NULL, raw_store);
|
||||||
|
|
||||||
static ssize_t map_seg7_show(struct sysdev_class *class, char *buf)
|
static ssize_t map_seg7_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map));
|
memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map));
|
||||||
return sizeof(txx9_seg7map);
|
return sizeof(txx9_seg7map);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t map_seg7_store(struct sysdev_class *class,
|
static ssize_t map_seg7_store(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
const char *buf, size_t size)
|
const char *buf, size_t size)
|
||||||
{
|
{
|
||||||
if (size != sizeof(txx9_seg7map))
|
if (size != sizeof(txx9_seg7map))
|
||||||
|
|
|
@ -1020,7 +1020,9 @@ out:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t __ref rescan_store(struct sysdev_class *class, const char *buf,
|
static ssize_t __ref rescan_store(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
const char *buf,
|
||||||
size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -1041,7 +1043,9 @@ static ssize_t dispatching_show(struct sysdev_class *class, char *buf)
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t dispatching_store(struct sysdev_class *dev, const char *buf,
|
static ssize_t dispatching_store(struct sysdev_class *dev,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
const char *buf,
|
||||||
size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
int val, rc;
|
int val, rc;
|
||||||
|
|
|
@ -1116,14 +1116,18 @@ static struct sys_device etr_port1_dev = {
|
||||||
/*
|
/*
|
||||||
* ETR class attributes
|
* ETR class attributes
|
||||||
*/
|
*/
|
||||||
static ssize_t etr_stepping_port_show(struct sysdev_class *class, char *buf)
|
static ssize_t etr_stepping_port_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "%i\n", etr_port0.esw.p);
|
return sprintf(buf, "%i\n", etr_port0.esw.p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL);
|
static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL);
|
||||||
|
|
||||||
static ssize_t etr_stepping_mode_show(struct sysdev_class *class, char *buf)
|
static ssize_t etr_stepping_mode_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
char *mode_str;
|
char *mode_str;
|
||||||
|
|
||||||
|
@ -1584,7 +1588,9 @@ static struct sysdev_class stp_sysclass = {
|
||||||
.name = "stp",
|
.name = "stp",
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t stp_ctn_id_show(struct sysdev_class *class, char *buf)
|
static ssize_t stp_ctn_id_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
if (!stp_online)
|
if (!stp_online)
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
|
@ -1594,7 +1600,9 @@ static ssize_t stp_ctn_id_show(struct sysdev_class *class, char *buf)
|
||||||
|
|
||||||
static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL);
|
static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL);
|
||||||
|
|
||||||
static ssize_t stp_ctn_type_show(struct sysdev_class *class, char *buf)
|
static ssize_t stp_ctn_type_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
if (!stp_online)
|
if (!stp_online)
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
|
@ -1603,7 +1611,9 @@ static ssize_t stp_ctn_type_show(struct sysdev_class *class, char *buf)
|
||||||
|
|
||||||
static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL);
|
static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL);
|
||||||
|
|
||||||
static ssize_t stp_dst_offset_show(struct sysdev_class *class, char *buf)
|
static ssize_t stp_dst_offset_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
if (!stp_online || !(stp_info.vbits & 0x2000))
|
if (!stp_online || !(stp_info.vbits & 0x2000))
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
|
@ -1612,7 +1622,9 @@ static ssize_t stp_dst_offset_show(struct sysdev_class *class, char *buf)
|
||||||
|
|
||||||
static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL);
|
static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL);
|
||||||
|
|
||||||
static ssize_t stp_leap_seconds_show(struct sysdev_class *class, char *buf)
|
static ssize_t stp_leap_seconds_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
if (!stp_online || !(stp_info.vbits & 0x8000))
|
if (!stp_online || !(stp_info.vbits & 0x8000))
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
|
@ -1621,7 +1633,9 @@ static ssize_t stp_leap_seconds_show(struct sysdev_class *class, char *buf)
|
||||||
|
|
||||||
static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL);
|
static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL);
|
||||||
|
|
||||||
static ssize_t stp_stratum_show(struct sysdev_class *class, char *buf)
|
static ssize_t stp_stratum_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
if (!stp_online)
|
if (!stp_online)
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
|
@ -1630,7 +1644,9 @@ static ssize_t stp_stratum_show(struct sysdev_class *class, char *buf)
|
||||||
|
|
||||||
static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL);
|
static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL);
|
||||||
|
|
||||||
static ssize_t stp_time_offset_show(struct sysdev_class *class, char *buf)
|
static ssize_t stp_time_offset_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
if (!stp_online || !(stp_info.vbits & 0x0800))
|
if (!stp_online || !(stp_info.vbits & 0x0800))
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
|
@ -1639,7 +1655,9 @@ static ssize_t stp_time_offset_show(struct sysdev_class *class, char *buf)
|
||||||
|
|
||||||
static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL);
|
static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL);
|
||||||
|
|
||||||
static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, char *buf)
|
static ssize_t stp_time_zone_offset_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
if (!stp_online || !(stp_info.vbits & 0x4000))
|
if (!stp_online || !(stp_info.vbits & 0x4000))
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
|
@ -1649,7 +1667,9 @@ static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, char *buf)
|
||||||
static SYSDEV_CLASS_ATTR(time_zone_offset, 0400,
|
static SYSDEV_CLASS_ATTR(time_zone_offset, 0400,
|
||||||
stp_time_zone_offset_show, NULL);
|
stp_time_zone_offset_show, NULL);
|
||||||
|
|
||||||
static ssize_t stp_timing_mode_show(struct sysdev_class *class, char *buf)
|
static ssize_t stp_timing_mode_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
if (!stp_online)
|
if (!stp_online)
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
|
@ -1658,7 +1678,9 @@ static ssize_t stp_timing_mode_show(struct sysdev_class *class, char *buf)
|
||||||
|
|
||||||
static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL);
|
static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL);
|
||||||
|
|
||||||
static ssize_t stp_timing_state_show(struct sysdev_class *class, char *buf)
|
static ssize_t stp_timing_state_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
if (!stp_online)
|
if (!stp_online)
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
|
@ -1667,12 +1689,15 @@ static ssize_t stp_timing_state_show(struct sysdev_class *class, char *buf)
|
||||||
|
|
||||||
static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL);
|
static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL);
|
||||||
|
|
||||||
static ssize_t stp_online_show(struct sysdev_class *class, char *buf)
|
static ssize_t stp_online_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "%i\n", stp_online);
|
return sprintf(buf, "%i\n", stp_online);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t stp_online_store(struct sysdev_class *class,
|
static ssize_t stp_online_store(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
|
|
|
@ -151,7 +151,8 @@ static ssize_t print_cpus_map(char *buf, const struct cpumask *map)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define print_cpus_func(type) \
|
#define print_cpus_func(type) \
|
||||||
static ssize_t print_cpus_##type(struct sysdev_class *class, char *buf) \
|
static ssize_t print_cpus_##type(struct sysdev_class *class, \
|
||||||
|
struct sysdev_class_attribute *attr, char *buf) \
|
||||||
{ \
|
{ \
|
||||||
return print_cpus_map(buf, cpu_##type##_mask); \
|
return print_cpus_map(buf, cpu_##type##_mask); \
|
||||||
} \
|
} \
|
||||||
|
@ -165,7 +166,8 @@ print_cpus_func(present);
|
||||||
/*
|
/*
|
||||||
* Print values for NR_CPUS and offlined cpus
|
* Print values for NR_CPUS and offlined cpus
|
||||||
*/
|
*/
|
||||||
static ssize_t print_cpus_kernel_max(struct sysdev_class *class, char *buf)
|
static ssize_t print_cpus_kernel_max(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1);
|
int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1);
|
||||||
return n;
|
return n;
|
||||||
|
@ -175,7 +177,8 @@ static SYSDEV_CLASS_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL);
|
||||||
/* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */
|
/* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */
|
||||||
unsigned int total_cpus;
|
unsigned int total_cpus;
|
||||||
|
|
||||||
static ssize_t print_cpus_offline(struct sysdev_class *class, char *buf)
|
static ssize_t print_cpus_offline(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
int n = 0, len = PAGE_SIZE-2;
|
int n = 0, len = PAGE_SIZE-2;
|
||||||
cpumask_var_t offline;
|
cpumask_var_t offline;
|
||||||
|
|
|
@ -544,23 +544,29 @@ static ssize_t print_nodes_state(enum node_states state, char *buf)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t print_nodes_possible(struct sysdev_class *class, char *buf)
|
static ssize_t print_nodes_possible(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return print_nodes_state(N_POSSIBLE, buf);
|
return print_nodes_state(N_POSSIBLE, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t print_nodes_online(struct sysdev_class *class, char *buf)
|
static ssize_t print_nodes_online(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
return print_nodes_state(N_ONLINE, buf);
|
return print_nodes_state(N_ONLINE, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t print_nodes_has_normal_memory(struct sysdev_class *class,
|
static ssize_t print_nodes_has_normal_memory(struct sysdev_class *class,
|
||||||
char *buf)
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
return print_nodes_state(N_NORMAL_MEMORY, buf);
|
return print_nodes_state(N_NORMAL_MEMORY, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t print_nodes_has_cpu(struct sysdev_class *class, char *buf)
|
static ssize_t print_nodes_has_cpu(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
return print_nodes_state(N_CPU, buf);
|
return print_nodes_state(N_CPU, buf);
|
||||||
}
|
}
|
||||||
|
@ -573,7 +579,8 @@ static SYSDEV_CLASS_ATTR(has_cpu, 0444, print_nodes_has_cpu, NULL);
|
||||||
|
|
||||||
#ifdef CONFIG_HIGHMEM
|
#ifdef CONFIG_HIGHMEM
|
||||||
static ssize_t print_nodes_has_high_memory(struct sysdev_class *class,
|
static ssize_t print_nodes_has_high_memory(struct sysdev_class *class,
|
||||||
char *buf)
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
return print_nodes_state(N_HIGH_MEMORY, buf);
|
return print_nodes_state(N_HIGH_MEMORY, buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr,
|
||||||
struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr);
|
struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr);
|
||||||
|
|
||||||
if (class_attr->show)
|
if (class_attr->show)
|
||||||
return class_attr->show(class, buffer);
|
return class_attr->show(class, class_attr, buffer);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr,
|
||||||
struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr);
|
struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr);
|
||||||
|
|
||||||
if (class_attr->store)
|
if (class_attr->store)
|
||||||
return class_attr->store(class, buffer, count);
|
return class_attr->store(class, class_attr, buffer, count);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ static int __init cpuidle_sysfs_setup(char *unused)
|
||||||
__setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup);
|
__setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup);
|
||||||
|
|
||||||
static ssize_t show_available_governors(struct sysdev_class *class,
|
static ssize_t show_available_governors(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
ssize_t i = 0;
|
ssize_t i = 0;
|
||||||
|
@ -41,6 +42,7 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_current_driver(struct sysdev_class *class,
|
static ssize_t show_current_driver(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
@ -56,6 +58,7 @@ static ssize_t show_current_driver(struct sysdev_class *class,
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_current_governor(struct sysdev_class *class,
|
static ssize_t show_current_governor(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
@ -71,6 +74,7 @@ static ssize_t show_current_governor(struct sysdev_class *class,
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t store_current_governor(struct sysdev_class *class,
|
static ssize_t store_current_governor(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
char gov_name[CPUIDLE_NAME_LEN];
|
char gov_name[CPUIDLE_NAME_LEN];
|
||||||
|
|
|
@ -41,8 +41,10 @@ struct sysdev_class {
|
||||||
|
|
||||||
struct sysdev_class_attribute {
|
struct sysdev_class_attribute {
|
||||||
struct attribute attr;
|
struct attribute attr;
|
||||||
ssize_t (*show)(struct sysdev_class *, char *);
|
ssize_t (*show)(struct sysdev_class *, struct sysdev_class_attribute *,
|
||||||
ssize_t (*store)(struct sysdev_class *, const char *, size_t);
|
char *);
|
||||||
|
ssize_t (*store)(struct sysdev_class *, struct sysdev_class_attribute *,
|
||||||
|
const char *, size_t);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
|
#define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
|
||||||
|
|
|
@ -5481,13 +5481,16 @@ void __init perf_event_init(void)
|
||||||
register_cpu_notifier(&perf_cpu_nb);
|
register_cpu_notifier(&perf_cpu_nb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t perf_show_reserve_percpu(struct sysdev_class *class, char *buf)
|
static ssize_t perf_show_reserve_percpu(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "%d\n", perf_reserved_percpu);
|
return sprintf(buf, "%d\n", perf_reserved_percpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
perf_set_reserve_percpu(struct sysdev_class *class,
|
perf_set_reserve_percpu(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
const char *buf,
|
const char *buf,
|
||||||
size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
|
@ -5516,13 +5519,17 @@ perf_set_reserve_percpu(struct sysdev_class *class,
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t perf_show_overcommit(struct sysdev_class *class, char *buf)
|
static ssize_t perf_show_overcommit(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
return sprintf(buf, "%d\n", perf_overcommit);
|
return sprintf(buf, "%d\n", perf_overcommit);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
perf_set_overcommit(struct sysdev_class *class, const char *buf, size_t count)
|
perf_set_overcommit(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
int err;
|
int err;
|
||||||
|
|
|
@ -7406,11 +7406,13 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_MC
|
#ifdef CONFIG_SCHED_MC
|
||||||
static ssize_t sched_mc_power_savings_show(struct sysdev_class *class,
|
static ssize_t sched_mc_power_savings_show(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
char *page)
|
char *page)
|
||||||
{
|
{
|
||||||
return sprintf(page, "%u\n", sched_mc_power_savings);
|
return sprintf(page, "%u\n", sched_mc_power_savings);
|
||||||
}
|
}
|
||||||
static ssize_t sched_mc_power_savings_store(struct sysdev_class *class,
|
static ssize_t sched_mc_power_savings_store(struct sysdev_class *class,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
return sched_power_savings_store(buf, count, 0);
|
return sched_power_savings_store(buf, count, 0);
|
||||||
|
@ -7422,11 +7424,13 @@ static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644,
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_SMT
|
#ifdef CONFIG_SCHED_SMT
|
||||||
static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev,
|
static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
char *page)
|
char *page)
|
||||||
{
|
{
|
||||||
return sprintf(page, "%u\n", sched_smt_power_savings);
|
return sprintf(page, "%u\n", sched_smt_power_savings);
|
||||||
}
|
}
|
||||||
static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev,
|
static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev,
|
||||||
|
struct sysdev_class_attribute *attr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
return sched_power_savings_store(buf, count, 1);
|
return sched_power_savings_store(buf, count, 1);
|
||||||
|
|
Loading…
Reference in New Issue