aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/oprofile
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-03-16 06:38:16 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-03-21 18:30:00 -0500
commit93ad79496c8831552d5f8ca7c182f149cc3cf19a (patch)
treec8a052a2419081a7d930b1844dec0e0bd1747211 /arch/arm/oprofile
parentc3d5395fd7ac5b338c701deaaddec090d3c25af9 (diff)
[ARM] Oprofile: Convert semaphore to mutex
op_arm_sem is being used as a mutex, so convert it to use real mutexes. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/oprofile')
-rw-r--r--arch/arm/oprofile/common.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index 6f8bc1f0e6a1..b57b6d11c9fb 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -11,14 +11,14 @@
11#include <linux/oprofile.h> 11#include <linux/oprofile.h>
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/sysdev.h> 13#include <linux/sysdev.h>
14#include <asm/semaphore.h> 14#include <linux/mutex.h>
15 15
16#include "op_counter.h" 16#include "op_counter.h"
17#include "op_arm_model.h" 17#include "op_arm_model.h"
18 18
19static struct op_arm_model_spec *op_arm_model; 19static struct op_arm_model_spec *op_arm_model;
20static int op_arm_enabled; 20static int op_arm_enabled;
21static struct semaphore op_arm_sem; 21static DEFINE_MUTEX(op_arm_mutex);
22 22
23struct op_counter_config counter_config[OP_MAX_COUNTER]; 23struct op_counter_config counter_config[OP_MAX_COUNTER];
24 24
@@ -57,40 +57,40 @@ static int op_arm_start(void)
57{ 57{
58 int ret = -EBUSY; 58 int ret = -EBUSY;
59 59
60 down(&op_arm_sem); 60 mutex_lock(&op_arm_mutex);
61 if (!op_arm_enabled) { 61 if (!op_arm_enabled) {
62 ret = op_arm_model->start(); 62 ret = op_arm_model->start();
63 op_arm_enabled = !ret; 63 op_arm_enabled = !ret;
64 } 64 }
65 up(&op_arm_sem); 65 mutex_unlock(&op_arm_mutex);
66 return ret; 66 return ret;
67} 67}
68 68
69static void op_arm_stop(void) 69static void op_arm_stop(void)
70{ 70{
71 down(&op_arm_sem); 71 mutex_lock(&op_arm_mutex);
72 if (op_arm_enabled) 72 if (op_arm_enabled)
73 op_arm_model->stop(); 73 op_arm_model->stop();
74 op_arm_enabled = 0; 74 op_arm_enabled = 0;
75 up(&op_arm_sem); 75 mutex_unlock(&op_arm_mutex);
76} 76}
77 77
78#ifdef CONFIG_PM 78#ifdef CONFIG_PM
79static int op_arm_suspend(struct sys_device *dev, pm_message_t state) 79static int op_arm_suspend(struct sys_device *dev, pm_message_t state)
80{ 80{
81 down(&op_arm_sem); 81 mutex_lock(&op_arm_mutex);
82 if (op_arm_enabled) 82 if (op_arm_enabled)
83 op_arm_model->stop(); 83 op_arm_model->stop();
84 up(&op_arm_sem); 84 mutex_unlock(&op_arm_mutex);
85 return 0; 85 return 0;
86} 86}
87 87
88static int op_arm_resume(struct sys_device *dev) 88static int op_arm_resume(struct sys_device *dev)
89{ 89{
90 down(&op_arm_sem); 90 mutex_lock(&op_arm_mutex);
91 if (op_arm_enabled && op_arm_model->start()) 91 if (op_arm_enabled && op_arm_model->start())
92 op_arm_enabled = 0; 92 op_arm_enabled = 0;
93 up(&op_arm_sem); 93 mutex_unlock(&op_arm_mutex);
94 return 0; 94 return 0;
95} 95}
96 96
@@ -135,8 +135,6 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
135#endif 135#endif
136 136
137 if (spec) { 137 if (spec) {
138 init_MUTEX(&op_arm_sem);
139
140 ret = spec->init(); 138 ret = spec->init();
141 if (ret < 0) 139 if (ret < 0)
142 return ret; 140 return ret;
@@ -163,4 +161,3 @@ void oprofile_arch_exit(void)
163 op_arm_model = NULL; 161 op_arm_model = NULL;
164 } 162 }
165} 163}
166