summaryrefslogtreecommitdiffstats
path: root/Documentation/hwmon/sysfs-interface
diff options
context:
space:
mode:
authorJean Delvare2007-10-07 22:44:33 +0200
committerMark M. Hoffman2007-10-10 04:56:32 +0200
commit5fbea518dab712af63076aed897fce89cd7faec3 (patch)
tree98a99b2b22210e7a4b7b35a4f1bc82a950630cd7 /Documentation/hwmon/sysfs-interface
parenthwmon: update sysfs interface document - error handling (diff)
downloadkernel-qcow2-linux-5fbea518dab712af63076aed897fce89cd7faec3.tar.gz
kernel-qcow2-linux-5fbea518dab712af63076aed897fce89cd7faec3.tar.xz
kernel-qcow2-linux-5fbea518dab712af63076aed897fce89cd7faec3.zip
hwmon: Fix the code examples in documentation
Fix a bug in the code examples, make them comply with CodingStyle, and indent them for a better redability. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'Documentation/hwmon/sysfs-interface')
-rw-r--r--Documentation/hwmon/sysfs-interface32
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
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 */