Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5fbea518 authored by Jean Delvare's avatar Jean Delvare Committed by Mark M. Hoffman
Browse files

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: default avatarJean Delvare <khali@linux-fr.org>
Acked-by: default avatarHans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: default avatarMark M. Hoffman <mhoffman@lightlink.com>
parent 2ed42633
Loading
Loading
Loading
Loading
+15 −17
Original line number Diff line number Diff line
@@ -450,14 +450,13 @@ 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);
	v = SENSORS_LIMIT(v, -128, 127);
	/* write v to register */
--- end code ---

Example2, fan divider setting, valid values 2, 4 and 8:
--- begin code ---

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

	switch (v) {
@@ -468,4 +467,3 @@ switch (v) {
		return -EINVAL;
	}
	/* write v to register */
--- end code ---