2019-08-07 08:47:37

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH v3 1/3] clocksource/drivers/renesas-ostm: Use DIV_ROUND_CLOSEST() helper

Use the DIV_ROUND_CLOSEST() helper instead of open-coding the same
operation.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
v3:
- New.
---
drivers/clocksource/renesas-ostm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/renesas-ostm.c b/drivers/clocksource/renesas-ostm.c
index 61d5f3b539ce23df..37c39b901bb12b38 100644
--- a/drivers/clocksource/renesas-ostm.c
+++ b/drivers/clocksource/renesas-ostm.c
@@ -221,7 +221,7 @@ static int __init ostm_init(struct device_node *np)
}

rate = clk_get_rate(ostm_clk);
- ostm->ticks_per_jiffy = (rate + HZ / 2) / HZ;
+ ostm->ticks_per_jiffy = DIV_ROUND_CLOSEST(rate, HZ);

/*
* First probed device will be used as system clocksource. Any
--
2.17.1


2019-08-16 12:59:52

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] clocksource/drivers/renesas-ostm: Use DIV_ROUND_CLOSEST() helper

On Wed, Aug 07, 2019 at 10:46:33AM +0200, Geert Uytterhoeven wrote:
> Use the DIV_ROUND_CLOSEST() helper instead of open-coding the same
> operation.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
> v3:
> - New.
> ---
> drivers/clocksource/renesas-ostm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clocksource/renesas-ostm.c b/drivers/clocksource/renesas-ostm.c
> index 61d5f3b539ce23df..37c39b901bb12b38 100644
> --- a/drivers/clocksource/renesas-ostm.c
> +++ b/drivers/clocksource/renesas-ostm.c
> @@ -221,7 +221,7 @@ static int __init ostm_init(struct device_node *np)
> }
>
> rate = clk_get_rate(ostm_clk);
> - ostm->ticks_per_jiffy = (rate + HZ / 2) / HZ;
> + ostm->ticks_per_jiffy = DIV_ROUND_CLOSEST(rate, HZ);
>
> /*
> * First probed device will be used as system clocksource. Any
> --
> 2.17.1
>

2019-08-16 13:01:43

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] clocksource/drivers/renesas-ostm: Use DIV_ROUND_CLOSEST() helper

On 16/08/2019 14:58, Simon Horman wrote:
> On Wed, Aug 07, 2019 at 10:46:33AM +0200, Geert Uytterhoeven wrote:
>> Use the DIV_ROUND_CLOSEST() helper instead of open-coding the same
>> operation.
>>
>> Signed-off-by: Geert Uytterhoeven <[email protected]>
>
> Reviewed-by: Simon Horman <[email protected]>

Applied this one, thanks

I'm waiting Geert feedbacks for 2/3 and 3/3.


--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog