From d55d4872d65ad14efca644405812bf506805c7bf Mon Sep 17 00:00:00 2001
From: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Date: Thu, 17 Oct 2013 15:11:25 -0700
Subject: [PATCH] perf: fix bench numa compilation

Taken from: https://lkml.org/lkml/2013/6/20/80

Fix the following errors on gcc 4.8.1 / x86:

bench/numa.c: In function worker_thread:
bench/numa.c:1113:20: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
    if (diff.tv_sec >= g->p.nr_secs) {
                    ^
bench/numa.c:1161:6: error: format %lx expects argument of type long unsigned int, but argument 5 has type u64 [-Werror=format=]
      process_nr, thread_nr, runtime_ns_max / bytes_done, val);
      ^
Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Signed-off-by: Yang Shi <yang.shi@windriver.com>
---
 tools/perf/bench/numa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index f7f530081aa9..8c11141cf799 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/mman.h>
+#include <inttypes.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/wait.h>
@@ -1136,7 +1137,7 @@ static void *worker_thread(void *__tdata)
 		/* Check whether our max runtime timed out: */
 		if (g->p.nr_secs) {
 			timersub(&stop, &start0, &diff);
-			if ((u32)diff.tv_sec >= g->p.nr_secs) {
+			if ((u32)diff.tv_sec >= (long int)g->p.nr_secs) {
 				g->stop_work = true;
 				break;
 			}
-- 
2.5.0

