Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1423624

[PATCH] tools include: Fix wrong macro definitions for cpu_to_le* for big endian

From He Kuang <hekuang@huawei.com>
Newsgroups linux.kernel
Subject [PATCH] tools include: Fix wrong macro definitions for cpu_to_le* for big endian
Date 2016-06-16 03:30 +0200
Message-ID <rKui6-1LO-5@gated-at.bofh.it> (permalink)
References <rKqHw-7SL-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.3.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] tools/perf: fix the word selected in find_*_bit Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2016-06-15 13:50 +0200
  Re: [PATCH] tools/perf: fix the word selected in find_*_bit "George Spelvin" <linux@sciencehorizons.net> - 2016-06-15 14:50 +0200
    Re: [PATCH] tools/perf: fix the word selected in find_*_bit Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2016-06-16 09:30 +0200
  Re: [PATCH] tools/perf: fix the word selected in find_*_bit Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-15 23:40 +0200
    [PATCH] tools include: Fix wrong macro definitions for cpu_to_le* for big endian He Kuang <hekuang@huawei.com> - 2016-06-16 03:30 +0200
    [PATCH 1/2] tools include: Sync byteorder/generic.h He Kuang <hekuang@huawei.com> - 2016-06-16 03:40 +0200
      Re: [PATCH 1/2] tools include: Sync byteorder/generic.h Jiri Olsa <jolsa@redhat.com> - 2016-06-16 08:40 +0200
    Re: [PATCH] tools/perf: fix the word selected in find_*_bit Hekuang <hekuang@huawei.com> - 2016-06-16 03:40 +0200
    [PATCH 2/2] tools include: Fix wrong macro definitions for cpu_to_le* for big endian He Kuang <hekuang@huawei.com> - 2016-06-16 03:40 +0200
      Re: [PATCH 2/2] tools include: Fix wrong macro definitions for  cpu_to_le* for big endian Jiri Olsa <jolsa@redhat.com> - 2016-06-16 08:40 +0200
  Re: [PATCH] tools/perf: fix the word selected in find_*_bit Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2016-06-16 09:20 +0200
  Re: [PATCH] tools/perf: fix the word selected in find_*_bit Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2016-06-16 15:20 +0200

csiph-web