aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips/pc87360.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/chips/pc87360.c')
-rw-r--r--drivers/i2c/chips/pc87360.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/i2c/chips/pc87360.c b/drivers/i2c/chips/pc87360.c
index 6d94c36c9218..65637b2cd170 100644
--- a/drivers/i2c/chips/pc87360.c
+++ b/drivers/i2c/chips/pc87360.c
@@ -282,31 +282,31 @@ static ssize_t set_fan_min(struct device *dev, const char *buf,
282} 282}
283 283
284#define show_and_set_fan(offset) \ 284#define show_and_set_fan(offset) \
285static ssize_t show_fan##offset##_input(struct device *dev, char *buf) \ 285static ssize_t show_fan##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \
286{ \ 286{ \
287 struct pc87360_data *data = pc87360_update_device(dev); \ 287 struct pc87360_data *data = pc87360_update_device(dev); \
288 return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan[offset-1], \ 288 return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan[offset-1], \
289 FAN_DIV_FROM_REG(data->fan_status[offset-1]))); \ 289 FAN_DIV_FROM_REG(data->fan_status[offset-1]))); \
290} \ 290} \
291static ssize_t show_fan##offset##_min(struct device *dev, char *buf) \ 291static ssize_t show_fan##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \
292{ \ 292{ \
293 struct pc87360_data *data = pc87360_update_device(dev); \ 293 struct pc87360_data *data = pc87360_update_device(dev); \
294 return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan_min[offset-1], \ 294 return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan_min[offset-1], \
295 FAN_DIV_FROM_REG(data->fan_status[offset-1]))); \ 295 FAN_DIV_FROM_REG(data->fan_status[offset-1]))); \
296} \ 296} \
297static ssize_t show_fan##offset##_div(struct device *dev, char *buf) \ 297static ssize_t show_fan##offset##_div(struct device *dev, struct device_attribute *attr, char *buf) \
298{ \ 298{ \
299 struct pc87360_data *data = pc87360_update_device(dev); \ 299 struct pc87360_data *data = pc87360_update_device(dev); \
300 return sprintf(buf, "%u\n", \ 300 return sprintf(buf, "%u\n", \
301 FAN_DIV_FROM_REG(data->fan_status[offset-1])); \ 301 FAN_DIV_FROM_REG(data->fan_status[offset-1])); \
302} \ 302} \
303static ssize_t show_fan##offset##_status(struct device *dev, char *buf) \ 303static ssize_t show_fan##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \
304{ \ 304{ \
305 struct pc87360_data *data = pc87360_update_device(dev); \ 305 struct pc87360_data *data = pc87360_update_device(dev); \
306 return sprintf(buf, "%u\n", \ 306 return sprintf(buf, "%u\n", \
307 FAN_STATUS_FROM_REG(data->fan_status[offset-1])); \ 307 FAN_STATUS_FROM_REG(data->fan_status[offset-1])); \
308} \ 308} \
309static ssize_t set_fan##offset##_min(struct device *dev, const char *buf, \ 309static ssize_t set_fan##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \
310 size_t count) \ 310 size_t count) \
311{ \ 311{ \
312 return set_fan_min(dev, buf, count, offset-1); \ 312 return set_fan_min(dev, buf, count, offset-1); \
@@ -324,7 +324,7 @@ show_and_set_fan(2)
324show_and_set_fan(3) 324show_and_set_fan(3)
325 325
326#define show_and_set_pwm(offset) \ 326#define show_and_set_pwm(offset) \
327static ssize_t show_pwm##offset(struct device *dev, char *buf) \ 327static ssize_t show_pwm##offset(struct device *dev, struct device_attribute *attr, char *buf) \
328{ \ 328{ \
329 struct pc87360_data *data = pc87360_update_device(dev); \ 329 struct pc87360_data *data = pc87360_update_device(dev); \
330 return sprintf(buf, "%u\n", \ 330 return sprintf(buf, "%u\n", \
@@ -332,7 +332,7 @@ static ssize_t show_pwm##offset(struct device *dev, char *buf) \
332 FAN_CONFIG_INVERT(data->fan_conf, \ 332 FAN_CONFIG_INVERT(data->fan_conf, \
333 offset-1))); \ 333 offset-1))); \
334} \ 334} \
335static ssize_t set_pwm##offset(struct device *dev, const char *buf, \ 335static ssize_t set_pwm##offset(struct device *dev, struct device_attribute *attr, const char *buf, \
336 size_t count) \ 336 size_t count) \
337{ \ 337{ \
338 struct i2c_client *client = to_i2c_client(dev); \ 338 struct i2c_client *client = to_i2c_client(dev); \
@@ -354,30 +354,30 @@ show_and_set_pwm(2)
354show_and_set_pwm(3) 354show_and_set_pwm(3)
355 355
356#define show_and_set_in(offset) \ 356#define show_and_set_in(offset) \
357static ssize_t show_in##offset##_input(struct device *dev, char *buf) \ 357static ssize_t show_in##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \
358{ \ 358{ \
359 struct pc87360_data *data = pc87360_update_device(dev); \ 359 struct pc87360_data *data = pc87360_update_device(dev); \
360 return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \ 360 return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \
361 data->in_vref)); \ 361 data->in_vref)); \
362} \ 362} \
363static ssize_t show_in##offset##_min(struct device *dev, char *buf) \ 363static ssize_t show_in##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \
364{ \ 364{ \
365 struct pc87360_data *data = pc87360_update_device(dev); \ 365 struct pc87360_data *data = pc87360_update_device(dev); \
366 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \ 366 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \
367 data->in_vref)); \ 367 data->in_vref)); \
368} \ 368} \
369static ssize_t show_in##offset##_max(struct device *dev, char *buf) \ 369static ssize_t show_in##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \
370{ \ 370{ \
371 struct pc87360_data *data = pc87360_update_device(dev); \ 371 struct pc87360_data *data = pc87360_update_device(dev); \
372 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \ 372 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \
373 data->in_vref)); \ 373 data->in_vref)); \
374} \ 374} \
375static ssize_t show_in##offset##_status(struct device *dev, char *buf) \ 375static ssize_t show_in##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \
376{ \ 376{ \
377 struct pc87360_data *data = pc87360_update_device(dev); \ 377 struct pc87360_data *data = pc87360_update_device(dev); \
378 return sprintf(buf, "%u\n", data->in_status[offset]); \ 378 return sprintf(buf, "%u\n", data->in_status[offset]); \
379} \ 379} \
380static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \ 380static ssize_t set_in##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \
381 size_t count) \ 381 size_t count) \
382{ \ 382{ \
383 struct i2c_client *client = to_i2c_client(dev); \ 383 struct i2c_client *client = to_i2c_client(dev); \
@@ -391,7 +391,7 @@ static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \
391 up(&data->update_lock); \ 391 up(&data->update_lock); \
392 return count; \ 392 return count; \
393} \ 393} \
394static ssize_t set_in##offset##_max(struct device *dev, const char *buf, \ 394static ssize_t set_in##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \
395 size_t count) \ 395 size_t count) \
396{ \ 396{ \
397 struct i2c_client *client = to_i2c_client(dev); \ 397 struct i2c_client *client = to_i2c_client(dev); \
@@ -427,36 +427,36 @@ show_and_set_in(9)
427show_and_set_in(10) 427show_and_set_in(10)
428 428
429#define show_and_set_therm(offset) \ 429#define show_and_set_therm(offset) \
430static ssize_t show_temp##offset##_input(struct device *dev, char *buf) \ 430static ssize_t show_temp##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \
431{ \ 431{ \
432 struct pc87360_data *data = pc87360_update_device(dev); \ 432 struct pc87360_data *data = pc87360_update_device(dev); \
433 return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset+7], \ 433 return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset+7], \
434 data->in_vref)); \ 434 data->in_vref)); \
435} \ 435} \
436static ssize_t show_temp##offset##_min(struct device *dev, char *buf) \ 436static ssize_t show_temp##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \
437{ \ 437{ \
438 struct pc87360_data *data = pc87360_update_device(dev); \ 438 struct pc87360_data *data = pc87360_update_device(dev); \
439 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset+7], \ 439 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset+7], \
440 data->in_vref)); \ 440 data->in_vref)); \
441} \ 441} \
442static ssize_t show_temp##offset##_max(struct device *dev, char *buf) \ 442static ssize_t show_temp##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \
443{ \ 443{ \
444 struct pc87360_data *data = pc87360_update_device(dev); \ 444 struct pc87360_data *data = pc87360_update_device(dev); \
445 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset+7], \ 445 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset+7], \
446 data->in_vref)); \ 446 data->in_vref)); \
447} \ 447} \
448static ssize_t show_temp##offset##_crit(struct device *dev, char *buf) \ 448static ssize_t show_temp##offset##_crit(struct device *dev, struct device_attribute *attr, char *buf) \
449{ \ 449{ \
450 struct pc87360_data *data = pc87360_update_device(dev); \ 450 struct pc87360_data *data = pc87360_update_device(dev); \
451 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_crit[offset-4], \ 451 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_crit[offset-4], \
452 data->in_vref)); \ 452 data->in_vref)); \
453} \ 453} \
454static ssize_t show_temp##offset##_status(struct device *dev, char *buf) \ 454static ssize_t show_temp##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \
455{ \ 455{ \
456 struct pc87360_data *data = pc87360_update_device(dev); \ 456 struct pc87360_data *data = pc87360_update_device(dev); \
457 return sprintf(buf, "%u\n", data->in_status[offset+7]); \ 457 return sprintf(buf, "%u\n", data->in_status[offset+7]); \
458} \ 458} \
459static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ 459static ssize_t set_temp##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \
460 size_t count) \ 460 size_t count) \
461{ \ 461{ \
462 struct i2c_client *client = to_i2c_client(dev); \ 462 struct i2c_client *client = to_i2c_client(dev); \
@@ -470,7 +470,7 @@ static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \
470 up(&data->update_lock); \ 470 up(&data->update_lock); \
471 return count; \ 471 return count; \
472} \ 472} \
473static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ 473static ssize_t set_temp##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \
474 size_t count) \ 474 size_t count) \
475{ \ 475{ \
476 struct i2c_client *client = to_i2c_client(dev); \ 476 struct i2c_client *client = to_i2c_client(dev); \
@@ -484,7 +484,7 @@ static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \
484 up(&data->update_lock); \ 484 up(&data->update_lock); \
485 return count; \ 485 return count; \
486} \ 486} \
487static ssize_t set_temp##offset##_crit(struct device *dev, const char *buf, \ 487static ssize_t set_temp##offset##_crit(struct device *dev, struct device_attribute *attr, const char *buf, \
488 size_t count) \ 488 size_t count) \
489{ \ 489{ \
490 struct i2c_client *client = to_i2c_client(dev); \ 490 struct i2c_client *client = to_i2c_client(dev); \
@@ -512,19 +512,19 @@ show_and_set_therm(4)
512show_and_set_therm(5) 512show_and_set_therm(5)
513show_and_set_therm(6) 513show_and_set_therm(6)
514 514
515static ssize_t show_vid(struct device *dev, char *buf) 515static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
516{ 516{
517 struct pc87360_data *data = pc87360_update_device(dev); 517 struct pc87360_data *data = pc87360_update_device(dev);
518 return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm)); 518 return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm));
519} 519}
520static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); 520static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
521 521
522static ssize_t show_vrm(struct device *dev, char *buf) 522static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf)
523{ 523{
524 struct pc87360_data *data = pc87360_update_device(dev); 524 struct pc87360_data *data = pc87360_update_device(dev);
525 return sprintf(buf, "%u\n", data->vrm); 525 return sprintf(buf, "%u\n", data->vrm);
526} 526}
527static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) 527static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
528{ 528{
529 struct i2c_client *client = to_i2c_client(dev); 529 struct i2c_client *client = to_i2c_client(dev);
530 struct pc87360_data *data = i2c_get_clientdata(client); 530 struct pc87360_data *data = i2c_get_clientdata(client);
@@ -533,7 +533,7 @@ static ssize_t set_vrm(struct device *dev, const char *buf, size_t count)
533} 533}
534static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); 534static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm);
535 535
536static ssize_t show_in_alarms(struct device *dev, char *buf) 536static ssize_t show_in_alarms(struct device *dev, struct device_attribute *attr, char *buf)
537{ 537{
538 struct pc87360_data *data = pc87360_update_device(dev); 538 struct pc87360_data *data = pc87360_update_device(dev);
539 return sprintf(buf, "%u\n", data->in_alarms); 539 return sprintf(buf, "%u\n", data->in_alarms);
@@ -541,32 +541,32 @@ static ssize_t show_in_alarms(struct device *dev, char *buf)
541static DEVICE_ATTR(alarms_in, S_IRUGO, show_in_alarms, NULL); 541static DEVICE_ATTR(alarms_in, S_IRUGO, show_in_alarms, NULL);
542 542
543#define show_and_set_temp(offset) \ 543#define show_and_set_temp(offset) \
544static ssize_t show_temp##offset##_input(struct device *dev, char *buf) \ 544static ssize_t show_temp##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \
545{ \ 545{ \
546 struct pc87360_data *data = pc87360_update_device(dev); \ 546 struct pc87360_data *data = pc87360_update_device(dev); \
547 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \ 547 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \
548} \ 548} \
549static ssize_t show_temp##offset##_min(struct device *dev, char *buf) \ 549static ssize_t show_temp##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \
550{ \ 550{ \
551 struct pc87360_data *data = pc87360_update_device(dev); \ 551 struct pc87360_data *data = pc87360_update_device(dev); \
552 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[offset-1])); \ 552 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[offset-1])); \
553} \ 553} \
554static ssize_t show_temp##offset##_max(struct device *dev, char *buf) \ 554static ssize_t show_temp##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \
555{ \ 555{ \
556 struct pc87360_data *data = pc87360_update_device(dev); \ 556 struct pc87360_data *data = pc87360_update_device(dev); \
557 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[offset-1])); \ 557 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[offset-1])); \
558}\ 558}\
559static ssize_t show_temp##offset##_crit(struct device *dev, char *buf) \ 559static ssize_t show_temp##offset##_crit(struct device *dev, struct device_attribute *attr, char *buf) \
560{ \ 560{ \
561 struct pc87360_data *data = pc87360_update_device(dev); \ 561 struct pc87360_data *data = pc87360_update_device(dev); \
562 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit[offset-1])); \ 562 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit[offset-1])); \
563}\ 563}\
564static ssize_t show_temp##offset##_status(struct device *dev, char *buf) \ 564static ssize_t show_temp##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \
565{ \ 565{ \
566 struct pc87360_data *data = pc87360_update_device(dev); \ 566 struct pc87360_data *data = pc87360_update_device(dev); \
567 return sprintf(buf, "%d\n", data->temp_status[offset-1]); \ 567 return sprintf(buf, "%d\n", data->temp_status[offset-1]); \
568}\ 568}\
569static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ 569static ssize_t set_temp##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \
570 size_t count) \ 570 size_t count) \
571{ \ 571{ \
572 struct i2c_client *client = to_i2c_client(dev); \ 572 struct i2c_client *client = to_i2c_client(dev); \
@@ -580,7 +580,7 @@ static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \
580 up(&data->update_lock); \ 580 up(&data->update_lock); \
581 return count; \ 581 return count; \
582} \ 582} \
583static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ 583static ssize_t set_temp##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \
584 size_t count) \ 584 size_t count) \
585{ \ 585{ \
586 struct i2c_client *client = to_i2c_client(dev); \ 586 struct i2c_client *client = to_i2c_client(dev); \
@@ -594,7 +594,7 @@ static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \
594 up(&data->update_lock); \ 594 up(&data->update_lock); \
595 return count; \ 595 return count; \
596} \ 596} \
597static ssize_t set_temp##offset##_crit(struct device *dev, const char *buf, \ 597static ssize_t set_temp##offset##_crit(struct device *dev, struct device_attribute *attr, const char *buf, \
598 size_t count) \ 598 size_t count) \
599{ \ 599{ \
600 struct i2c_client *client = to_i2c_client(dev); \ 600 struct i2c_client *client = to_i2c_client(dev); \
@@ -622,7 +622,7 @@ show_and_set_temp(1)
622show_and_set_temp(2) 622show_and_set_temp(2)
623show_and_set_temp(3) 623show_and_set_temp(3)
624 624
625static ssize_t show_temp_alarms(struct device *dev, char *buf) 625static ssize_t show_temp_alarms(struct device *dev, struct device_attribute *attr, char *buf)
626{ 626{
627 struct pc87360_data *data = pc87360_update_device(dev); 627 struct pc87360_data *data = pc87360_update_device(dev);
628 return sprintf(buf, "%u\n", data->temp_alarms); 628 return sprintf(buf, "%u\n", data->temp_alarms);