Skip to contentSkip to conversation

hwmon: Fix the code examples in documentation

PATCH New Jean Delvare 1 participant 1 message Oct 7, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: Fix the code examples in documentation

Hi Mark,

Quoted 10 lines · Mark M. Hoffman

Hi Jean:

Quoted 7 lines
Quoted 6 lines · Jean Delvare

Additionally, I think that the examples are a bit difficult to read, one level of indentation would probably be better than the begin/end code markers. Thus, I propose the following incremental patch:

 Documentation/hwmon/sysfs-interface |   30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)
Quoted 7 lines
Quoted 3 lines · Hans de Goede

I agree with all changes, Mark pleaee apply:

Could you please re-generate this one against the hwmon testing tree and w/ a Signed-off-by?

Sorry, I expected Hans or you to merge my changes into Hans' original patch, that's why I omitted the Signed-off-by and the log message.

* * * * *

Fix a bug in the code examples, make them comply with CodingStyle, and indent them for a better redability.

---
 Documentation/hwmon/sysfs-interface |   30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)
Documentation/hwmon/sysfs-interface +14 -16
@@ -450,22 +450,20 @@ continuous like for example a tempX_type
 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 */
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors