On 07/18/2014 08:37 PM, Axel Lin wrote:
Signed-off-by: Axel Lin <axel.lin@xxxxxxxxxx> --- 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@xxxxxxxxxxxxxx http://lists.lm-sensors.org/mailman/listinfo/lm-sensors