From: Robert Richter Date: Tue, 13 Apr 2010 20:23:15 +0000 (+0200) Subject: perf, x86: Use weight instead of cmask in for_each_event_constraint() X-Git-Tag: upstream/snapshot3+hdmi~14098^2~112 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a1f2b70a942b8d858a0ab02567da3999b60a99b2;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git perf, x86: Use weight instead of cmask in for_each_event_constraint() There may exist constraints with a cmask set to zero. In this case for_each_event_constraint() will not work properly. Now weight is used instead of the cmask for loop exit detection. Weight is always a value other than zero since the default contains the HWEIGHT from the counter mask and in other cases a value of zero does not fit too. This is in preparation of ibs event constraints that wont have a cmask. Signed-off-by: Robert Richter Signed-off-by: Peter Zijlstra LKML-Reference: <1271190201-25705-7-git-send-email-robert.richter@amd.com> Signed-off-by: Ingo Molnar --- diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 4e218d7..4a3f1f2 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c @@ -170,7 +170,7 @@ struct cpu_hw_events { EVENT_CONSTRAINT(0, 0, 0) #define for_each_event_constraint(e, c) \ - for ((e) = (c); (e)->cmask; (e)++) + for ((e) = (c); (e)->weight; (e)++) union perf_capabilities { struct {