From: khali@linux-fr.org (Jean Delvare)
To: lm-sensors@vger.kernel.org
Subject: it87 pwm patch for 2.6.6
Date: Thu, 19 May 2005 06:25:00 +0000 [thread overview]
Message-ID: <20040605102716.037e9af3.khali@linux-fr.org> (raw)
In-Reply-To: <20040516205100.GA9996@nemo.sby.abo.fi>
> > You could fix IN_FROM_REG(val) too, while you're at it. It misses a
> > +5 for correct rounding. It's fixed in 2.4, but was forgotten in
> > 2.6.
>
> Hmm. Are you sure? I'm a bit confused about the rounding issue here. I
> think IN_TO_REG(val) should be rounded, but not IN_FROM_REG(val). (I'm
> looking at the 2.6 version). Just like in the
> TEMP_TO_REG(val)/TEMP_FROM_REG(val) case (btw, there was a bug in my
> cleanup patch with TEMP_TO_REG and rounding, fixed it).
It's not a matter of where the value come from, it's a matter of whether
the conversion includes a division or not. Whenever you divide, you have
to take care of proper rounding yourself because integer arithmetics
won't.
IN_FROM_REG(val) was including a division by 10 so far, thus my comment
about missing rounding. But since you also fixed this converter so as to
prevent unneeded accuracy loss, no division is used anymore, so there is
no rounding issue to be discussed.
Nice catching for TEMP_TO_REG, I completely missed that one. BTW, now
that I took a longer look at it, I really wonder how a negative
temperature limit could ever been set with this. Looks like it'll end up
with 0. OTOH, asking for a temperature higher than 127.5 degrees will
most likely lead to "random" negative values. This is probably true for
both the 2.4 and the 2.6 driver as of now. Could you please test and
confirm? Most likely nobody cares about setting negative limits, but
while we're at cleaning up this part of the driver...
> Attached is it87_cleanups_2.6.7-rc2-jm2.patch, same as the earlier one
> except for these rounding macros. I hope I got them right ;).
Yes, looks very good to me (except for my comment above about setting
negative temperature limits).
Thanks.
--
Jean Delvare
http://khali.linux-fr.org/
next prev parent reply other threads:[~2005-05-19 6:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-19 6:24 it87 pwm patch for 2.6.6 Jonas Munsin
2005-05-19 6:24 ` Jean Delvare
2005-05-19 6:24 ` Jean Delvare
2005-05-19 6:25 ` Jean Delvare [this message]
2005-05-19 6:25 ` Jonas Munsin
2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Jonas Munsin
2005-05-19 6:25 ` Jonas Munsin
2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` 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=20040605102716.037e9af3.khali@linux-fr.org \
--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.