This is a note to let you know that I've just added the patch titled pwm: omap-dmtimer: Round load and match values rather than truncate to the 4.5-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: pwm-omap-dmtimer-round-load-and-match-values-rather-than-truncate.patch and it can be found in the queue-4.5 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 7b0883f33809ff0aeca9848193c31629a752bb77 Mon Sep 17 00:00:00 2001 From: David Rivshin <drivshin@xxxxxxxxxxx> Date: Fri, 29 Jan 2016 23:26:53 -0500 Subject: pwm: omap-dmtimer: Round load and match values rather than truncate From: David Rivshin <drivshin@xxxxxxxxxxx> commit 7b0883f33809ff0aeca9848193c31629a752bb77 upstream. When converting period and duty_cycle from nanoseconds to fclk cycles, the error introduced by the integer division can be appreciable, especially in the case of slow fclk or short period. Use DIV_ROUND_CLOSEST_ULL() so that the error is kept to +/- 0.5 clock cycles. Fixes: 6604c6556db9 ("pwm: Add PWM driver for OMAP using dual-mode timers") Signed-off-by: David Rivshin <drivshin@xxxxxxxxxxx> Acked-by: Neil Armstrong <narmstrong@xxxxxxxxxxxx> Signed-off-by: Thierry Reding <thierry.reding@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/pwm/pwm-omap-dmtimer.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/pwm/pwm-omap-dmtimer.c +++ b/drivers/pwm/pwm-omap-dmtimer.c @@ -49,11 +49,7 @@ to_pwm_omap_dmtimer_chip(struct pwm_chip static u32 pwm_omap_dmtimer_get_clock_cycles(unsigned long clk_rate, int ns) { - u64 c = (u64)clk_rate * ns; - - do_div(c, NSEC_PER_SEC); - - return c; + return DIV_ROUND_CLOSEST_ULL((u64)clk_rate * ns, NSEC_PER_SEC); } static void pwm_omap_dmtimer_start(struct pwm_omap_dmtimer_chip *omap) Patches currently in stable-queue which might be from drivshin@xxxxxxxxxxx are queue-4.5/pwm-omap-dmtimer-fix-inaccurate-period-and-duty-cycle-calculations.patch queue-4.5/pwm-omap-dmtimer-add-sanity-checking-for-load-and-match-values.patch queue-4.5/pwm-omap-dmtimer-round-load-and-match-values-rather-than-truncate.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html