From: Hans de Goede <hdegoede@redhat.com>
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] PATCH: f71882fg: fix fan_to/from_reg prototypes
Date: Tue, 16 Dec 2008 16:18:24 +0000 [thread overview]
Message-ID: <4947D4D0.3020405@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 311 bytes --]
Hi Jean,
The RPM after conversion from / before conversion to a register value can be
much more then 65535 (up to 1500000), so putting this into an u16 can cause
overflows. This changes the functions to use an int to store / get RPM instead.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
[-- Attachment #2: hwmon-f71882fg-18-fix-fan-reg-funcs.patch --]
[-- Type: text/plain, Size: 740 bytes --]
The RPM after conversion from / before conversion to a register value can be
much more then 65535 (up to 1500000), so putting this into an u16 can cause
overflows. This changes the functions to use an int to store / get RPM instead.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
--- f71882fg.c.17-applied 2008-12-15 16:30:57.000000000 +0100
+++ f71882fg.c 2008-12-16 17:14:53.000000000 +0100
@@ -810,12 +810,12 @@ static inline void superio_exit(int base
outb(SIO_LOCK_KEY, base);
}
-static inline u16 fan_from_reg(u16 reg)
+static inline int fan_from_reg(u16 reg)
{
return reg ? (1500000 / reg) : 0;
}
-static inline u16 fan_to_reg(u16 fan)
+static inline u16 fan_to_reg(int fan)
{
return fan ? (1500000 / fan) : 0;
}
[-- Attachment #3: Type: text/plain, Size: 153 bytes --]
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next reply other threads:[~2008-12-16 16:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-16 16:18 Hans de Goede [this message]
2008-12-16 16:48 ` [lm-sensors] PATCH: f71882fg: fix fan_to/from_reg prototypes 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=4947D4D0.3020405@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.