summaryrefslogtreecommitdiffstats
path: root/common/clock.c
diff options
context:
space:
mode:
authorAntony Pavlov <antonynpavlov@gmail.com>2014-10-07 19:42:07 +0400
committerSascha Hauer <s.hauer@pengutronix.de>2014-10-08 11:12:54 +0200
commitd096cafff7a83c6b946f350ef441918a65f9933d (patch)
treeb98fae15358cb62167be361c0728b2de39e70ff7 /common/clock.c
parent86ef8cb8fb7f98e859d17a59306fc5e346604a92 (diff)
downloadbarebox-d096cafff7a83c6b946f350ef441918a65f9933d.tar.gz
clock.c: fix whitespaces
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/clock.c')
-rw-r--r--common/clock.c94
1 files 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)