From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH] clock.c: fix whitespaces
Date: Tue, 7 Oct 2014 19:42:07 +0400 [thread overview]
Message-ID: <1412696527-3981-3-git-send-email-antonynpavlov@gmail.com> (raw)
In-Reply-To: <1412696527-3981-1-git-send-email-antonynpavlov@gmail.com>
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
common/clock.c | 94 +++++++++++++++++++++++++++++-----------------------------
1 file changed, 47 insertions(+), 47 deletions(-)
diff --git a/common/clock.c b/common/clock.c
index 76ce881..2ee81da 100644
--- a/common/clock.c
+++ b/common/clock.c
@@ -41,25 +41,25 @@ uint64_t time_beginning;
uint64_t get_time_ns(void)
{
struct clocksource *cs = current_clock;
- uint64_t cycle_now, cycle_delta;
- uint64_t ns_offset;
+ uint64_t cycle_now, cycle_delta;
+ uint64_t ns_offset;
if (!cs)
return 0;
- /* read clocksource: */
+ /* read clocksource: */
cycle_now = cs->read() & cs->mask;
- /* calculate the delta since the last call: */
- cycle_delta = (cycle_now - cs->cycle_last) & cs->mask;
+ /* calculate the delta since the last call: */
+ cycle_delta = (cycle_now - cs->cycle_last) & cs->mask;
- /* convert to nanoseconds: */
- ns_offset = cyc2ns(cs, cycle_delta);
+ /* convert to nanoseconds: */
+ ns_offset = cyc2ns(cs, cycle_delta);
cs->cycle_last = cycle_now;
time_ns += ns_offset;
- return time_ns;
+ return time_ns;
}
EXPORT_SYMBOL(get_time_ns);
@@ -89,32 +89,32 @@ EXPORT_SYMBOL(get_time_ns);
void clocks_calc_mult_shift(uint32_t *mult, uint32_t *shift, uint32_t from, uint32_t to, uint32_t maxsec)
{
- uint64_t tmp;
- uint32_t sft, sftacc = 32;
-
- /*
- * Calculate the shift factor which is limiting the conversion
- * range:
- */
- tmp = ((uint64_t)maxsec * from) >> 32;
- while (tmp) {
- tmp >>=1;
- sftacc--;
- }
-
- /*
- * Find the conversion shift/mult pair which has the best
- * accuracy and fits the maxsec conversion range:
- */
- for (sft = 32; sft > 0; sft--) {
- tmp = (uint64_t) to << sft;
- tmp += from / 2;
- do_div(tmp, from);
- if ((tmp >> sftacc) == 0)
- break;
- }
- *mult = tmp;
- *shift = sft;
+ uint64_t tmp;
+ uint32_t sft, sftacc = 32;
+
+ /*
+ * Calculate the shift factor which is limiting the conversion
+ * range:
+ */
+ tmp = ((uint64_t)maxsec * from) >> 32;
+ while (tmp) {
+ tmp >>= 1;
+ sftacc--;
+ }
+
+ /*
+ * Find the conversion shift/mult pair which has the best
+ * accuracy and fits the maxsec conversion range:
+ */
+ for (sft = 32; sft > 0; sft--) {
+ tmp = (uint64_t) to << sft;
+ tmp += from / 2;
+ do_div(tmp, from);
+ if ((tmp >> sftacc) == 0)
+ break;
+ }
+ *mult = tmp;
+ *shift = sft;
}
@@ -129,19 +129,19 @@ void clocks_calc_mult_shift(uint32_t *mult, uint32_t *shift, uint32_t from, uint
*/
uint32_t clocksource_hz2mult(uint32_t hz, uint32_t shift_constant)
{
- /* hz = cyc/(Billion ns)
- * mult/2^shift = ns/cyc
- * mult = ns/cyc * 2^shift
- * mult = 1Billion/hz * 2^shift
- * mult = 1000000000 * 2^shift / hz
- * mult = (1000000000<<shift) / hz
- */
- uint64_t tmp = ((uint64_t)1000000000) << shift_constant;
-
- tmp += hz/2; /* round for do_div */
- do_div(tmp, hz);
-
- return (uint32_t)tmp;
+ /* hz = cyc/(Billion ns)
+ * mult/2^shift = ns/cyc
+ * mult = ns/cyc * 2^shift
+ * mult = 1Billion/hz * 2^shift
+ * mult = 1000000000 * 2^shift / hz
+ * mult = (1000000000<<shift) / hz
+ */
+ uint64_t tmp = ((uint64_t)1000000000) << shift_constant;
+
+ tmp += hz/2; /* round for do_div */
+ do_div(tmp, hz);
+
+ return (uint32_t)tmp;
}
int is_timeout_non_interruptible(uint64_t start_ns, uint64_t time_offset_ns)
--
2.1.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2014-10-07 15:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-07 15:42 Antony Pavlov
2014-10-07 15:42 ` [PATCH] pci: split out device init Antony Pavlov
2014-10-07 15:45 ` Antony Pavlov
2014-10-07 15:42 ` Antony Pavlov [this message]
2014-10-08 9:13 ` [PATCH] clock.c: fix whitespaces Sascha Hauer
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=1412696527-3981-3-git-send-email-antonynpavlov@gmail.com \
--to=antonynpavlov@gmail.com \
--cc=barebox@lists.infradead.org \
/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