From patchwork Sun Jun 26 11:20:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: He Kuang X-Patchwork-Id: 70885 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp617253qgy; Sun, 26 Jun 2016 04:29:01 -0700 (PDT) X-Received: by 10.66.75.72 with SMTP id a8mr23041140paw.99.1466940539838; Sun, 26 Jun 2016 04:28:59 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si18966063pax.194.2016.06.26.04.28.59; Sun, 26 Jun 2016 04:28:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752810AbcFZL2H (ORCPT + 30 others); Sun, 26 Jun 2016 07:28:07 -0400 Received: from szxga04-in.huawei.com ([58.251.152.52]:20269 "EHLO szxga04-in.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752326AbcFZLV6 (ORCPT ); Sun, 26 Jun 2016 07:21:58 -0400 Received: from 172.24.1.46 (EHLO lggeml424-hub.china.huawei.com) ([172.24.1.46]) by szxrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id BSN98858; Sun, 26 Jun 2016 19:10:51 +0800 (CST) Received: from euler.hulk-profiling (10.107.193.250) by lggeml424-hub.china.huawei.com (10.72.61.34) with Microsoft SMTP Server id 14.3.235.1; Sun, 26 Jun 2016 19:21:27 +0800 From: He Kuang To: , , , , , , , , CC: Subject: [RFC PATCH v2 02/26] tools include: Fix wrong macro definitions for cpu_to_le* for big endian Date: Sun, 26 Jun 2016 11:20:54 +0000 Message-ID: <1466940078-65581-3-git-send-email-hekuang@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1466940078-65581-1-git-send-email-hekuang@huawei.com> References: <1466940078-65581-1-git-send-email-hekuang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.250] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.576FBAC8.004C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 8bf4421cb560cb5a45ee0699f8f51192 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wang Nan 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 definitions of those macros in intel-bts.c and intel-pt-pkt-decoder.c. Signed-off-by: Wang Nan Signed-off-by: He Kuang --- tools/include/linux/kernel.h | 7 +------ tools/perf/util/intel-bts.c | 5 ----- tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | 7 +------ 3 files changed, 2 insertions(+), 17 deletions(-) -- 1.8.5.2 diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h index 76df535..ccf8daf 100644 --- a/tools/include/linux/kernel.h +++ b/tools/include/linux/kernel.h @@ -63,12 +63,7 @@ #endif #endif -/* - * Both 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 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 749e6f2..bffd953 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; diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c index b1257c8..9a428f7 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "intel-pt-pkt-decoder.h" @@ -27,17 +28,11 @@ #define NR_FLAG BIT63 #if __BYTE_ORDER == __BIG_ENDIAN -#define le16_to_cpu bswap_16 -#define le32_to_cpu bswap_32 -#define le64_to_cpu bswap_64 #define memcpy_le64(d, s, n) do { \ memcpy((d), (s), (n)); \ *(d) = le64_to_cpu(*(d)); \ } while (0) #else -#define le16_to_cpu -#define le32_to_cpu -#define le64_to_cpu #define memcpy_le64 memcpy #endif