rtc: pcf2123: fix negative offset rounding
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 19 Jun 2019 13:17:53 +0000 (15:17 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 19 Jun 2019 14:20:31 +0000 (16:20 +0200)
commitfedc459a3da35ecf171a1d6dd9f7f51fb452baf8
tree26539ab12466d3a74b10e7a2704d205a26f47035
parente32e60a2d5ecd8affc79f7da02d3479b4116579f
rtc: pcf2123: fix negative offset rounding

Using result = (value + divisor/2) / divisor is rounding values up and only
works well for positive values. Instead use DIV_ROUND_CLOSEST which does
the correct thing.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-pcf2123.c