lkml.org 
[lkml]   [2016]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] tools include: Fix wrong macro definitions for cpu_to_le* for big endian
Date
From: Wang Nan <wangnan0@huawei.com>

The cpu_to_le* macros in kernel.h are defined without considering
endianese. This patch includes "byteoder/generic.h" instead to fix the
bug, and removes redundant le64_to_cpu definition in intel-bts.c.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: He Kuang <hekuang@huawei.com>
---
tools/include/linux/kernel.h | 5 ++---
tools/perf/util/intel-bts.c | 5 -----
2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h
index 76df535..6145e41 100644
--- a/tools/include/linux/kernel.h
+++ b/tools/include/linux/kernel.h
@@ -64,11 +64,10 @@
#endif

/*
- * Both need more care to handle endianness
+ * Need more care to handle endianness
* (Don't use bitmap_copy_le() for now)
*/
-#define cpu_to_le64(x) (x)
-#define cpu_to_le32(x) (x)
+#include <linux/byteorder/generic.h>

static inline int
vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 9df9960..0e632c4 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -40,11 +40,6 @@
#define INTEL_BTS_ERR_NOINSN 5
#define INTEL_BTS_ERR_LOST 9

-#if __BYTE_ORDER == __BIG_ENDIAN
-#define le64_to_cpu bswap_64
-#else
-#define le64_to_cpu
-#endif

struct intel_bts {
struct auxtrace auxtrace;
--
1.8.5.2
\
 
 \ /
  Last update: 2016-06-16 04:21    [W:2.017 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site