From: Jean Delvare <khali@linux-fr.org>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] PATCH:
Date: Sun, 07 Oct 2007 08:19:00 +0000 [thread overview]
Message-ID: <20071007101900.2104a980@hyperion.delvare> (raw)
In-Reply-To: <46F3DD44.4070307@hhs.nl>
Hi Hans,
On Mon, 24 Sep 2007 16:28:16 +0200, Jean Delvare wrote:
> Hi Hans,
>
> On Fri, 21 Sep 2007 17:03:32 +0200, Hans de Goede wrote:
> > Here is a patch adding some text to the sysfs interface documentation on how
> > settings written to sysfs attributes should be handled, focussing mainly on
> > error handling. This version incorperates Jean's latest comments.
> >
> > signed-off-by: j.w.r.degoede@hhs.nl
>
> Thanks for doing this.
>
> Acked-by: Jean Delvare <khali@linux-fr.org>
While reviewing your new fschmd driver, I found some mistakes which
also appear in the code examples of this documentation update:
> +--- begin code ---
> +long v = simple_strtol(buf, NULL, 10) / 1000;
> +SENSORS_LIMIT(v, -128, 127);
This is a no-op, should be v = ...
> +/* write v to register */
> +--- end code ---
> +--- 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;
> +}
Indentation doesn't comply with CodingStyle.
> +/* write v to register */
> +--- end code ---
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(-)
--- linux-2.6.23-rc9.orig/Documentation/hwmon/sysfs-interface 2007-10-07 10:12:33.000000000 +0200
+++ linux-2.6.23-rc9/Documentation/hwmon/sysfs-interface 2007-10-07 10:13:43.000000000 +0200
@@ -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 */
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2007-10-07 8:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-21 15:03 [lm-sensors] PATCH: Hans de Goede
2007-09-24 14:28 ` Jean Delvare
2007-10-07 8:19 ` Jean Delvare [this message]
2007-10-07 11:37 ` Hans de Goede
2007-10-07 18:24 ` Mark M. Hoffman
2007-10-07 18:28 ` Mark M. Hoffman
2007-10-07 20:41 ` Jean Delvare
2007-10-07 22:05 ` Jean Delvare
2007-10-31 8:42 ` Hans de Goede
2007-10-31 15:17 ` Jean Delvare
2007-11-01 23:00 ` Jean Delvare
2007-11-02 7:35 ` Hans de Goede
2007-11-02 9:44 ` Jean Delvare
2007-11-02 19:41 ` Hans de Goede
2007-11-03 16:29 ` Jean Delvare
2007-11-04 13:21 ` Hans de Goede
2007-12-17 15:56 ` Hans de Goede
2007-12-18 13:29 ` Jean Delvare
2008-06-30 14:53 ` Hans de Goede
2009-01-30 10:29 ` Hans de Goede
2009-01-30 11:06 ` Jean Delvare
-- strict thread matches above, loose matches on Subject: below --
2006-06-28 12:35 [lm-sensors] Patch: Jean Delvare
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071007101900.2104a980@hyperion.delvare \
--to=khali@linux-fr.org \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.