aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/oprofile
diff options
context:
space:
mode:
authorPaolo Ciarrocchi <paolo.ciarrocchi@gmail.com>2008-02-19 17:51:27 -0500
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:40:48 -0400
commitd4413732b54a17684e48fbb4b52fade5bf965b5d (patch)
tree3c04452cbac9624020828df55ca0d0c2925d2f8e /arch/x86/oprofile
parent8b45b72b04061b9d39208b0843007d62b463c211 (diff)
x86: coding style fixes to arch/x86/oprofile/op_model_athlon.c
The patch fixes 33 errors and a few warnings reported by checkpatch.pl arch/x86/oprofile/op_model_athlon.o: text data bss dec hex filename 1691 0 32 1723 6bb op_model_athlon.o.before 1691 0 32 1723 6bb op_model_athlon.o.after md5: c354bc2d7140e1e626c03390eddaa0a6 op_model_athlon.o.before.asm c354bc2d7140e1e626c03390eddaa0a6 op_model_athlon.o.after.asm Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/oprofile')
-rw-r--r--arch/x86/oprofile/op_model_athlon.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/arch/x86/oprofile/op_model_athlon.c b/arch/x86/oprofile/op_model_athlon.c
index c3ee43333f26..3d534879a9dc 100644
--- a/arch/x86/oprofile/op_model_athlon.c
+++ b/arch/x86/oprofile/op_model_athlon.c
@@ -1,4 +1,4 @@
1/** 1/*
2 * @file op_model_athlon.h 2 * @file op_model_athlon.h
3 * athlon / K7 / K8 / Family 10h model-specific MSR operations 3 * athlon / K7 / K8 / Family 10h model-specific MSR operations
4 * 4 *
@@ -14,28 +14,28 @@
14#include <asm/ptrace.h> 14#include <asm/ptrace.h>
15#include <asm/msr.h> 15#include <asm/msr.h>
16#include <asm/nmi.h> 16#include <asm/nmi.h>
17 17
18#include "op_x86_model.h" 18#include "op_x86_model.h"
19#include "op_counter.h" 19#include "op_counter.h"
20 20
21#define NUM_COUNTERS 4 21#define NUM_COUNTERS 4
22#define NUM_CONTROLS 4 22#define NUM_CONTROLS 4
23 23
24#define CTR_IS_RESERVED(msrs,c) (msrs->counters[(c)].addr ? 1 : 0) 24#define CTR_IS_RESERVED(msrs, c) (msrs->counters[(c)].addr ? 1 : 0)
25#define CTR_READ(l,h,msrs,c) do {rdmsr(msrs->counters[(c)].addr, (l), (h));} while (0) 25#define CTR_READ(l, h, msrs, c) do {rdmsr(msrs->counters[(c)].addr, (l), (h)); } while (0)
26#define CTR_WRITE(l,msrs,c) do {wrmsr(msrs->counters[(c)].addr, -(unsigned int)(l), -1);} while (0) 26#define CTR_WRITE(l, msrs, c) do {wrmsr(msrs->counters[(c)].addr, -(unsigned int)(l), -1); } while (0)
27#define CTR_OVERFLOWED(n) (!((n) & (1U<<31))) 27#define CTR_OVERFLOWED(n) (!((n) & (1U<<31)))
28 28
29#define CTRL_IS_RESERVED(msrs,c) (msrs->controls[(c)].addr ? 1 : 0) 29#define CTRL_IS_RESERVED(msrs, c) (msrs->controls[(c)].addr ? 1 : 0)
30#define CTRL_READ(l,h,msrs,c) do {rdmsr(msrs->controls[(c)].addr, (l), (h));} while (0) 30#define CTRL_READ(l, h, msrs, c) do {rdmsr(msrs->controls[(c)].addr, (l), (h)); } while (0)
31#define CTRL_WRITE(l,h,msrs,c) do {wrmsr(msrs->controls[(c)].addr, (l), (h));} while (0) 31#define CTRL_WRITE(l, h, msrs, c) do {wrmsr(msrs->controls[(c)].addr, (l), (h)); } while (0)
32#define CTRL_SET_ACTIVE(n) (n |= (1<<22)) 32#define CTRL_SET_ACTIVE(n) (n |= (1<<22))
33#define CTRL_SET_INACTIVE(n) (n &= ~(1<<22)) 33#define CTRL_SET_INACTIVE(n) (n &= ~(1<<22))
34#define CTRL_CLEAR_LO(x) (x &= (1<<21)) 34#define CTRL_CLEAR_LO(x) (x &= (1<<21))
35#define CTRL_CLEAR_HI(x) (x &= 0xfffffcf0) 35#define CTRL_CLEAR_HI(x) (x &= 0xfffffcf0)
36#define CTRL_SET_ENABLE(val) (val |= 1<<20) 36#define CTRL_SET_ENABLE(val) (val |= 1<<20)
37#define CTRL_SET_USR(val,u) (val |= ((u & 1) << 16)) 37#define CTRL_SET_USR(val, u) (val |= ((u & 1) << 16))
38#define CTRL_SET_KERN(val,k) (val |= ((k & 1) << 17)) 38#define CTRL_SET_KERN(val, k) (val |= ((k & 1) << 17))
39#define CTRL_SET_UM(val, m) (val |= (m << 8)) 39#define CTRL_SET_UM(val, m) (val |= (m << 8))
40#define CTRL_SET_EVENT_LOW(val, e) (val |= (e & 0xff)) 40#define CTRL_SET_EVENT_LOW(val, e) (val |= (e & 0xff))
41#define CTRL_SET_EVENT_HIGH(val, e) (val |= ((e >> 8) & 0xf)) 41#define CTRL_SET_EVENT_HIGH(val, e) (val |= ((e >> 8) & 0xf))
@@ -43,19 +43,19 @@
43#define CTRL_SET_GUEST_ONLY(val, h) (val |= ((h & 1) << 8)) 43#define CTRL_SET_GUEST_ONLY(val, h) (val |= ((h & 1) << 8))
44 44
45static unsigned long reset_value[NUM_COUNTERS]; 45static unsigned long reset_value[NUM_COUNTERS];
46 46
47static void athlon_fill_in_addresses(struct op_msrs * const msrs) 47static void athlon_fill_in_addresses(struct op_msrs * const msrs)
48{ 48{
49 int i; 49 int i;
50 50
51 for (i=0; i < NUM_COUNTERS; i++) { 51 for (i = 0; i < NUM_COUNTERS; i++) {
52 if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i)) 52 if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i))
53 msrs->counters[i].addr = MSR_K7_PERFCTR0 + i; 53 msrs->counters[i].addr = MSR_K7_PERFCTR0 + i;
54 else 54 else
55 msrs->counters[i].addr = 0; 55 msrs->counters[i].addr = 0;
56 } 56 }
57 57
58 for (i=0; i < NUM_CONTROLS; i++) { 58 for (i = 0; i < NUM_CONTROLS; i++) {
59 if (reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i)) 59 if (reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i))
60 msrs->controls[i].addr = MSR_K7_EVNTSEL0 + i; 60 msrs->controls[i].addr = MSR_K7_EVNTSEL0 + i;
61 else 61 else
@@ -63,15 +63,15 @@ static void athlon_fill_in_addresses(struct op_msrs * const msrs)
63 } 63 }
64} 64}
65 65
66 66
67static void athlon_setup_ctrs(struct op_msrs const * const msrs) 67static void athlon_setup_ctrs(struct op_msrs const * const msrs)
68{ 68{
69 unsigned int low, high; 69 unsigned int low, high;
70 int i; 70 int i;
71 71
72 /* clear all counters */ 72 /* clear all counters */
73 for (i = 0 ; i < NUM_CONTROLS; ++i) { 73 for (i = 0 ; i < NUM_CONTROLS; ++i) {
74 if (unlikely(!CTRL_IS_RESERVED(msrs,i))) 74 if (unlikely(!CTRL_IS_RESERVED(msrs, i)))
75 continue; 75 continue;
76 CTRL_READ(low, high, msrs, i); 76 CTRL_READ(low, high, msrs, i);
77 CTRL_CLEAR_LO(low); 77 CTRL_CLEAR_LO(low);
@@ -81,14 +81,14 @@ static void athlon_setup_ctrs(struct op_msrs const * const msrs)
81 81
82 /* avoid a false detection of ctr overflows in NMI handler */ 82 /* avoid a false detection of ctr overflows in NMI handler */
83 for (i = 0; i < NUM_COUNTERS; ++i) { 83 for (i = 0; i < NUM_COUNTERS; ++i) {
84 if (unlikely(!CTR_IS_RESERVED(msrs,i))) 84 if (unlikely(!CTR_IS_RESERVED(msrs, i)))
85 continue; 85 continue;
86 CTR_WRITE(1, msrs, i); 86 CTR_WRITE(1, msrs, i);
87 } 87 }
88 88
89 /* enable active counters */ 89 /* enable active counters */
90 for (i = 0; i < NUM_COUNTERS; ++i) { 90 for (i = 0; i < NUM_COUNTERS; ++i) {
91 if ((counter_config[i].enabled) && (CTR_IS_RESERVED(msrs,i))) { 91 if ((counter_config[i].enabled) && (CTR_IS_RESERVED(msrs, i))) {
92 reset_value[i] = counter_config[i].count; 92 reset_value[i] = counter_config[i].count;
93 93
94 CTR_WRITE(counter_config[i].count, msrs, i); 94 CTR_WRITE(counter_config[i].count, msrs, i);
@@ -112,7 +112,7 @@ static void athlon_setup_ctrs(struct op_msrs const * const msrs)
112 } 112 }
113} 113}
114 114
115 115
116static int athlon_check_ctrs(struct pt_regs * const regs, 116static int athlon_check_ctrs(struct pt_regs * const regs,
117 struct op_msrs const * const msrs) 117 struct op_msrs const * const msrs)
118{ 118{
@@ -133,7 +133,7 @@ static int athlon_check_ctrs(struct pt_regs * const regs,
133 return 1; 133 return 1;
134} 134}
135 135
136 136
137static void athlon_start(struct op_msrs const * const msrs) 137static void athlon_start(struct op_msrs const * const msrs)
138{ 138{
139 unsigned int low, high; 139 unsigned int low, high;
@@ -150,7 +150,7 @@ static void athlon_start(struct op_msrs const * const msrs)
150 150
151static void athlon_stop(struct op_msrs const * const msrs) 151static void athlon_stop(struct op_msrs const * const msrs)
152{ 152{
153 unsigned int low,high; 153 unsigned int low, high;
154 int i; 154 int i;
155 155
156 /* Subtle: stop on all counters to avoid race with 156 /* Subtle: stop on all counters to avoid race with
@@ -169,11 +169,11 @@ static void athlon_shutdown(struct op_msrs const * const msrs)
169 int i; 169 int i;
170 170
171 for (i = 0 ; i < NUM_COUNTERS ; ++i) { 171 for (i = 0 ; i < NUM_COUNTERS ; ++i) {
172 if (CTR_IS_RESERVED(msrs,i)) 172 if (CTR_IS_RESERVED(msrs, i))
173 release_perfctr_nmi(MSR_K7_PERFCTR0 + i); 173 release_perfctr_nmi(MSR_K7_PERFCTR0 + i);
174 } 174 }
175 for (i = 0 ; i < NUM_CONTROLS ; ++i) { 175 for (i = 0 ; i < NUM_CONTROLS ; ++i) {
176 if (CTRL_IS_RESERVED(msrs,i)) 176 if (CTRL_IS_RESERVED(msrs, i))
177 release_evntsel_nmi(MSR_K7_EVNTSEL0 + i); 177 release_evntsel_nmi(MSR_K7_EVNTSEL0 + i);
178 } 178 }
179} 179}