From: Hans de Goede <hdegoede@redhat.com>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [RFC] Asus ATK0110 ACPI hwmon driver
Date: Sun, 04 Jan 2009 22:13:30 +0000 [thread overview]
Message-ID: <4961348A.3060100@redhat.com> (raw)
In-Reply-To: <20081229205537.GA11072@dreamland.darkstar.lan>
Luca Tettamanti wrote:
> Il Sun, Jan 04, 2009 at 08:14:25PM +0100, Hans de Goede ha scritto:
>> Luca Tettamanti wrote:
>>> 2 has been taken care of
>> Nice! One small mistake though, you forgot to do the value *= 100 when
>> its a temp sensor in the show_limitX functions.
>
> Ops, fixed.
>
>>> will do 3.
>> Ok.
>
> It was simpler than I thought: I implemented per-attribute caching since
> updating all the values may take a long time (here unconnected fans take
> about 0.5s); the interval between reading is 1s (due to the high latency
> of the fan sensor it probably makes little sense to lower this value).
>
Erm, your current code is not correct (as in will not work under all
circumstances). Your current code initializes last_updated to 0 for all new
sensors, and you do not use a valid flag (as the other hwmon drivers do).
Notice that jiffies can wrap! And time_after handles this, so to make this easy
lets say that the jiffies counter is only 8 bits, then a counter value of 128
is not after 0, but rather before. So if your driver gets loaded (or is not
used before) the jiffies counter reaching over half its range, then the current
time will be seen as before the 0 init value of last_updated, so no update will
be done. This is why all the other hwmon drivers have a combo of a valid flag
and a last_updated counter, and first check the flag, and only when that is set
(which happens after the first caching, when last_updated also gets set to
something sane) then check the last_updated counter.
Regards,
Hans
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2009-01-04 22:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-29 20:55 [lm-sensors] [RFC] Asus ATK0110 ACPI hwmon driver Luca Tettamanti
2008-12-30 14:01 ` Gabriel C
2008-12-30 14:09 ` Luca Tettamanti
2008-12-30 14:28 ` Gabriel C
2009-01-01 22:09 ` Hans de Goede
2009-01-01 22:10 ` Hans de Goede
2009-01-04 12:32 ` Hans de Goede
2009-01-04 14:56 ` Iain Paton
2009-01-04 18:08 ` Luca Tettamanti
2009-01-04 19:14 ` Hans de Goede
2009-01-04 21:23 ` Luca Tettamanti
2009-01-04 22:13 ` Hans de Goede [this message]
2009-01-05 17:25 ` Luca Tettamanti
2009-01-05 17:26 ` Luca Tettamanti
2009-01-05 18:12 ` Iain Paton
2009-01-05 19:00 ` Hans de Goede
2009-01-05 20:10 ` Luca Tettamanti
2009-01-06 8:20 ` Hans de Goede
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=4961348A.3060100@redhat.com \
--to=hdegoede@redhat.com \
--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.