[PATCH v2] Doc: networking: txtimestamp: fix printf format warning

From: Frans Klaver
Date: Thu Jun 04 2015 - 15:27:35 EST


Documentation/networking/timestamping/txtimestamp.c: In function â__print_timestampâ:
Documentation/networking/timestamping/txtimestamp.c:99:3: warning: format â%ldâ expects argument of type âlong intâ, but argument 3 has type âint64_tâ [-Wformat=]
fprintf(stderr, " (%+ld us)", cur_ms - prev_ms);

int64_t differs per platform, so a type specifier that differs along
with it is required.

Signed-off-by: Frans Klaver <fransklaver@xxxxxxxxx>
---
v1..v2: switch from cast to inttypes.h defined PRId64

Documentation/networking/timestamping/txtimestamp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/networking/timestamping/txtimestamp.c b/Documentation/networking/timestamping/txtimestamp.c
index 8217510..5df0704 100644
--- a/Documentation/networking/timestamping/txtimestamp.c
+++ b/Documentation/networking/timestamping/txtimestamp.c
@@ -36,6 +36,7 @@
#include <asm/types.h>
#include <error.h>
#include <errno.h>
+#include <inttypes.h>
#include <linux/errqueue.h>
#include <linux/if_ether.h>
#include <linux/net_tstamp.h>
@@ -49,7 +50,6 @@
#include <poll.h>
#include <stdarg.h>
#include <stdbool.h>
-#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -96,7 +96,7 @@ static void __print_timestamp(const char *name, struct timespec *cur,
prev_ms = (long) ts_prev.tv_sec * 1000 * 1000;
prev_ms += ts_prev.tv_nsec / 1000;

- fprintf(stderr, " (%+ld us)", cur_ms - prev_ms);
+ fprintf(stderr, " (%+" PRId64 " us)", cur_ms - prev_ms);
}

ts_prev = *cur;
--
2.4.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/