Commit 19ea4678ca5ce4c3a626039ed7642d4e0fbfdee1
Committed by
Tom Rini
1 parent
aac618a32b
Exists in
v2017.01-smarct4x
and in
37 other branches
Use uint64_t for time types
Unfortunately 'unsigned long long' and 'uint64_t' are not necessarily compatible on 64-bit machines. Use the correct typedef instead of writing the supposed type out in full. Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 2 changed files with 7 additions and 7 deletions Side-by-side Diff
include/common.h
lib/time.c
... | ... | @@ -37,7 +37,7 @@ |
37 | 37 | extern unsigned long __weak timer_read_counter(void); |
38 | 38 | #endif |
39 | 39 | |
40 | -unsigned long long __weak notrace get_ticks(void) | |
40 | +uint64_t __weak notrace get_ticks(void) | |
41 | 41 | { |
42 | 42 | unsigned long now = timer_read_counter(); |
43 | 43 | |
44 | 44 | |
... | ... | @@ -45,11 +45,11 @@ |
45 | 45 | if (now < gd->timebase_l) |
46 | 46 | gd->timebase_h++; |
47 | 47 | gd->timebase_l = now; |
48 | - return ((unsigned long long)gd->timebase_h << 32) | gd->timebase_l; | |
48 | + return ((uint64_t)gd->timebase_h << 32) | gd->timebase_l; | |
49 | 49 | } |
50 | 50 | |
51 | 51 | /* Returns time in milliseconds */ |
52 | -static unsigned long long notrace tick_to_time(unsigned long long tick) | |
52 | +static uint64_t notrace tick_to_time(uint64_t tick) | |
53 | 53 | { |
54 | 54 | ulong div = get_tbclk(); |
55 | 55 | |
56 | 56 | |
... | ... | @@ -74,9 +74,9 @@ |
74 | 74 | return tick_to_time(get_ticks() * 1000); |
75 | 75 | } |
76 | 76 | |
77 | -static unsigned long long usec_to_tick(unsigned long usec) | |
77 | +static uint64_t usec_to_tick(unsigned long usec) | |
78 | 78 | { |
79 | - unsigned long long tick = usec; | |
79 | + uint64_t tick = usec; | |
80 | 80 | tick *= get_tbclk(); |
81 | 81 | do_div(tick, 1000000); |
82 | 82 | return tick; |
... | ... | @@ -84,7 +84,7 @@ |
84 | 84 | |
85 | 85 | void __weak __udelay(unsigned long usec) |
86 | 86 | { |
87 | - unsigned long long tmp; | |
87 | + uint64_t tmp; | |
88 | 88 | |
89 | 89 | tmp = get_ticks() + usec_to_tick(usec); /* get current timestamp */ |
90 | 90 |