From: Alexandre Bailon Date: Tue, 8 Mar 2016 15:37:37 +0000 (+0100) Subject: greybus: loopback: round closest the sixth decimal X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=58a527afff2b27bc912dbb7111d3f23d4f28105b;p=linux-beck.git greybus: loopback: round closest the sixth decimal The original round was removed becaused it was rounding the integer whereas we had decimals. Round the sixth decimal. Signed-off-by: Alexandre Bailon Reviewed-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 75bff56b48c3..9f1cd9d6cd54 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -162,7 +162,7 @@ static ssize_t name##_avg_show(struct device *dev, \ gb = dev_get_drvdata(dev); \ stats = &gb->name; \ count = stats->count ? stats->count : 1; \ - avg = stats->sum; \ + avg = stats->sum + count / 2000000; /* round closest */ \ rem = do_div(avg, count); \ rem *= 1000000; \ do_div(rem, count); \