aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/perf_event_amd.c
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2012-04-05 18:24:42 +0200
committerIngo Molnar <mingo@kernel.org>2012-04-26 13:52:51 +0200
commit5f09fc688936705b2020ca247df39ee27283668a (patch)
tree51897b3ca3df851937d4294d65b7c61faff8ec1b /arch/x86/kernel/cpu/perf_event_amd.c
parentperf: Trivial cleanup of duplicate code (diff)
downloadlinux-dev-5f09fc688936705b2020ca247df39ee27283668a.tar.xz
linux-dev-5f09fc688936705b2020ca247df39ee27283668a.zip
perf/x86: Fix cmpxchg() usage in amd_put_event_constraints()
Now the return value of cmpxchg() is used to match an event. The change removes the duplicate event comparison and traverses the list until an event was removed. This also fixes the following warning: arch/x86/kernel/cpu/perf_event_amd.c:170: warning: value computed is not used Signed-off-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1333643084-26776-3-git-send-email-robert.richter@amd.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to '')
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 95e7fe1c5f0b..589286f28877 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -205,10 +205,8 @@ static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
* when we come here
*/
for (i = 0; i < x86_pmu.num_counters; i++) {
- if (nb->owners[i] == event) {
- cmpxchg(nb->owners+i, event, NULL);
+ if (cmpxchg(nb->owners + i, event, NULL) == event)
break;
- }
}
}