Commit 5e766e3e authored by Robert Richter's avatar Robert Richter

x86/oprofile: Fix usage of NUM_CONTROLS/NUM_COUNTERS macros

Use the corresponding macros when iterating over counter and control
registers. Since NUM_CONTROLS and NUM_COUNTERS are equal for AMD cpus
the fix is more a cosmetical change.
Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
parent 4d4036e0
...@@ -99,7 +99,7 @@ static void op_amd_fill_in_addresses(struct op_msrs * const msrs) ...@@ -99,7 +99,7 @@ static void op_amd_fill_in_addresses(struct op_msrs * const msrs)
#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
for (i = 0; i < NUM_VIRT_COUNTERS; i++) { for (i = 0; i < NUM_VIRT_COUNTERS; i++) {
int hw_counter = i % NUM_CONTROLS; int hw_counter = i % NUM_COUNTERS;
if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i)) if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i))
msrs->multiplex[i].addr = MSR_K7_PERFCTR0 + hw_counter; msrs->multiplex[i].addr = MSR_K7_PERFCTR0 + hw_counter;
else else
...@@ -366,7 +366,7 @@ static void op_amd_shutdown(struct op_msrs const * const msrs) ...@@ -366,7 +366,7 @@ static void op_amd_shutdown(struct op_msrs const * const msrs)
if (msrs->counters[i].addr) if (msrs->counters[i].addr)
release_perfctr_nmi(MSR_K7_PERFCTR0 + i); release_perfctr_nmi(MSR_K7_PERFCTR0 + i);
} }
for (i = 0; i < NUM_COUNTERS; ++i) { for (i = 0; i < NUM_CONTROLS; ++i) {
if (msrs->controls[i].addr) if (msrs->controls[i].addr)
release_evntsel_nmi(MSR_K7_EVNTSEL0 + i); release_evntsel_nmi(MSR_K7_EVNTSEL0 + i);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment