Fix compilation of powerpc asm-offsets.c with old gcc

Commit ad7f71674a ("[POWERPC] Use a
sensible default for clock_getres() in the VDSO") corrected the clock
resolution reported by the VDSO clock_getres() but introduced another
problem in that older versions of gcc (gcc-4.0 and earlier) fail to
compile the new code in arch/powerpc/kernel/asm-offsets.c.

This fixes it by introducing a new MONOTONIC_RES_NSEC define in the
generic code which is equivalent to KTIME_MONOTONIC_RES but is just an
integer constant, not a ktime union.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Tony Breeds 2008-02-08 09:24:52 +11:00 committed by Linus Torvalds
parent 145e923076
commit 151db1fc23
3 changed files with 7 additions and 3 deletions

View File

@ -313,7 +313,7 @@ int main(void)
DEFINE(CLOCK_REALTIME, CLOCK_REALTIME); DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC); DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
DEFINE(NSEC_PER_SEC, NSEC_PER_SEC); DEFINE(NSEC_PER_SEC, NSEC_PER_SEC);
DEFINE(CLOCK_REALTIME_RES, (KTIME_MONOTONIC_RES).tv64); DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
#ifdef CONFIG_BUG #ifdef CONFIG_BUG
DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry)); DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry));

View File

@ -225,11 +225,14 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
* idea of the (in)accuracy of timers. Timer values are rounded up to * idea of the (in)accuracy of timers. Timer values are rounded up to
* this resolution values. * this resolution values.
*/ */
# define KTIME_HIGH_RES (ktime_t) { .tv64 = 1 } # define HIGH_RES_NSEC 1
# define KTIME_HIGH_RES (ktime_t) { .tv64 = HIGH_RES_NSEC }
# define MONOTONIC_RES_NSEC HIGH_RES_NSEC
# define KTIME_MONOTONIC_RES KTIME_HIGH_RES # define KTIME_MONOTONIC_RES KTIME_HIGH_RES
#else #else
# define MONOTONIC_RES_NSEC LOW_RES_NSEC
# define KTIME_MONOTONIC_RES KTIME_LOW_RES # define KTIME_MONOTONIC_RES KTIME_LOW_RES
/* /*

View File

@ -316,7 +316,8 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
* idea of the (in)accuracy of timers. Timer values are rounded up to * idea of the (in)accuracy of timers. Timer values are rounded up to
* this resolution values. * this resolution values.
*/ */
#define KTIME_LOW_RES (ktime_t){ .tv64 = TICK_NSEC } #define LOW_RES_NSEC TICK_NSEC
#define KTIME_LOW_RES (ktime_t){ .tv64 = LOW_RES_NSEC }
/* Get the monotonic time in timespec format: */ /* Get the monotonic time in timespec format: */
extern void ktime_get_ts(struct timespec *ts); extern void ktime_get_ts(struct timespec *ts);