mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
thermal: Shorten name of sysfs callbacks
The naming isn't consistent across all sysfs callbacks in the thermal core, some have a short name like type_show() and others have long names like thermal_cooling_device_weight_show(). This patch tries to make it consistent by shortening the name of sysfs callbacks. Some of the sysfs files are named similarly for both thermal zone and cooling device (like: type) and to avoid name clash between their show/store routines, the cooling device specific sysfs callbacks are prefixed with "cdev_". Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
This commit is contained in:
parent
771c577c23
commit
33e678d47d
@ -736,7 +736,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
|
||||
sysfs_attr_init(&dev->attr.attr);
|
||||
dev->attr.attr.name = dev->attr_name;
|
||||
dev->attr.attr.mode = 0444;
|
||||
dev->attr.show = thermal_cooling_device_trip_point_show;
|
||||
dev->attr.show = trip_point_show;
|
||||
result = device_create_file(&tz->device, &dev->attr);
|
||||
if (result)
|
||||
goto remove_symbol_link;
|
||||
@ -745,8 +745,8 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
|
||||
sysfs_attr_init(&dev->weight_attr.attr);
|
||||
dev->weight_attr.attr.name = dev->weight_attr_name;
|
||||
dev->weight_attr.attr.mode = S_IWUSR | S_IRUGO;
|
||||
dev->weight_attr.show = thermal_cooling_device_weight_show;
|
||||
dev->weight_attr.store = thermal_cooling_device_weight_store;
|
||||
dev->weight_attr.show = weight_show;
|
||||
dev->weight_attr.store = weight_store;
|
||||
result = device_create_file(&tz->device, &dev->weight_attr);
|
||||
if (result)
|
||||
goto remove_trip_file;
|
||||
|
@ -75,15 +75,10 @@ void thermal_zone_destroy_device_groups(struct thermal_zone_device *);
|
||||
void thermal_cooling_device_setup_sysfs(struct thermal_cooling_device *);
|
||||
void thermal_cooling_device_destroy_sysfs(struct thermal_cooling_device *cdev);
|
||||
/* used only at binding time */
|
||||
ssize_t
|
||||
thermal_cooling_device_trip_point_show(struct device *,
|
||||
struct device_attribute *, char *);
|
||||
ssize_t thermal_cooling_device_weight_show(struct device *,
|
||||
struct device_attribute *, char *);
|
||||
|
||||
ssize_t thermal_cooling_device_weight_store(struct device *,
|
||||
struct device_attribute *,
|
||||
const char *, size_t);
|
||||
ssize_t trip_point_show(struct device *, struct device_attribute *, char *);
|
||||
ssize_t weight_show(struct device *, struct device_attribute *, char *);
|
||||
ssize_t weight_store(struct device *, struct device_attribute *, const char *,
|
||||
size_t);
|
||||
|
||||
#ifdef CONFIG_THERMAL_STATISTICS
|
||||
void thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev,
|
||||
|
@ -668,17 +668,15 @@ void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz)
|
||||
|
||||
/* sys I/F for cooling device */
|
||||
static ssize_t
|
||||
thermal_cooling_device_type_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
cdev_type_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct thermal_cooling_device *cdev = to_cooling_device(dev);
|
||||
|
||||
return sprintf(buf, "%s\n", cdev->type);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
thermal_cooling_device_max_state_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
static ssize_t max_state_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct thermal_cooling_device *cdev = to_cooling_device(dev);
|
||||
unsigned long state;
|
||||
@ -690,9 +688,8 @@ thermal_cooling_device_max_state_show(struct device *dev,
|
||||
return sprintf(buf, "%ld\n", state);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
thermal_cooling_device_cur_state_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
static ssize_t cur_state_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct thermal_cooling_device *cdev = to_cooling_device(dev);
|
||||
unsigned long state;
|
||||
@ -705,9 +702,8 @@ thermal_cooling_device_cur_state_show(struct device *dev,
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
thermal_cooling_device_cur_state_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
cur_state_store(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct thermal_cooling_device *cdev = to_cooling_device(dev);
|
||||
unsigned long state;
|
||||
@ -726,13 +722,10 @@ thermal_cooling_device_cur_state_store(struct device *dev,
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct device_attribute dev_attr_cdev_type =
|
||||
__ATTR(type, 0444, thermal_cooling_device_type_show, NULL);
|
||||
static DEVICE_ATTR(max_state, 0444,
|
||||
thermal_cooling_device_max_state_show, NULL);
|
||||
static DEVICE_ATTR(cur_state, 0644,
|
||||
thermal_cooling_device_cur_state_show,
|
||||
thermal_cooling_device_cur_state_store);
|
||||
static struct device_attribute
|
||||
dev_attr_cdev_type = __ATTR(type, 0444, cdev_type_show, NULL);
|
||||
static DEVICE_ATTR(max_state, 0444, max_state_show, NULL);
|
||||
static DEVICE_ATTR(cur_state, 0644, cur_state_show, cur_state_store);
|
||||
|
||||
static struct attribute *cooling_device_attrs[] = {
|
||||
&dev_attr_cdev_type.attr,
|
||||
@ -791,10 +784,8 @@ unlock:
|
||||
spin_unlock(&stats->lock);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
thermal_cooling_device_total_trans_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
static ssize_t total_trans_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct thermal_cooling_device *cdev = to_cooling_device(dev);
|
||||
struct cooling_dev_stats *stats = cdev->stats;
|
||||
@ -808,9 +799,8 @@ thermal_cooling_device_total_trans_show(struct device *dev,
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
thermal_cooling_device_time_in_state_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
time_in_state_ms_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct thermal_cooling_device *cdev = to_cooling_device(dev);
|
||||
struct cooling_dev_stats *stats = cdev->stats;
|
||||
@ -830,9 +820,8 @@ thermal_cooling_device_time_in_state_show(struct device *dev,
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
thermal_cooling_device_reset_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
reset_store(struct device *dev, struct device_attribute *attr, const char *buf,
|
||||
size_t count)
|
||||
{
|
||||
struct thermal_cooling_device *cdev = to_cooling_device(dev);
|
||||
struct cooling_dev_stats *stats = cdev->stats;
|
||||
@ -853,10 +842,8 @@ thermal_cooling_device_reset_store(struct device *dev,
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
thermal_cooling_device_trans_table_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
static ssize_t trans_table_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct thermal_cooling_device *cdev = to_cooling_device(dev);
|
||||
struct cooling_dev_stats *stats = cdev->stats;
|
||||
@ -899,13 +886,10 @@ thermal_cooling_device_trans_table_show(struct device *dev,
|
||||
return len;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(total_trans, 0444, thermal_cooling_device_total_trans_show,
|
||||
NULL);
|
||||
static DEVICE_ATTR(time_in_state_ms, 0444,
|
||||
thermal_cooling_device_time_in_state_show, NULL);
|
||||
static DEVICE_ATTR(reset, 0200, NULL, thermal_cooling_device_reset_store);
|
||||
static DEVICE_ATTR(trans_table, 0444,
|
||||
thermal_cooling_device_trans_table_show, NULL);
|
||||
static DEVICE_ATTR(total_trans, 0444, total_trans_show, NULL);
|
||||
static DEVICE_ATTR(time_in_state_ms, 0444, time_in_state_ms_show, NULL);
|
||||
static DEVICE_ATTR(reset, 0200, NULL, reset_store);
|
||||
static DEVICE_ATTR(trans_table, 0444, trans_table_show, NULL);
|
||||
|
||||
static struct attribute *cooling_device_stats_attrs[] = {
|
||||
&dev_attr_total_trans.attr,
|
||||
@ -980,8 +964,7 @@ void thermal_cooling_device_destroy_sysfs(struct thermal_cooling_device *cdev)
|
||||
|
||||
/* these helper will be used only at the time of bindig */
|
||||
ssize_t
|
||||
thermal_cooling_device_trip_point_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
trip_point_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct thermal_instance *instance;
|
||||
|
||||
@ -995,8 +978,7 @@ thermal_cooling_device_trip_point_show(struct device *dev,
|
||||
}
|
||||
|
||||
ssize_t
|
||||
thermal_cooling_device_weight_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
weight_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct thermal_instance *instance;
|
||||
|
||||
@ -1005,10 +987,8 @@ thermal_cooling_device_weight_show(struct device *dev,
|
||||
return sprintf(buf, "%d\n", instance->weight);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
thermal_cooling_device_weight_store(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
ssize_t weight_store(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct thermal_instance *instance;
|
||||
int ret, weight;
|
||||
|
Loading…
Reference in New Issue
Block a user