diff options
Diffstat (limited to 'drivers/hwmon/pc87427.c')
-rw-r--r-- | drivers/hwmon/pc87427.c | 331 |
1 files changed, 159 insertions, 172 deletions
diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c index dc5a9d5ada51..58eee8fa3e6d 100644 --- a/drivers/hwmon/pc87427.c +++ b/drivers/hwmon/pc87427.c @@ -106,6 +106,13 @@ static const char *logdev_str[2] = { DRVNAME " FMC", DRVNAME " HMC" }; #define LD_IN 1 #define LD_TEMP 1 +static inline int superio_enter(int sioaddr) +{ + if (!request_muxed_region(sioaddr, 2, DRVNAME)) + return -EBUSY; + return 0; +} + static inline void superio_outb(int sioaddr, int reg, int val) { outb(reg, sioaddr); @@ -122,6 +129,7 @@ static inline void superio_exit(int sioaddr) { outb(0x02, sioaddr); outb(0x02, sioaddr + 1); + release_region(sioaddr, 2); } /* @@ -384,8 +392,8 @@ done: return data; } -static ssize_t show_fan_input(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t fan_input_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -393,8 +401,8 @@ static ssize_t show_fan_input(struct device *dev, struct device_attribute return sprintf(buf, "%lu\n", fan_from_reg(data->fan[nr])); } -static ssize_t show_fan_min(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t fan_min_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -402,8 +410,8 @@ static ssize_t show_fan_min(struct device *dev, struct device_attribute return sprintf(buf, "%lu\n", fan_from_reg(data->fan_min[nr])); } -static ssize_t show_fan_alarm(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t fan_alarm_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -412,8 +420,8 @@ static ssize_t show_fan_alarm(struct device *dev, struct device_attribute & FAN_STATUS_LOSPD)); } -static ssize_t show_fan_fault(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t fan_fault_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -422,8 +430,9 @@ static ssize_t show_fan_fault(struct device *dev, struct device_attribute & FAN_STATUS_STALL)); } -static ssize_t set_fan_min(struct device *dev, struct device_attribute - *devattr, const char *buf, size_t count) +static ssize_t fan_min_store(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) { struct pc87427_data *data = dev_get_drvdata(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -449,49 +458,41 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute return count; } -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan_input, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan_input, NULL, 1); -static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan_input, NULL, 2); -static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan_input, NULL, 3); -static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_fan_input, NULL, 4); -static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_fan_input, NULL, 5); -static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_fan_input, NULL, 6); -static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_fan_input, NULL, 7); - -static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 0); -static SENSOR_DEVICE_ATTR(fan2_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 1); -static SENSOR_DEVICE_ATTR(fan3_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 2); -static SENSOR_DEVICE_ATTR(fan4_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 3); -static SENSOR_DEVICE_ATTR(fan5_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 4); -static SENSOR_DEVICE_ATTR(fan6_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 5); -static SENSOR_DEVICE_ATTR(fan7_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 6); -static SENSOR_DEVICE_ATTR(fan8_min, S_IWUSR | S_IRUGO, - show_fan_min, set_fan_min, 7); - -static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_fan_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_fan_alarm, NULL, 4); -static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_fan_alarm, NULL, 5); -static SENSOR_DEVICE_ATTR(fan7_alarm, S_IRUGO, show_fan_alarm, NULL, 6); -static SENSOR_DEVICE_ATTR(fan8_alarm, S_IRUGO, show_fan_alarm, NULL, 7); - -static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault, NULL, 1); -static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, show_fan_fault, NULL, 2); -static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, show_fan_fault, NULL, 3); -static SENSOR_DEVICE_ATTR(fan5_fault, S_IRUGO, show_fan_fault, NULL, 4); -static SENSOR_DEVICE_ATTR(fan6_fault, S_IRUGO, show_fan_fault, NULL, 5); -static SENSOR_DEVICE_ATTR(fan7_fault, S_IRUGO, show_fan_fault, NULL, 6); -static SENSOR_DEVICE_ATTR(fan8_fault, S_IRUGO, show_fan_fault, NULL, 7); +static SENSOR_DEVICE_ATTR_RO(fan1_input, fan_input, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_input, fan_input, 1); +static SENSOR_DEVICE_ATTR_RO(fan3_input, fan_input, 2); +static SENSOR_DEVICE_ATTR_RO(fan4_input, fan_input, 3); +static SENSOR_DEVICE_ATTR_RO(fan5_input, fan_input, 4); +static SENSOR_DEVICE_ATTR_RO(fan6_input, fan_input, 5); +static SENSOR_DEVICE_ATTR_RO(fan7_input, fan_input, 6); +static SENSOR_DEVICE_ATTR_RO(fan8_input, fan_input, 7); + +static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0); +static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1); +static SENSOR_DEVICE_ATTR_RW(fan3_min, fan_min, 2); +static SENSOR_DEVICE_ATTR_RW(fan4_min, fan_min, 3); +static SENSOR_DEVICE_ATTR_RW(fan5_min, fan_min, 4); +static SENSOR_DEVICE_ATTR_RW(fan6_min, fan_min, 5); +static SENSOR_DEVICE_ATTR_RW(fan7_min, fan_min, 6); +static SENSOR_DEVICE_ATTR_RW(fan8_min, fan_min, 7); + +static SENSOR_DEVICE_ATTR_RO(fan1_alarm, fan_alarm, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_alarm, fan_alarm, 1); +static SENSOR_DEVICE_ATTR_RO(fan3_alarm, fan_alarm, 2); +static SENSOR_DEVICE_ATTR_RO(fan4_alarm, fan_alarm, 3); +static SENSOR_DEVICE_ATTR_RO(fan5_alarm, fan_alarm, 4); +static SENSOR_DEVICE_ATTR_RO(fan6_alarm, fan_alarm, 5); +static SENSOR_DEVICE_ATTR_RO(fan7_alarm, fan_alarm, 6); +static SENSOR_DEVICE_ATTR_RO(fan8_alarm, fan_alarm, 7); + +static SENSOR_DEVICE_ATTR_RO(fan1_fault, fan_fault, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_fault, fan_fault, 1); +static SENSOR_DEVICE_ATTR_RO(fan3_fault, fan_fault, 2); +static SENSOR_DEVICE_ATTR_RO(fan4_fault, fan_fault, 3); +static SENSOR_DEVICE_ATTR_RO(fan5_fault, fan_fault, 4); +static SENSOR_DEVICE_ATTR_RO(fan6_fault, fan_fault, 5); +static SENSOR_DEVICE_ATTR_RO(fan7_fault, fan_fault, 6); +static SENSOR_DEVICE_ATTR_RO(fan8_fault, fan_fault, 7); static struct attribute *pc87427_attributes_fan[8][5] = { { @@ -568,8 +569,8 @@ static void update_pwm_enable(struct pc87427_data *data, int nr, u8 mode) outb(data->pwm_enable[nr], iobase + PC87427_REG_PWM_ENABLE); } -static ssize_t show_pwm_enable(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t pwm_enable_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -581,8 +582,9 @@ static ssize_t show_pwm_enable(struct device *dev, struct device_attribute return sprintf(buf, "%d\n", pwm_enable); } -static ssize_t set_pwm_enable(struct device *dev, struct device_attribute - *devattr, const char *buf, size_t count) +static ssize_t pwm_enable_store(struct device *dev, + struct device_attribute *devattr, + const char *buf, size_t count) { struct pc87427_data *data = dev_get_drvdata(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -602,8 +604,8 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute return count; } -static ssize_t show_pwm(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t pwm_show(struct device *dev, struct device_attribute *devattr, + char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -611,8 +613,8 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute return sprintf(buf, "%d\n", (int)data->pwm[nr]); } -static ssize_t set_pwm(struct device *dev, struct device_attribute - *devattr, const char *buf, size_t count) +static ssize_t pwm_store(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) { struct pc87427_data *data = dev_get_drvdata(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -657,19 +659,15 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute return count; } -static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, - show_pwm_enable, set_pwm_enable, 0); -static SENSOR_DEVICE_ATTR(pwm2_enable, S_IWUSR | S_IRUGO, - show_pwm_enable, set_pwm_enable, 1); -static SENSOR_DEVICE_ATTR(pwm3_enable, S_IWUSR | S_IRUGO, - show_pwm_enable, set_pwm_enable, 2); -static SENSOR_DEVICE_ATTR(pwm4_enable, S_IWUSR | S_IRUGO, - show_pwm_enable, set_pwm_enable, 3); +static SENSOR_DEVICE_ATTR_RW(pwm1_enable, pwm_enable, 0); +static SENSOR_DEVICE_ATTR_RW(pwm2_enable, pwm_enable, 1); +static SENSOR_DEVICE_ATTR_RW(pwm3_enable, pwm_enable, 2); +static SENSOR_DEVICE_ATTR_RW(pwm4_enable, pwm_enable, 3); -static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0); -static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1); -static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2); -static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 3); +static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0); +static SENSOR_DEVICE_ATTR_RW(pwm2, pwm, 1); +static SENSOR_DEVICE_ATTR_RW(pwm3, pwm, 2); +static SENSOR_DEVICE_ATTR_RW(pwm4, pwm, 3); static struct attribute *pc87427_attributes_pwm[4][3] = { { @@ -698,8 +696,8 @@ static const struct attribute_group pc87427_group_pwm[4] = { { .attrs = pc87427_attributes_pwm[3] }, }; -static ssize_t show_temp_input(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t temp_input_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -707,8 +705,8 @@ static ssize_t show_temp_input(struct device *dev, struct device_attribute return sprintf(buf, "%ld\n", temp_from_reg(data->temp[nr])); } -static ssize_t show_temp_min(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t temp_min_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -716,8 +714,8 @@ static ssize_t show_temp_min(struct device *dev, struct device_attribute return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_min[nr])); } -static ssize_t show_temp_max(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t temp_max_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -725,8 +723,8 @@ static ssize_t show_temp_max(struct device *dev, struct device_attribute return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_max[nr])); } -static ssize_t show_temp_crit(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t temp_crit_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -734,8 +732,8 @@ static ssize_t show_temp_crit(struct device *dev, struct device_attribute return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_crit[nr])); } -static ssize_t show_temp_type(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t temp_type_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -743,8 +741,9 @@ static ssize_t show_temp_type(struct device *dev, struct device_attribute return sprintf(buf, "%u\n", temp_type_from_reg(data->temp_type[nr])); } -static ssize_t show_temp_min_alarm(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t temp_min_alarm_show(struct device *dev, + struct device_attribute *devattr, + char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -753,8 +752,9 @@ static ssize_t show_temp_min_alarm(struct device *dev, struct device_attribute & TEMP_STATUS_LOWFLG)); } -static ssize_t show_temp_max_alarm(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t temp_max_alarm_show(struct device *dev, + struct device_attribute *devattr, + char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -763,8 +763,9 @@ static ssize_t show_temp_max_alarm(struct device *dev, struct device_attribute & TEMP_STATUS_HIGHFLG)); } -static ssize_t show_temp_crit_alarm(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t temp_crit_alarm_show(struct device *dev, + struct device_attribute *devattr, + char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -773,8 +774,8 @@ static ssize_t show_temp_crit_alarm(struct device *dev, struct device_attribute & TEMP_STATUS_CRITFLG)); } -static ssize_t show_temp_fault(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t temp_fault_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct pc87427_data *data = pc87427_update_device(dev); int nr = to_sensor_dev_attr(devattr)->index; @@ -783,86 +784,68 @@ static ssize_t show_temp_fault(struct device *dev, struct device_attribute & TEMP_STATUS_SENSERR)); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp_input, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp_input, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_temp_input, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, show_temp_input, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_min, S_IRUGO, show_temp_min, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO, show_temp_min, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_min, S_IRUGO, show_temp_min, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_min, S_IRUGO, show_temp_min, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_min, S_IRUGO, show_temp_min, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_min, S_IRUGO, show_temp_min, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp_max, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp_max, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO, show_temp_max, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_max, S_IRUGO, show_temp_max, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_max, S_IRUGO, show_temp_max, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp_crit, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_crit, S_IRUGO, show_temp_crit, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_crit, S_IRUGO, show_temp_crit, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_type, S_IRUGO, show_temp_type, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_type, S_IRUGO, show_temp_type, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_type, S_IRUGO, show_temp_type, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, - show_temp_min_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, - show_temp_min_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_min_alarm, S_IRUGO, - show_temp_min_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_min_alarm, S_IRUGO, - show_temp_min_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_min_alarm, S_IRUGO, - show_temp_min_alarm, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_min_alarm, S_IRUGO, - show_temp_min_alarm, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, - show_temp_max_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, - show_temp_max_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_max_alarm, S_IRUGO, - show_temp_max_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, - show_temp_max_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_max_alarm, S_IRUGO, - show_temp_max_alarm, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_max_alarm, S_IRUGO, - show_temp_max_alarm, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, - show_temp_crit_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, - show_temp_crit_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_crit_alarm, S_IRUGO, - show_temp_crit_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_crit_alarm, S_IRUGO, - show_temp_crit_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_crit_alarm, S_IRUGO, - show_temp_crit_alarm, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_crit_alarm, S_IRUGO, - show_temp_crit_alarm, NULL, 5); - -static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_temp_fault, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_fault, S_IRUGO, show_temp_fault, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_fault, S_IRUGO, show_temp_fault, NULL, 5); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp_input, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_input, temp_input, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_input, temp_input, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_input, temp_input, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_input, temp_input, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_min, temp_min, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_min, temp_min, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_min, temp_min, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_min, temp_min, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_min, temp_min, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_min, temp_min, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_max, temp_max, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_max, temp_max, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_max, temp_max, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_max, temp_max, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_max, temp_max, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_max, temp_max, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_crit, temp_crit, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_crit, temp_crit, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_crit, temp_crit, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_crit, temp_crit, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_crit, temp_crit, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_crit, temp_crit, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_type, temp_type, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_type, temp_type, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_type, temp_type, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_type, temp_type, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_type, temp_type, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_type, temp_type, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, temp_min_alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_min_alarm, temp_min_alarm, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_min_alarm, temp_min_alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_min_alarm, temp_min_alarm, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_min_alarm, temp_min_alarm, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_min_alarm, temp_min_alarm, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, temp_max_alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, temp_max_alarm, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_max_alarm, temp_max_alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_max_alarm, temp_max_alarm, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_max_alarm, temp_max_alarm, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_max_alarm, temp_max_alarm, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, temp_crit_alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, temp_crit_alarm, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_crit_alarm, temp_crit_alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_crit_alarm, temp_crit_alarm, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_crit_alarm, temp_crit_alarm, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_crit_alarm, temp_crit_alarm, 5); + +static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_fault, temp_fault, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_fault, temp_fault, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_fault, temp_fault, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_fault, temp_fault, 5); static struct attribute *pc87427_attributes_temp[6][10] = { { @@ -1220,7 +1203,11 @@ static int __init pc87427_find(int sioaddr, struct pc87427_sio_data *sio_data) { u16 val; u8 cfg, cfg_b; - int i, err = 0; + int i, err; + + err = superio_enter(sioaddr); + if (err) + return err; /* Identify device */ val = force_id ? force_id : superio_inb(sioaddr, SIOREG_DEVID); |