From: Guenter Roeck <linux@roeck-us.net>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH 1/4] hwmon: (adm1026) Use DIV_ROUND_CLOSEST to simplify implementation for S
Date: Sat, 19 Jul 2014 14:49:16 +0000 [thread overview]
Message-ID: <53CA856C.6090004@roeck-us.net> (raw)
In-Reply-To: <1405741079.13406.2.camel@phoenix>
On 07/18/2014 08:37 PM, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/hwmon/adm1026.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
> index ca8430f..c632e46 100644
> --- a/drivers/hwmon/adm1026.c
> +++ b/drivers/hwmon/adm1026.c
> @@ -196,7 +196,7 @@ static int adm1026_scaling[] = { /* .001 Volts */
> 3330, 4995, 2250, 12000, 13875
> };
> #define NEG12_OFFSET 16000
> -#define SCALE(val, from, to) (((val)*(to) + ((from)/2))/(from))
> +#define SCALE(val, from, to) DIV_ROUND_CLOSEST((val) * (to), (from))
> #define INS_TO_REG(n, val) (clamp_val(SCALE(val, adm1026_scaling[n], 192),\
> 0, 255))
> #define INS_FROM_REG(n, val) (SCALE(val, 192, adm1026_scaling[n]))
>
Hi Axel,
I don't really see the value in this series. It does not really improve anything,
or make the code smaller.
Jean, do you have any comments ?
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2014-07-19 14:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-19 3:37 [lm-sensors] [PATCH 1/4] hwmon: (adm1026) Use DIV_ROUND_CLOSEST to simplify implementation for SCALE Axel Lin
2014-07-19 14:49 ` Guenter Roeck [this message]
2014-07-19 14:57 ` [lm-sensors] [PATCH 1/4] hwmon: (adm1026) Use DIV_ROUND_CLOSEST to simplify implementation for S Axel Lin
2014-07-19 15:27 ` Guenter Roeck
2014-07-19 17:12 ` Jean Delvare
2014-07-19 18:12 ` Guenter Roeck
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=53CA856C.6090004@roeck-us.net \
--to=linux@roeck-us.net \
--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.