LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Phil Pokorny <ppokorny@penguincomputing.com>,
LKML <linux-kernel@vger.kernel.org>,
lm-sensors <lm-sensors@lm-sensors.org>
Subject: Re: [lm-sensors] [PATCH 1/4] kernel.h: add find_closest() macro
Date: Wed, 25 Feb 2015 11:59:51 +0100 [thread overview]
Message-ID: <CAMpxmJVUcuyLJ9ju0U8kMg6AEFYijF8=_yHgYF7EMV63qbLCmg@mail.gmail.com> (raw)
In-Reply-To: <20150224205125.GB18025@roeck-us.net>
2015-02-24 21:51 GMT+01:00 Guenter Roeck <linux@roeck-us.net>:
> I think the lm85 conversion actually introduces a bug with such an
> off-by-one mistake. And if it doesn't, there is still a unexplained
> and not easy to understand '-1' in one of the calls to find_closest().
>
> So the question is if the new code really improves the situation in that
> respect.
Yes, it's a mistake. I couldn't test this one and missed this '-1'.
Sorry for that.
As for the size comparisons - at first glance it seems as if it adds bloat:
ina2xx:
add/remove: 0/0 grow/shrink: 1/0 up/down: 24/0 (24)
function old new delta
ina226_set_interval 296 320 +24
lm85:
add/remove: 0/0 grow/shrink: 3/0 up/down: 72/0 (72)
function old new delta
set_temp_auto_temp_min 364 388 +24
set_temp_auto_temp_max 336 360 +24
set_pwm_freq 284 308 +24
w83795:
add/remove: 0/0 grow/shrink: 1/0 up/down: 16/0 (16)
function old new delta
store_pwm 496 512 +16
But this actually comes from DIV_ROUND_CLOSEST() since replacing it
with a simple '/ 2' gives different results:
ina2xx.ko:
add/remove: 0/0 grow/shrink: 1/0 up/down: 6/0 (6)
function old new delta
__UNIQUE_ID_vermagic0 73 79 +6
lm85.ko:
add/remove: 0/0 grow/shrink: 1/0 up/down: 6/0 (6)
function old new delta
__UNIQUE_ID_vermagic0 73 79 +6
w83795.ko:
add/remove: 0/0 grow/shrink: 2/0 up/down: 14/0 (14)
function old new delta
store_pwm 496 504 +8
__UNIQUE_ID_vermagic0 73 79 +6
The idea however was to remove duplicated operations from source files
and prevent off-by-one bugs (how ironic the lm85 patch...), not really
to reduce size.
Bart
next prev parent reply other threads:[~2015-02-25 10:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 17:42 [PATCH 0/4] " Bartosz Golaszewski
2015-02-24 17:42 ` [PATCH 1/4] kernel.h: add " Bartosz Golaszewski
2015-02-24 20:33 ` [lm-sensors] " Phil Pokorny
2015-02-24 20:51 ` Guenter Roeck
2015-02-25 10:59 ` Bartosz Golaszewski [this message]
2015-02-26 0:13 ` Guenter Roeck
2015-02-24 17:42 ` [PATCH 2/4] hwmon: (ina2xx) replace ina226_avg_bits() with find_closest() Bartosz Golaszewski
2015-02-24 17:42 ` [PATCH 4/4] hwmon: (w83795) use find_closest_desc() in pwm_freq_to_reg() Bartosz Golaszewski
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='CAMpxmJVUcuyLJ9ju0U8kMg6AEFYijF8=_yHgYF7EMV63qbLCmg@mail.gmail.com' \
--to=bgolaszewski@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lm-sensors@lm-sensors.org \
--cc=ppokorny@penguincomputing.com \
--subject='Re: [lm-sensors] [PATCH 1/4] kernel.h: add find_closest() macro' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).