diff options
Diffstat (limited to 'drivers/hwmon/fschmd.c')
-rw-r--r-- | drivers/hwmon/fschmd.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c index fa0728232e71..0627f7a5b9b8 100644 --- a/drivers/hwmon/fschmd.c +++ b/drivers/hwmon/fschmd.c | |||
@@ -267,7 +267,7 @@ struct fschmd_data { | |||
267 | struct list_head list; /* member of the watchdog_data_list */ | 267 | struct list_head list; /* member of the watchdog_data_list */ |
268 | struct kref kref; | 268 | struct kref kref; |
269 | struct miscdevice watchdog_miscdev; | 269 | struct miscdevice watchdog_miscdev; |
270 | int kind; | 270 | enum chips kind; |
271 | unsigned long watchdog_is_open; | 271 | unsigned long watchdog_is_open; |
272 | char watchdog_expect_close; | 272 | char watchdog_expect_close; |
273 | char watchdog_name[10]; /* must be unique to avoid sysfs conflict */ | 273 | char watchdog_name[10]; /* must be unique to avoid sysfs conflict */ |
@@ -325,8 +325,7 @@ static ssize_t show_in_value(struct device *dev, | |||
325 | int index = to_sensor_dev_attr(devattr)->index; | 325 | int index = to_sensor_dev_attr(devattr)->index; |
326 | struct fschmd_data *data = fschmd_update_device(dev); | 326 | struct fschmd_data *data = fschmd_update_device(dev); |
327 | 327 | ||
328 | /* fscher / fschrc - 1 as data->kind is an array index, not a chips */ | 328 | if (data->kind == fscher || data->kind >= fschrc) |
329 | if (data->kind == (fscher - 1) || data->kind >= (fschrc - 1)) | ||
330 | return sprintf(buf, "%d\n", (data->volt[index] * dmi_vref * | 329 | return sprintf(buf, "%d\n", (data->volt[index] * dmi_vref * |
331 | dmi_mult[index]) / 255 + dmi_offset[index]); | 330 | dmi_mult[index]) / 255 + dmi_offset[index]); |
332 | else | 331 | else |
@@ -492,7 +491,7 @@ static ssize_t show_pwm_auto_point1_pwm(struct device *dev, | |||
492 | int val = data->fan_min[index]; | 491 | int val = data->fan_min[index]; |
493 | 492 | ||
494 | /* 0 = allow turning off (except on the syl), 1-255 = 50-100% */ | 493 | /* 0 = allow turning off (except on the syl), 1-255 = 50-100% */ |
495 | if (val || data->kind == fscsyl - 1) | 494 | if (val || data->kind == fscsyl) |
496 | val = val / 2 + 128; | 495 | val = val / 2 + 128; |
497 | 496 | ||
498 | return sprintf(buf, "%d\n", val); | 497 | return sprintf(buf, "%d\n", val); |
@@ -506,7 +505,7 @@ static ssize_t store_pwm_auto_point1_pwm(struct device *dev, | |||
506 | unsigned long v = simple_strtoul(buf, NULL, 10); | 505 | unsigned long v = simple_strtoul(buf, NULL, 10); |
507 | 506 | ||
508 | /* reg: 0 = allow turning off (except on the syl), 1-255 = 50-100% */ | 507 | /* reg: 0 = allow turning off (except on the syl), 1-255 = 50-100% */ |
509 | if (v || data->kind == fscsyl - 1) { | 508 | if (v || data->kind == fscsyl) { |
510 | v = SENSORS_LIMIT(v, 128, 255); | 509 | v = SENSORS_LIMIT(v, 128, 255); |
511 | v = (v - 128) * 2 + 1; | 510 | v = (v - 128) * 2 + 1; |
512 | } | 511 | } |
@@ -1037,7 +1036,7 @@ static int fschmd_detect(struct i2c_client *client, | |||
1037 | else | 1036 | else |
1038 | return -ENODEV; | 1037 | return -ENODEV; |
1039 | 1038 | ||
1040 | strlcpy(info->type, fschmd_id[kind - 1].name, I2C_NAME_SIZE); | 1039 | strlcpy(info->type, fschmd_id[kind].name, I2C_NAME_SIZE); |
1041 | 1040 | ||
1042 | return 0; | 1041 | return 0; |
1043 | } | 1042 | } |
@@ -1065,6 +1064,7 @@ static int fschmd_probe(struct i2c_client *client, | |||
1065 | (where the client is found through a data ptr instead of the | 1064 | (where the client is found through a data ptr instead of the |
1066 | otherway around) */ | 1065 | otherway around) */ |
1067 | data->client = client; | 1066 | data->client = client; |
1067 | data->kind = kind; | ||
1068 | 1068 | ||
1069 | if (kind == fscpos) { | 1069 | if (kind == fscpos) { |
1070 | /* The Poseidon has hardwired temp limits, fill these | 1070 | /* The Poseidon has hardwired temp limits, fill these |
@@ -1085,9 +1085,6 @@ static int fschmd_probe(struct i2c_client *client, | |||
1085 | } | 1085 | } |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | /* i2c kind goes from 1-6, we want from 0-5 to address arrays */ | ||
1089 | data->kind = kind - 1; | ||
1090 | |||
1091 | /* Read in some never changing registers */ | 1088 | /* Read in some never changing registers */ |
1092 | data->revision = i2c_smbus_read_byte_data(client, FSCHMD_REG_REVISION); | 1089 | data->revision = i2c_smbus_read_byte_data(client, FSCHMD_REG_REVISION); |
1093 | data->global_control = i2c_smbus_read_byte_data(client, | 1090 | data->global_control = i2c_smbus_read_byte_data(client, |