diff options
Diffstat (limited to 'drivers/oprofile/oprof.c')
-rw-r--r-- | drivers/oprofile/oprof.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c index b3f1cd6a24c1..e5162a64018b 100644 --- a/drivers/oprofile/oprof.c +++ b/drivers/oprofile/oprof.c | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/oprofile.h> | 13 | #include <linux/oprofile.h> |
14 | #include <linux/moduleparam.h> | 14 | #include <linux/moduleparam.h> |
15 | #include <asm/semaphore.h> | 15 | #include <asm/mutex.h> |
16 | 16 | ||
17 | #include "oprof.h" | 17 | #include "oprof.h" |
18 | #include "event_buffer.h" | 18 | #include "event_buffer.h" |
@@ -25,7 +25,7 @@ struct oprofile_operations oprofile_ops; | |||
25 | unsigned long oprofile_started; | 25 | unsigned long oprofile_started; |
26 | unsigned long backtrace_depth; | 26 | unsigned long backtrace_depth; |
27 | static unsigned long is_setup; | 27 | static unsigned long is_setup; |
28 | static DECLARE_MUTEX(start_sem); | 28 | static DEFINE_MUTEX(start_mutex); |
29 | 29 | ||
30 | /* timer | 30 | /* timer |
31 | 0 - use performance monitoring hardware if available | 31 | 0 - use performance monitoring hardware if available |
@@ -37,7 +37,7 @@ int oprofile_setup(void) | |||
37 | { | 37 | { |
38 | int err; | 38 | int err; |
39 | 39 | ||
40 | down(&start_sem); | 40 | mutex_lock(&start_mutex); |
41 | 41 | ||
42 | if ((err = alloc_cpu_buffers())) | 42 | if ((err = alloc_cpu_buffers())) |
43 | goto out; | 43 | goto out; |
@@ -57,7 +57,7 @@ int oprofile_setup(void) | |||
57 | goto out3; | 57 | goto out3; |
58 | 58 | ||
59 | is_setup = 1; | 59 | is_setup = 1; |
60 | up(&start_sem); | 60 | mutex_unlock(&start_mutex); |
61 | return 0; | 61 | return 0; |
62 | 62 | ||
63 | out3: | 63 | out3: |
@@ -68,7 +68,7 @@ out2: | |||
68 | out1: | 68 | out1: |
69 | free_cpu_buffers(); | 69 | free_cpu_buffers(); |
70 | out: | 70 | out: |
71 | up(&start_sem); | 71 | mutex_unlock(&start_mutex); |
72 | return err; | 72 | return err; |
73 | } | 73 | } |
74 | 74 | ||
@@ -78,7 +78,7 @@ int oprofile_start(void) | |||
78 | { | 78 | { |
79 | int err = -EINVAL; | 79 | int err = -EINVAL; |
80 | 80 | ||
81 | down(&start_sem); | 81 | mutex_lock(&start_mutex); |
82 | 82 | ||
83 | if (!is_setup) | 83 | if (!is_setup) |
84 | goto out; | 84 | goto out; |
@@ -95,7 +95,7 @@ int oprofile_start(void) | |||
95 | 95 | ||
96 | oprofile_started = 1; | 96 | oprofile_started = 1; |
97 | out: | 97 | out: |
98 | up(&start_sem); | 98 | mutex_unlock(&start_mutex); |
99 | return err; | 99 | return err; |
100 | } | 100 | } |
101 | 101 | ||
@@ -103,7 +103,7 @@ out: | |||
103 | /* echo 0>/dev/oprofile/enable */ | 103 | /* echo 0>/dev/oprofile/enable */ |
104 | void oprofile_stop(void) | 104 | void oprofile_stop(void) |
105 | { | 105 | { |
106 | down(&start_sem); | 106 | mutex_lock(&start_mutex); |
107 | if (!oprofile_started) | 107 | if (!oprofile_started) |
108 | goto out; | 108 | goto out; |
109 | oprofile_ops.stop(); | 109 | oprofile_ops.stop(); |
@@ -111,20 +111,20 @@ void oprofile_stop(void) | |||
111 | /* wake up the daemon to read what remains */ | 111 | /* wake up the daemon to read what remains */ |
112 | wake_up_buffer_waiter(); | 112 | wake_up_buffer_waiter(); |
113 | out: | 113 | out: |
114 | up(&start_sem); | 114 | mutex_unlock(&start_mutex); |
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | void oprofile_shutdown(void) | 118 | void oprofile_shutdown(void) |
119 | { | 119 | { |
120 | down(&start_sem); | 120 | mutex_lock(&start_mutex); |
121 | sync_stop(); | 121 | sync_stop(); |
122 | if (oprofile_ops.shutdown) | 122 | if (oprofile_ops.shutdown) |
123 | oprofile_ops.shutdown(); | 123 | oprofile_ops.shutdown(); |
124 | is_setup = 0; | 124 | is_setup = 0; |
125 | free_event_buffer(); | 125 | free_event_buffer(); |
126 | free_cpu_buffers(); | 126 | free_cpu_buffers(); |
127 | up(&start_sem); | 127 | mutex_unlock(&start_mutex); |
128 | } | 128 | } |
129 | 129 | ||
130 | 130 | ||
@@ -132,7 +132,7 @@ int oprofile_set_backtrace(unsigned long val) | |||
132 | { | 132 | { |
133 | int err = 0; | 133 | int err = 0; |
134 | 134 | ||
135 | down(&start_sem); | 135 | mutex_lock(&start_mutex); |
136 | 136 | ||
137 | if (oprofile_started) { | 137 | if (oprofile_started) { |
138 | err = -EBUSY; | 138 | err = -EBUSY; |
@@ -147,7 +147,7 @@ int oprofile_set_backtrace(unsigned long val) | |||
147 | backtrace_depth = val; | 147 | backtrace_depth = val; |
148 | 148 | ||
149 | out: | 149 | out: |
150 | up(&start_sem); | 150 | mutex_unlock(&start_mutex); |
151 | return err; | 151 | return err; |
152 | } | 152 | } |
153 | 153 | ||