From: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
To: john.garry@huawei.com
Cc: will@kernel.org, mathieu.poirier@linaro.org, leo.yan@linaro.org,
suzuki.poulose@arm.com, mike.leach@linaro.org,
peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, namhyung@kernel.org,
linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Jiapeng Chong <jiapeng.chong@linux.alibaba.com>,
Abaci Robot <abaci@linux.alibaba.com>
Subject: [PATCH] perf cs-etm: Use swap() instead of open coding it
Date: Fri, 6 May 2022 17:17:18 +0800 [thread overview]
Message-ID: <20220506091718.82858-1-jiapeng.chong@linux.alibaba.com> (raw)
Clean the following coccicheck warning:
./tools/perf/util/cs-etm.c:418:34-35: WARNING opportunity for swap().
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
tools/perf/util/cs-etm.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 8b95fb3c4d7b..0cb555cc766f 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -406,18 +406,13 @@ struct cs_etm_packet_queue
static void cs_etm__packet_swap(struct cs_etm_auxtrace *etm,
struct cs_etm_traceid_queue *tidq)
{
- struct cs_etm_packet *tmp;
-
if (etm->synth_opts.branches || etm->synth_opts.last_branch ||
- etm->synth_opts.instructions) {
+ etm->synth_opts.instructions)
/*
* Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for
* the next incoming packet.
*/
- tmp = tidq->packet;
- tidq->packet = tidq->prev_packet;
- tidq->prev_packet = tmp;
- }
+ swap(tidq->packet, tidq->prev_packet);
}
static void cs_etm__packet_dump(const char *pkt_string)
--
2.20.1.7.g153144c
WARNING: multiple messages have this Message-ID (diff)
From: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
To: john.garry@huawei.com
Cc: will@kernel.org, mathieu.poirier@linaro.org, leo.yan@linaro.org,
suzuki.poulose@arm.com, mike.leach@linaro.org,
peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, namhyung@kernel.org,
linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Jiapeng Chong <jiapeng.chong@linux.alibaba.com>,
Abaci Robot <abaci@linux.alibaba.com>
Subject: [PATCH] perf cs-etm: Use swap() instead of open coding it
Date: Fri, 6 May 2022 17:17:18 +0800 [thread overview]
Message-ID: <20220506091718.82858-1-jiapeng.chong@linux.alibaba.com> (raw)
Clean the following coccicheck warning:
./tools/perf/util/cs-etm.c:418:34-35: WARNING opportunity for swap().
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
tools/perf/util/cs-etm.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 8b95fb3c4d7b..0cb555cc766f 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -406,18 +406,13 @@ struct cs_etm_packet_queue
static void cs_etm__packet_swap(struct cs_etm_auxtrace *etm,
struct cs_etm_traceid_queue *tidq)
{
- struct cs_etm_packet *tmp;
-
if (etm->synth_opts.branches || etm->synth_opts.last_branch ||
- etm->synth_opts.instructions) {
+ etm->synth_opts.instructions)
/*
* Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for
* the next incoming packet.
*/
- tmp = tidq->packet;
- tidq->packet = tidq->prev_packet;
- tidq->prev_packet = tmp;
- }
+ swap(tidq->packet, tidq->prev_packet);
}
static void cs_etm__packet_dump(const char *pkt_string)
--
2.20.1.7.g153144c
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2022-05-06 9:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 9:17 Jiapeng Chong [this message]
2022-05-06 9:17 ` [PATCH] perf cs-etm: Use swap() instead of open coding it Jiapeng Chong
2022-06-20 17:24 ` Mathieu Poirier
2022-06-20 17:24 ` Mathieu Poirier
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=20220506091718.82858-1-jiapeng.chong@linux.alibaba.com \
--to=jiapeng.chong@linux.alibaba.com \
--cc=abaci@linux.alibaba.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=john.garry@huawei.com \
--cc=jolsa@kernel.org \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.poirier@linaro.org \
--cc=mike.leach@linaro.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=suzuki.poulose@arm.com \
--cc=will@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.