All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: [PATCH 5/5] perf intel-pt: Prefer get_unaligned_le64 to memcpy_le64
Date: Thu,  5 Oct 2023 22:04:51 +0300	[thread overview]
Message-ID: <20231005190451.175568-6-adrian.hunter@intel.com> (raw)
In-Reply-To: <20231005190451.175568-1-adrian.hunter@intel.com>

Use get_unaligned_le64() instead of memcpy_le64(..., 8) because it produces
simpler code.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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 7a90218aecb1..bccb988a7a44 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
@@ -190,7 +190,7 @@ static int intel_pt_get_mnt(const unsigned char *buf, size_t len,
 	if (len < 11)
 		return INTEL_PT_NEED_MORE_BYTES;
 	packet->type = INTEL_PT_MNT;
-	memcpy_le64(&packet->payload, buf + 3, 8);
+	packet->payload = get_unaligned_le64(buf + 3);
 	return 11;
 }
 
@@ -302,7 +302,7 @@ static int intel_pt_get_bip_8(const unsigned char *buf, size_t len,
 		return INTEL_PT_NEED_MORE_BYTES;
 	packet->type = INTEL_PT_BIP;
 	packet->count = buf[0] >> 3;
-	memcpy_le64(&packet->payload, buf + 1, 8);
+	packet->payload = get_unaligned_le64(buf + 1);
 	return 9;
 }
 
@@ -341,7 +341,7 @@ static int intel_pt_get_evd(const unsigned char *buf, size_t len,
 	packet->type = INTEL_PT_EVD;
 	packet->count = buf[2] & 0x3f;
 	packet->payload = buf[3];
-	memcpy_le64(&packet->payload, buf + 3, 8);
+	packet->payload = get_unaligned_le64(buf + 3);
 	return 11;
 }
 
-- 
2.34.1


  parent reply	other threads:[~2023-10-05 19:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05 19:04 [PATCH 0/5] perf intel-pt: Use of get_unaligned_le16() etc Adrian Hunter
2023-10-05 19:04 ` [PATCH 1/5] perf tools: Add get_unaligned_leNN() Adrian Hunter
2023-10-05 19:38   ` Arnaldo Carvalho de Melo
2023-10-10 14:29     ` Adrian Hunter
2023-10-26 13:44     ` Arnaldo Carvalho de Melo
2023-10-26 16:09       ` Adrian Hunter
2023-10-26 20:08         ` Arnaldo Carvalho de Melo
2023-11-09 19:34         ` Arnaldo Carvalho de Melo
2023-10-05 19:04 ` [PATCH 2/5] perf intel-pt: Simplify intel_pt_get_vmcs() Adrian Hunter
2023-10-05 19:04 ` [PATCH 3/5] perf intel-pt: Use existing definitions of le16_to_cpu() etc Adrian Hunter
2023-10-05 19:04 ` [PATCH 4/5] perf intel-pt: Use get_unaligned_le16() etc Adrian Hunter
2023-10-05 19:04 ` Adrian Hunter [this message]
2023-10-10 14:22 ` [PATCH] perf tools: Add unaligned.h to check-headers.sh Adrian Hunter
2023-10-10 15:28   ` Ian Rogers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231005190451.175568-6-adrian.hunter@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@kernel.org \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.