Thread (3 messages) 3 messages, 3 authors, 2016-02-29

RE: [PATCH 1/2] can: rcar_can: Add r8a7795 support

From: Ramesh Shanmugasundaram <hidden>
Date: 2016-02-29 11:06:34
Also in: linux-arm-kernel, linux-can, linux-renesas-soc, netdev

Possibly related (same subject, not in this thread)

Hi Geert,
On Mon, Feb 29, 2016 at 10:21 AM, Ramesh Shanmugasundaram
[off-list ref] wrote:
quoted
--- a/drivers/net/can/rcar_can.c
+++ b/drivers/net/can/rcar_can.c
@@ -808,6 +808,10 @@ static int rcar_can_probe(struct platform_device
*pdev)
quoted
        priv->regs = addr;
        priv->clock_select = clock_select;
        priv->can.clock.freq = clk_get_rate(priv->can_clk);
+
+       /* Use the rounded clock value (nearest kHz) */
+       priv->can.clock.freq = 1000 *
+ DIV_ROUND_UP(priv->can.clock.freq, 1000);
The comment and the implementation don't match.
To get the nearest kHz, you have to useDIV_ROUND_CLOSEST().
Thanks Geert. Yes, DIV_ROUND_CLOSEST() would be apt as you pointed out.
I'll be removing this hack when I rebase, as Marc is fixing the algorithm.

Thanks,
Ramesh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help