linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Daniel Lezcano <daniel.lezcano@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>,
	Chris Brandt <Chris.Brandt@renesas.com>,
	linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH v3 1/3] clocksource/drivers/renesas-ostm: Use DIV_ROUND_CLOSEST() helper
Date: Wed,  7 Aug 2019 10:46:33 +0200	[thread overview]
Message-ID: <20190807084635.24173-2-geert+renesas@glider.be> (raw)
In-Reply-To: <20190807084635.24173-1-geert+renesas@glider.be>

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

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
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


  reply	other threads:[~2019-08-07  8:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07  8:46 [PATCH v3 0/3] clocksource/drivers/ostm: Miscellaneous improvements Geert Uytterhoeven
2019-08-07  8:46 ` Geert Uytterhoeven [this message]
2019-08-16 12:58   ` [PATCH v3 1/3] clocksource/drivers/renesas-ostm: Use DIV_ROUND_CLOSEST() helper Simon Horman
2019-08-16 13:00     ` Daniel Lezcano
2019-08-07  8:46 ` [PATCH v3 2/3] clocksource/drivers/renesas-ostm: Fix probe error path Geert Uytterhoeven
2019-08-07 18:13   ` Daniel Lezcano
2019-08-07 18:56     ` Geert Uytterhoeven
2019-08-16 13:19     ` Simon Horman
2019-08-07  8:46 ` [PATCH v3 3/3] clocksource/drivers/ostm: Use unique device name instead of ostm Geert Uytterhoeven
2019-08-16 13:11   ` Simon Horman
2019-08-16 13:12     ` Simon Horman
2019-08-16 13:18     ` Geert Uytterhoeven
2019-08-21 14:12       ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190807084635.24173-2-geert+renesas@glider.be \
    --to=geert+renesas@glider.be \
    --cc=Chris.Brandt@renesas.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=jacopo+renesas@jmondi.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).