diff options
author | Robert Richter <robert.richter@amd.com> | 2010-03-17 07:49:10 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-17 08:06:58 -0400 |
commit | b27ea29c6267889be255f2217fa7a6106e6a8b04 (patch) | |
tree | 60ae76246aa5a3f64ab3ffd7c846f0aa13ba774a /arch | |
parent | 3b0d516463f8deb897a55cb81e9dbbe58a2490ed (diff) |
perf/core, x86: Reduce number of CONFIG_X86_LOCAL_APIC macros
The function reserve_pmc_hardware() and release_pmc_hardware()
were hard to read. This patch improves readability of the code by
removing most of the CONFIG_X86_LOCAL_APIC macros.
Signed-off-by: Robert Richter <robert.richter@amd.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1268826553-19518-2-git-send-email-robert.richter@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 5dacf63f913e..793e63f6c420 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -313,9 +313,10 @@ again: | |||
313 | static atomic_t active_events; | 313 | static atomic_t active_events; |
314 | static DEFINE_MUTEX(pmc_reserve_mutex); | 314 | static DEFINE_MUTEX(pmc_reserve_mutex); |
315 | 315 | ||
316 | #ifdef CONFIG_X86_LOCAL_APIC | ||
317 | |||
316 | static bool reserve_pmc_hardware(void) | 318 | static bool reserve_pmc_hardware(void) |
317 | { | 319 | { |
318 | #ifdef CONFIG_X86_LOCAL_APIC | ||
319 | int i; | 320 | int i; |
320 | 321 | ||
321 | if (nmi_watchdog == NMI_LOCAL_APIC) | 322 | if (nmi_watchdog == NMI_LOCAL_APIC) |
@@ -330,11 +331,9 @@ static bool reserve_pmc_hardware(void) | |||
330 | if (!reserve_evntsel_nmi(x86_pmu.eventsel + i)) | 331 | if (!reserve_evntsel_nmi(x86_pmu.eventsel + i)) |
331 | goto eventsel_fail; | 332 | goto eventsel_fail; |
332 | } | 333 | } |
333 | #endif | ||
334 | 334 | ||
335 | return true; | 335 | return true; |
336 | 336 | ||
337 | #ifdef CONFIG_X86_LOCAL_APIC | ||
338 | eventsel_fail: | 337 | eventsel_fail: |
339 | for (i--; i >= 0; i--) | 338 | for (i--; i >= 0; i--) |
340 | release_evntsel_nmi(x86_pmu.eventsel + i); | 339 | release_evntsel_nmi(x86_pmu.eventsel + i); |
@@ -349,12 +348,10 @@ perfctr_fail: | |||
349 | enable_lapic_nmi_watchdog(); | 348 | enable_lapic_nmi_watchdog(); |
350 | 349 | ||
351 | return false; | 350 | return false; |
352 | #endif | ||
353 | } | 351 | } |
354 | 352 | ||
355 | static void release_pmc_hardware(void) | 353 | static void release_pmc_hardware(void) |
356 | { | 354 | { |
357 | #ifdef CONFIG_X86_LOCAL_APIC | ||
358 | int i; | 355 | int i; |
359 | 356 | ||
360 | for (i = 0; i < x86_pmu.num_events; i++) { | 357 | for (i = 0; i < x86_pmu.num_events; i++) { |
@@ -364,9 +361,15 @@ static void release_pmc_hardware(void) | |||
364 | 361 | ||
365 | if (nmi_watchdog == NMI_LOCAL_APIC) | 362 | if (nmi_watchdog == NMI_LOCAL_APIC) |
366 | enable_lapic_nmi_watchdog(); | 363 | enable_lapic_nmi_watchdog(); |
367 | #endif | ||
368 | } | 364 | } |
369 | 365 | ||
366 | #else | ||
367 | |||
368 | static bool reserve_pmc_hardware(void) { return true; } | ||
369 | static void release_pmc_hardware(void) {} | ||
370 | |||
371 | #endif | ||
372 | |||
370 | static int reserve_ds_buffers(void); | 373 | static int reserve_ds_buffers(void); |
371 | static void release_ds_buffers(void); | 374 | static void release_ds_buffers(void); |
372 | 375 | ||