Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68738
b: refs/heads/master
c: 5fbea51
h: refs/heads/master
v: v3
  • Loading branch information
Jean Delvare authored and Mark M. Hoffman committed Oct 10, 2007
1 parent 588abd9 commit 1955a7c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2ed4263308971af3a7a0f20bef6b2257ea230a71
refs/heads/master: 5fbea518dab712af63076aed897fce89cd7faec3
32 changes: 15 additions & 17 deletions trunk/Documentation/hwmon/sysfs-interface
Original file line number Diff line number Diff line change
Expand Up @@ -450,22 +450,20 @@ continuous like for example a tempX_type, then when an invalid value is
written, -EINVAL should be returned.

Example1, temp1_max, register is a signed 8 bit value (-128 - 127 degrees):
--- begin code ---
long v = simple_strtol(buf, NULL, 10) / 1000;
SENSORS_LIMIT(v, -128, 127);
/* write v to register */
--- end code ---

long v = simple_strtol(buf, NULL, 10) / 1000;
v = SENSORS_LIMIT(v, -128, 127);
/* write v to register */

Example2, fan divider setting, valid values 2, 4 and 8:
--- begin code ---
unsigned long v = simple_strtoul(buf, NULL, 10);

switch (v) {
case 2: v = 1; break;
case 4: v = 2; break;
case 8: v = 3; break;
default:
return -EINVAL;
}
/* write v to register */
--- end code ---

unsigned long v = simple_strtoul(buf, NULL, 10);

switch (v) {
case 2: v = 1; break;
case 4: v = 2; break;
case 8: v = 3; break;
default:
return -EINVAL;
}
/* write v to register */

0 comments on commit 1955a7c

Please sign in to comment.