diff options
Diffstat (limited to 'Documentation/hwmon')
-rw-r--r-- | Documentation/hwmon/sysfs-interface | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface index a2153c4616ad..a17b692d2679 100644 --- a/Documentation/hwmon/sysfs-interface +++ b/Documentation/hwmon/sysfs-interface | |||
@@ -450,22 +450,20 @@ continuous like for example a tempX_type, then when an invalid value is | |||
450 | written, -EINVAL should be returned. | 450 | written, -EINVAL should be returned. |
451 | 451 | ||
452 | Example1, temp1_max, register is a signed 8 bit value (-128 - 127 degrees): | 452 | Example1, temp1_max, register is a signed 8 bit value (-128 - 127 degrees): |
453 | --- begin code --- | 453 | |
454 | long v = simple_strtol(buf, NULL, 10) / 1000; | 454 | long v = simple_strtol(buf, NULL, 10) / 1000; |
455 | SENSORS_LIMIT(v, -128, 127); | 455 | v = SENSORS_LIMIT(v, -128, 127); |
456 | /* write v to register */ | 456 | /* write v to register */ |
457 | --- end code --- | ||
458 | 457 | ||
459 | Example2, fan divider setting, valid values 2, 4 and 8: | 458 | Example2, fan divider setting, valid values 2, 4 and 8: |
460 | --- begin code --- | 459 | |
461 | unsigned long v = simple_strtoul(buf, NULL, 10); | 460 | unsigned long v = simple_strtoul(buf, NULL, 10); |
462 | 461 | ||
463 | switch (v) { | 462 | switch (v) { |
464 | case 2: v = 1; break; | 463 | case 2: v = 1; break; |
465 | case 4: v = 2; break; | 464 | case 4: v = 2; break; |
466 | case 8: v = 3; break; | 465 | case 8: v = 3; break; |
467 | default: | 466 | default: |
468 | return -EINVAL; | 467 | return -EINVAL; |
469 | } | 468 | } |
470 | /* write v to register */ | 469 | /* write v to register */ |
471 | --- end code --- | ||