aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/f71882fg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/f71882fg.c')
-rw-r--r--drivers/hwmon/f71882fg.c187
1 files changed, 95 insertions, 92 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 67067e9a323..e2f3c5a8215 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -188,79 +188,82 @@ static struct device_attribute f71882fg_dev_attr[] =
188 __ATTR( name, S_IRUGO, show_name, NULL ), 188 __ATTR( name, S_IRUGO, show_name, NULL ),
189}; 189};
190 190
191static struct sensor_device_attribute f71882fg_in_temp_attr[] = 191static struct sensor_device_attribute_2 f71882fg_in_temp_attr[] = {
192{ 192 SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0),
193 SENSOR_ATTR(in0_input, S_IRUGO, show_in, NULL, 0), 193 SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1),
194 SENSOR_ATTR(in1_input, S_IRUGO, show_in, NULL, 1), 194 SENSOR_ATTR_2(in1_max, S_IRUGO|S_IWUSR, show_in_max, store_in_max,
195 SENSOR_ATTR(in1_max, S_IRUGO|S_IWUSR, show_in_max, store_in_max, 1), 195 0, 1),
196 SENSOR_ATTR(in1_beep, S_IRUGO|S_IWUSR, show_in_beep, store_in_beep, 1), 196 SENSOR_ATTR_2(in1_beep, S_IRUGO|S_IWUSR, show_in_beep, store_in_beep,
197 SENSOR_ATTR(in1_alarm, S_IRUGO, show_in_alarm, NULL, 1), 197 0, 1),
198 SENSOR_ATTR(in2_input, S_IRUGO, show_in, NULL, 2), 198 SENSOR_ATTR_2(in1_alarm, S_IRUGO, show_in_alarm, NULL, 0, 1),
199 SENSOR_ATTR(in3_input, S_IRUGO, show_in, NULL, 3), 199 SENSOR_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 0, 2),
200 SENSOR_ATTR(in4_input, S_IRUGO, show_in, NULL, 4), 200 SENSOR_ATTR_2(in3_input, S_IRUGO, show_in, NULL, 0, 3),
201 SENSOR_ATTR(in5_input, S_IRUGO, show_in, NULL, 5), 201 SENSOR_ATTR_2(in4_input, S_IRUGO, show_in, NULL, 0, 4),
202 SENSOR_ATTR(in6_input, S_IRUGO, show_in, NULL, 6), 202 SENSOR_ATTR_2(in5_input, S_IRUGO, show_in, NULL, 0, 5),
203 SENSOR_ATTR(in7_input, S_IRUGO, show_in, NULL, 7), 203 SENSOR_ATTR_2(in6_input, S_IRUGO, show_in, NULL, 0, 6),
204 SENSOR_ATTR(in8_input, S_IRUGO, show_in, NULL, 8), 204 SENSOR_ATTR_2(in7_input, S_IRUGO, show_in, NULL, 0, 7),
205 SENSOR_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0), 205 SENSOR_ATTR_2(in8_input, S_IRUGO, show_in, NULL, 0, 8),
206 SENSOR_ATTR(temp1_max, S_IRUGO|S_IWUSR, show_temp_max, 206 SENSOR_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, 0),
207 store_temp_max, 0), 207 SENSOR_ATTR_2(temp1_max, S_IRUGO|S_IWUSR, show_temp_max,
208 SENSOR_ATTR(temp1_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst, 208 store_temp_max, 0, 0),
209 store_temp_max_hyst, 0), 209 SENSOR_ATTR_2(temp1_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst,
210 SENSOR_ATTR(temp1_crit, S_IRUGO|S_IWUSR, show_temp_crit, 210 store_temp_max_hyst, 0, 0),
211 store_temp_crit, 0), 211 SENSOR_ATTR_2(temp1_crit, S_IRUGO|S_IWUSR, show_temp_crit,
212 SENSOR_ATTR(temp1_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL, 0), 212 store_temp_crit, 0, 0),
213 SENSOR_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0), 213 SENSOR_ATTR_2(temp1_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL,
214 SENSOR_ATTR(temp1_beep, S_IRUGO|S_IWUSR, show_temp_beep, 214 0, 0),
215 store_temp_beep, 0), 215 SENSOR_ATTR_2(temp1_type, S_IRUGO, show_temp_type, NULL, 0, 0),
216 SENSOR_ATTR(temp1_alarm, S_IRUGO, show_temp_alarm, NULL, 0), 216 SENSOR_ATTR_2(temp1_beep, S_IRUGO|S_IWUSR, show_temp_beep,
217 SENSOR_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0), 217 store_temp_beep, 0, 0),
218 SENSOR_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1), 218 SENSOR_ATTR_2(temp1_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 0),
219 SENSOR_ATTR(temp2_max, S_IRUGO|S_IWUSR, show_temp_max, 219 SENSOR_ATTR_2(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0, 0),
220 store_temp_max, 1), 220 SENSOR_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 0, 1),
221 SENSOR_ATTR(temp2_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst, 221 SENSOR_ATTR_2(temp2_max, S_IRUGO|S_IWUSR, show_temp_max,
222 store_temp_max_hyst, 1), 222 store_temp_max, 0, 1),
223 SENSOR_ATTR(temp2_crit, S_IRUGO|S_IWUSR, show_temp_crit, 223 SENSOR_ATTR_2(temp2_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst,
224 store_temp_crit, 1), 224 store_temp_max_hyst, 0, 1),
225 SENSOR_ATTR(temp2_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL, 1), 225 SENSOR_ATTR_2(temp2_crit, S_IRUGO|S_IWUSR, show_temp_crit,
226 SENSOR_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1), 226 store_temp_crit, 0, 1),
227 SENSOR_ATTR(temp2_beep, S_IRUGO|S_IWUSR, show_temp_beep, 227 SENSOR_ATTR_2(temp2_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL,
228 store_temp_beep, 1), 228 0, 1),
229 SENSOR_ATTR(temp2_alarm, S_IRUGO, show_temp_alarm, NULL, 1), 229 SENSOR_ATTR_2(temp2_type, S_IRUGO, show_temp_type, NULL, 0, 1),
230 SENSOR_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1), 230 SENSOR_ATTR_2(temp2_beep, S_IRUGO|S_IWUSR, show_temp_beep,
231 SENSOR_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2), 231 store_temp_beep, 0, 1),
232 SENSOR_ATTR(temp3_max, S_IRUGO|S_IWUSR, show_temp_max, 232 SENSOR_ATTR_2(temp2_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 1),
233 store_temp_max, 2), 233 SENSOR_ATTR_2(temp2_fault, S_IRUGO, show_temp_fault, NULL, 0, 1),
234 SENSOR_ATTR(temp3_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst, 234 SENSOR_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0, 2),
235 store_temp_max_hyst, 2), 235 SENSOR_ATTR_2(temp3_max, S_IRUGO|S_IWUSR, show_temp_max,
236 SENSOR_ATTR(temp3_crit, S_IRUGO|S_IWUSR, show_temp_crit, 236 store_temp_max, 0, 2),
237 store_temp_crit, 2), 237 SENSOR_ATTR_2(temp3_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst,
238 SENSOR_ATTR(temp3_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL, 2), 238 store_temp_max_hyst, 0, 2),
239 SENSOR_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2), 239 SENSOR_ATTR_2(temp3_crit, S_IRUGO|S_IWUSR, show_temp_crit,
240 SENSOR_ATTR(temp3_beep, S_IRUGO|S_IWUSR, show_temp_beep, 240 store_temp_crit, 0, 2),
241 store_temp_beep, 2), 241 SENSOR_ATTR_2(temp3_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL,
242 SENSOR_ATTR(temp3_alarm, S_IRUGO, show_temp_alarm, NULL, 2), 242 0, 2),
243 SENSOR_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2) 243 SENSOR_ATTR_2(temp3_type, S_IRUGO, show_temp_type, NULL, 0, 2),
244 SENSOR_ATTR_2(temp3_beep, S_IRUGO|S_IWUSR, show_temp_beep,
245 store_temp_beep, 0, 2),
246 SENSOR_ATTR_2(temp3_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 2),
247 SENSOR_ATTR_2(temp3_fault, S_IRUGO, show_temp_fault, NULL, 0, 2),
244}; 248};
245 249
246static struct sensor_device_attribute f71882fg_fan_attr[] = 250static struct sensor_device_attribute_2 f71882fg_fan_attr[] = {
247{ 251 SENSOR_ATTR_2(fan1_input, S_IRUGO, show_fan, NULL, 0, 0),
248 SENSOR_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0), 252 SENSOR_ATTR_2(fan1_beep, S_IRUGO|S_IWUSR, show_fan_beep,
249 SENSOR_ATTR(fan1_beep, S_IRUGO|S_IWUSR, show_fan_beep, 253 store_fan_beep, 0, 0),
250 store_fan_beep, 0), 254 SENSOR_ATTR_2(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0, 0),
251 SENSOR_ATTR(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0), 255 SENSOR_ATTR_2(fan2_input, S_IRUGO, show_fan, NULL, 0, 1),
252 SENSOR_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1), 256 SENSOR_ATTR_2(fan2_beep, S_IRUGO|S_IWUSR, show_fan_beep,
253 SENSOR_ATTR(fan2_beep, S_IRUGO|S_IWUSR, show_fan_beep, 257 store_fan_beep, 0, 1),
254 store_fan_beep, 1), 258 SENSOR_ATTR_2(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 0, 1),
255 SENSOR_ATTR(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 1), 259 SENSOR_ATTR_2(fan3_input, S_IRUGO, show_fan, NULL, 0, 2),
256 SENSOR_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2), 260 SENSOR_ATTR_2(fan3_beep, S_IRUGO|S_IWUSR, show_fan_beep,
257 SENSOR_ATTR(fan3_beep, S_IRUGO|S_IWUSR, show_fan_beep, 261 store_fan_beep, 0, 2),
258 store_fan_beep, 2), 262 SENSOR_ATTR_2(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 0, 2),
259 SENSOR_ATTR(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 2), 263 SENSOR_ATTR_2(fan4_input, S_IRUGO, show_fan, NULL, 0, 3),
260 SENSOR_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3), 264 SENSOR_ATTR_2(fan4_beep, S_IRUGO|S_IWUSR, show_fan_beep,
261 SENSOR_ATTR(fan4_beep, S_IRUGO|S_IWUSR, show_fan_beep, 265 store_fan_beep, 0, 3),
262 store_fan_beep, 3), 266 SENSOR_ATTR_2(fan4_alarm, S_IRUGO, show_fan_alarm, NULL, 0, 3),
263 SENSOR_ATTR(fan4_alarm, S_IRUGO, show_fan_alarm, NULL, 3)
264}; 267};
265 268
266 269
@@ -417,7 +420,7 @@ static ssize_t show_fan(struct device *dev, struct device_attribute *devattr,
417 char *buf) 420 char *buf)
418{ 421{
419 struct f71882fg_data *data = f71882fg_update_device(dev); 422 struct f71882fg_data *data = f71882fg_update_device(dev);
420 int nr = to_sensor_dev_attr(devattr)->index; 423 int nr = to_sensor_dev_attr_2(devattr)->index;
421 int speed = fan_from_reg(data->fan[nr]); 424 int speed = fan_from_reg(data->fan[nr]);
422 425
423 if (speed == FAN_MIN_DETECT) 426 if (speed == FAN_MIN_DETECT)
@@ -430,7 +433,7 @@ static ssize_t show_fan_beep(struct device *dev, struct device_attribute
430 *devattr, char *buf) 433 *devattr, char *buf)
431{ 434{
432 struct f71882fg_data *data = f71882fg_update_device(dev); 435 struct f71882fg_data *data = f71882fg_update_device(dev);
433 int nr = to_sensor_dev_attr(devattr)->index; 436 int nr = to_sensor_dev_attr_2(devattr)->index;
434 437
435 if (data->fan_beep & (1 << nr)) 438 if (data->fan_beep & (1 << nr))
436 return sprintf(buf, "1\n"); 439 return sprintf(buf, "1\n");
@@ -442,7 +445,7 @@ static ssize_t store_fan_beep(struct device *dev, struct device_attribute
442 *devattr, const char *buf, size_t count) 445 *devattr, const char *buf, size_t count)
443{ 446{
444 struct f71882fg_data *data = dev_get_drvdata(dev); 447 struct f71882fg_data *data = dev_get_drvdata(dev);
445 int nr = to_sensor_dev_attr(devattr)->index; 448 int nr = to_sensor_dev_attr_2(devattr)->index;
446 int val = simple_strtoul(buf, NULL, 10); 449 int val = simple_strtoul(buf, NULL, 10);
447 450
448 mutex_lock(&data->update_lock); 451 mutex_lock(&data->update_lock);
@@ -461,7 +464,7 @@ static ssize_t show_fan_alarm(struct device *dev, struct device_attribute
461 *devattr, char *buf) 464 *devattr, char *buf)
462{ 465{
463 struct f71882fg_data *data = f71882fg_update_device(dev); 466 struct f71882fg_data *data = f71882fg_update_device(dev);
464 int nr = to_sensor_dev_attr(devattr)->index; 467 int nr = to_sensor_dev_attr_2(devattr)->index;
465 468
466 if (data->fan_status & (1 << nr)) 469 if (data->fan_status & (1 << nr))
467 return sprintf(buf, "1\n"); 470 return sprintf(buf, "1\n");
@@ -473,7 +476,7 @@ static ssize_t show_in(struct device *dev, struct device_attribute *devattr,
473 char *buf) 476 char *buf)
474{ 477{
475 struct f71882fg_data *data = f71882fg_update_device(dev); 478 struct f71882fg_data *data = f71882fg_update_device(dev);
476 int nr = to_sensor_dev_attr(devattr)->index; 479 int nr = to_sensor_dev_attr_2(devattr)->index;
477 480
478 return sprintf(buf, "%d\n", data->in[nr] * 8); 481 return sprintf(buf, "%d\n", data->in[nr] * 8);
479} 482}
@@ -507,7 +510,7 @@ static ssize_t show_in_beep(struct device *dev, struct device_attribute
507 *devattr, char *buf) 510 *devattr, char *buf)
508{ 511{
509 struct f71882fg_data *data = f71882fg_update_device(dev); 512 struct f71882fg_data *data = f71882fg_update_device(dev);
510 int nr = to_sensor_dev_attr(devattr)->index; 513 int nr = to_sensor_dev_attr_2(devattr)->index;
511 514
512 if (data->in_beep & (1 << nr)) 515 if (data->in_beep & (1 << nr))
513 return sprintf(buf, "1\n"); 516 return sprintf(buf, "1\n");
@@ -519,7 +522,7 @@ static ssize_t store_in_beep(struct device *dev, struct device_attribute
519 *devattr, const char *buf, size_t count) 522 *devattr, const char *buf, size_t count)
520{ 523{
521 struct f71882fg_data *data = dev_get_drvdata(dev); 524 struct f71882fg_data *data = dev_get_drvdata(dev);
522 int nr = to_sensor_dev_attr(devattr)->index; 525 int nr = to_sensor_dev_attr_2(devattr)->index;
523 int val = simple_strtoul(buf, NULL, 10); 526 int val = simple_strtoul(buf, NULL, 10);
524 527
525 mutex_lock(&data->update_lock); 528 mutex_lock(&data->update_lock);
@@ -538,7 +541,7 @@ static ssize_t show_in_alarm(struct device *dev, struct device_attribute
538 *devattr, char *buf) 541 *devattr, char *buf)
539{ 542{
540 struct f71882fg_data *data = f71882fg_update_device(dev); 543 struct f71882fg_data *data = f71882fg_update_device(dev);
541 int nr = to_sensor_dev_attr(devattr)->index; 544 int nr = to_sensor_dev_attr_2(devattr)->index;
542 545
543 if (data->in_status & (1 << nr)) 546 if (data->in_status & (1 << nr))
544 return sprintf(buf, "1\n"); 547 return sprintf(buf, "1\n");
@@ -550,7 +553,7 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
550 char *buf) 553 char *buf)
551{ 554{
552 struct f71882fg_data *data = f71882fg_update_device(dev); 555 struct f71882fg_data *data = f71882fg_update_device(dev);
553 int nr = to_sensor_dev_attr(devattr)->index; 556 int nr = to_sensor_dev_attr_2(devattr)->index;
554 557
555 return sprintf(buf, "%d\n", data->temp[nr] * 1000); 558 return sprintf(buf, "%d\n", data->temp[nr] * 1000);
556} 559}
@@ -559,7 +562,7 @@ static ssize_t show_temp_max(struct device *dev, struct device_attribute
559 *devattr, char *buf) 562 *devattr, char *buf)
560{ 563{
561 struct f71882fg_data *data = f71882fg_update_device(dev); 564 struct f71882fg_data *data = f71882fg_update_device(dev);
562 int nr = to_sensor_dev_attr(devattr)->index; 565 int nr = to_sensor_dev_attr_2(devattr)->index;
563 566
564 return sprintf(buf, "%d\n", data->temp_high[nr] * 1000); 567 return sprintf(buf, "%d\n", data->temp_high[nr] * 1000);
565} 568}
@@ -568,7 +571,7 @@ static ssize_t store_temp_max(struct device *dev, struct device_attribute
568 *devattr, const char *buf, size_t count) 571 *devattr, const char *buf, size_t count)
569{ 572{
570 struct f71882fg_data *data = dev_get_drvdata(dev); 573 struct f71882fg_data *data = dev_get_drvdata(dev);
571 int nr = to_sensor_dev_attr(devattr)->index; 574 int nr = to_sensor_dev_attr_2(devattr)->index;
572 int val = simple_strtoul(buf, NULL, 10) / 1000; 575 int val = simple_strtoul(buf, NULL, 10) / 1000;
573 576
574 if (val > 255) 577 if (val > 255)
@@ -586,7 +589,7 @@ static ssize_t show_temp_max_hyst(struct device *dev, struct device_attribute
586 *devattr, char *buf) 589 *devattr, char *buf)
587{ 590{
588 struct f71882fg_data *data = f71882fg_update_device(dev); 591 struct f71882fg_data *data = f71882fg_update_device(dev);
589 int nr = to_sensor_dev_attr(devattr)->index; 592 int nr = to_sensor_dev_attr_2(devattr)->index;
590 593
591 return sprintf(buf, "%d\n", 594 return sprintf(buf, "%d\n",
592 (data->temp_high[nr] - data->temp_hyst[nr]) * 1000); 595 (data->temp_high[nr] - data->temp_hyst[nr]) * 1000);
@@ -596,7 +599,7 @@ static ssize_t store_temp_max_hyst(struct device *dev, struct device_attribute
596 *devattr, const char *buf, size_t count) 599 *devattr, const char *buf, size_t count)
597{ 600{
598 struct f71882fg_data *data = dev_get_drvdata(dev); 601 struct f71882fg_data *data = dev_get_drvdata(dev);
599 int nr = to_sensor_dev_attr(devattr)->index; 602 int nr = to_sensor_dev_attr_2(devattr)->index;
600 int val = simple_strtoul(buf, NULL, 10) / 1000; 603 int val = simple_strtoul(buf, NULL, 10) / 1000;
601 ssize_t ret = count; 604 ssize_t ret = count;
602 605
@@ -636,7 +639,7 @@ static ssize_t show_temp_crit(struct device *dev, struct device_attribute
636 *devattr, char *buf) 639 *devattr, char *buf)
637{ 640{
638 struct f71882fg_data *data = f71882fg_update_device(dev); 641 struct f71882fg_data *data = f71882fg_update_device(dev);
639 int nr = to_sensor_dev_attr(devattr)->index; 642 int nr = to_sensor_dev_attr_2(devattr)->index;
640 643
641 return sprintf(buf, "%d\n", data->temp_ovt[nr] * 1000); 644 return sprintf(buf, "%d\n", data->temp_ovt[nr] * 1000);
642} 645}
@@ -645,7 +648,7 @@ static ssize_t store_temp_crit(struct device *dev, struct device_attribute
645 *devattr, const char *buf, size_t count) 648 *devattr, const char *buf, size_t count)
646{ 649{
647 struct f71882fg_data *data = dev_get_drvdata(dev); 650 struct f71882fg_data *data = dev_get_drvdata(dev);
648 int nr = to_sensor_dev_attr(devattr)->index; 651 int nr = to_sensor_dev_attr_2(devattr)->index;
649 int val = simple_strtoul(buf, NULL, 10) / 1000; 652 int val = simple_strtoul(buf, NULL, 10) / 1000;
650 653
651 if (val > 255) 654 if (val > 255)
@@ -663,7 +666,7 @@ static ssize_t show_temp_crit_hyst(struct device *dev, struct device_attribute
663 *devattr, char *buf) 666 *devattr, char *buf)
664{ 667{
665 struct f71882fg_data *data = f71882fg_update_device(dev); 668 struct f71882fg_data *data = f71882fg_update_device(dev);
666 int nr = to_sensor_dev_attr(devattr)->index; 669 int nr = to_sensor_dev_attr_2(devattr)->index;
667 670
668 return sprintf(buf, "%d\n", 671 return sprintf(buf, "%d\n",
669 (data->temp_ovt[nr] - data->temp_hyst[nr]) * 1000); 672 (data->temp_ovt[nr] - data->temp_hyst[nr]) * 1000);
@@ -673,7 +676,7 @@ static ssize_t show_temp_type(struct device *dev, struct device_attribute
673 *devattr, char *buf) 676 *devattr, char *buf)
674{ 677{
675 struct f71882fg_data *data = f71882fg_update_device(dev); 678 struct f71882fg_data *data = f71882fg_update_device(dev);
676 int nr = to_sensor_dev_attr(devattr)->index; 679 int nr = to_sensor_dev_attr_2(devattr)->index;
677 680
678 return sprintf(buf, "%d\n", data->temp_type[nr]); 681 return sprintf(buf, "%d\n", data->temp_type[nr]);
679} 682}
@@ -682,7 +685,7 @@ static ssize_t show_temp_beep(struct device *dev, struct device_attribute
682 *devattr, char *buf) 685 *devattr, char *buf)
683{ 686{
684 struct f71882fg_data *data = f71882fg_update_device(dev); 687 struct f71882fg_data *data = f71882fg_update_device(dev);
685 int nr = to_sensor_dev_attr(devattr)->index; 688 int nr = to_sensor_dev_attr_2(devattr)->index;
686 689
687 if (data->temp_beep & (1 << (nr + 1))) 690 if (data->temp_beep & (1 << (nr + 1)))
688 return sprintf(buf, "1\n"); 691 return sprintf(buf, "1\n");
@@ -694,7 +697,7 @@ static ssize_t store_temp_beep(struct device *dev, struct device_attribute
694 *devattr, const char *buf, size_t count) 697 *devattr, const char *buf, size_t count)
695{ 698{
696 struct f71882fg_data *data = dev_get_drvdata(dev); 699 struct f71882fg_data *data = dev_get_drvdata(dev);
697 int nr = to_sensor_dev_attr(devattr)->index; 700 int nr = to_sensor_dev_attr_2(devattr)->index;
698 int val = simple_strtoul(buf, NULL, 10); 701 int val = simple_strtoul(buf, NULL, 10);
699 702
700 mutex_lock(&data->update_lock); 703 mutex_lock(&data->update_lock);
@@ -713,7 +716,7 @@ static ssize_t show_temp_alarm(struct device *dev, struct device_attribute
713 *devattr, char *buf) 716 *devattr, char *buf)
714{ 717{
715 struct f71882fg_data *data = f71882fg_update_device(dev); 718 struct f71882fg_data *data = f71882fg_update_device(dev);
716 int nr = to_sensor_dev_attr(devattr)->index; 719 int nr = to_sensor_dev_attr_2(devattr)->index;
717 720
718 if (data->temp_status & (1 << (nr + 1))) 721 if (data->temp_status & (1 << (nr + 1)))
719 return sprintf(buf, "1\n"); 722 return sprintf(buf, "1\n");
@@ -725,7 +728,7 @@ static ssize_t show_temp_fault(struct device *dev, struct device_attribute
725 *devattr, char *buf) 728 *devattr, char *buf)
726{ 729{
727 struct f71882fg_data *data = f71882fg_update_device(dev); 730 struct f71882fg_data *data = f71882fg_update_device(dev);
728 int nr = to_sensor_dev_attr(devattr)->index; 731 int nr = to_sensor_dev_attr_2(devattr)->index;
729 732
730 if (data->temp_diode_open & (1 << (nr + 1))) 733 if (data->temp_diode_open & (1 << (nr + 1)))
731 return sprintf(buf, "1\n"); 734 return sprintf(buf, "1\n");