aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-12-19 16:17:01 -0500
committerJean Delvare <khali@endymion.delvare>2012-12-19 16:17:01 -0500
commit2cece01ffd622ab65a4f5a6704e3a74c1174d2fa (patch)
tree80ca67d24770743381e423f157f192e8a03bc1fa /drivers
parent929c6a5696f5efe7f4213cf9d8b12144a0c0c650 (diff)
hwmon: (it87) Replace macro defining tempX_type sensors with direct definitions
The macro name show_sensor_offset is confusing since it related to the sensor type, not an offset - even more so when we introduce offset attributes later on. Replace it with direct definitions, and replace the show_sensor/set_sensor function names with show_temp_type/set_temp_type. This also resolves a checkpatch error. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/it87.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 79a1229d3499..21fb7f24152c 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -576,8 +576,8 @@ static SENSOR_DEVICE_ATTR_2(temp3_min, S_IRUGO | S_IWUSR, show_temp, set_temp,
576static SENSOR_DEVICE_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp, set_temp, 576static SENSOR_DEVICE_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp, set_temp,
577 2, 2); 577 2, 2);
578 578
579static ssize_t show_sensor(struct device *dev, struct device_attribute *attr, 579static ssize_t show_temp_type(struct device *dev, struct device_attribute *attr,
580 char *buf) 580 char *buf)
581{ 581{
582 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 582 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
583 int nr = sensor_attr->index; 583 int nr = sensor_attr->index;
@@ -590,8 +590,9 @@ static ssize_t show_sensor(struct device *dev, struct device_attribute *attr,
590 return sprintf(buf, "4\n"); /* thermistor */ 590 return sprintf(buf, "4\n"); /* thermistor */
591 return sprintf(buf, "0\n"); /* disabled */ 591 return sprintf(buf, "0\n"); /* disabled */
592} 592}
593static ssize_t set_sensor(struct device *dev, struct device_attribute *attr, 593
594 const char *buf, size_t count) 594static ssize_t set_temp_type(struct device *dev, struct device_attribute *attr,
595 const char *buf, size_t count)
595{ 596{
596 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); 597 struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
597 int nr = sensor_attr->index; 598 int nr = sensor_attr->index;
@@ -626,13 +627,13 @@ static ssize_t set_sensor(struct device *dev, struct device_attribute *attr,
626 mutex_unlock(&data->update_lock); 627 mutex_unlock(&data->update_lock);
627 return count; 628 return count;
628} 629}
629#define show_sensor_offset(offset) \
630static SENSOR_DEVICE_ATTR(temp##offset##_type, S_IRUGO | S_IWUSR, \
631 show_sensor, set_sensor, offset - 1);
632 630
633show_sensor_offset(1); 631static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO | S_IWUSR, show_temp_type,
634show_sensor_offset(2); 632 set_temp_type, 0);
635show_sensor_offset(3); 633static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO | S_IWUSR, show_temp_type,
634 set_temp_type, 1);
635static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO | S_IWUSR, show_temp_type,
636 set_temp_type, 2);
636 637
637/* 3 Fans */ 638/* 3 Fans */
638 639