Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 22848
b: refs/heads/master
c: 93ad794
h: refs/heads/master
v: v3
  • Loading branch information
Russell King authored and Russell King committed Mar 21, 2006
1 parent 057faf7 commit f5f3f12
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c3d5395fd7ac5b338c701deaaddec090d3c25af9
refs/heads/master: 93ad79496c8831552d5f8ca7c182f149cc3cf19a
23 changes: 10 additions & 13 deletions trunk/arch/arm/oprofile/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
#include <linux/oprofile.h>
#include <linux/errno.h>
#include <linux/sysdev.h>
#include <asm/semaphore.h>
#include <linux/mutex.h>

#include "op_counter.h"
#include "op_arm_model.h"

static struct op_arm_model_spec *op_arm_model;
static int op_arm_enabled;
static struct semaphore op_arm_sem;
static DEFINE_MUTEX(op_arm_mutex);

struct op_counter_config counter_config[OP_MAX_COUNTER];

Expand Down Expand Up @@ -57,40 +57,40 @@ static int op_arm_start(void)
{
int ret = -EBUSY;

down(&op_arm_sem);
mutex_lock(&op_arm_mutex);
if (!op_arm_enabled) {
ret = op_arm_model->start();
op_arm_enabled = !ret;
}
up(&op_arm_sem);
mutex_unlock(&op_arm_mutex);
return ret;
}

static void op_arm_stop(void)
{
down(&op_arm_sem);
mutex_lock(&op_arm_mutex);
if (op_arm_enabled)
op_arm_model->stop();
op_arm_enabled = 0;
up(&op_arm_sem);
mutex_unlock(&op_arm_mutex);
}

#ifdef CONFIG_PM
static int op_arm_suspend(struct sys_device *dev, pm_message_t state)
{
down(&op_arm_sem);
mutex_lock(&op_arm_mutex);
if (op_arm_enabled)
op_arm_model->stop();
up(&op_arm_sem);
mutex_unlock(&op_arm_mutex);
return 0;
}

static int op_arm_resume(struct sys_device *dev)
{
down(&op_arm_sem);
mutex_lock(&op_arm_mutex);
if (op_arm_enabled && op_arm_model->start())
op_arm_enabled = 0;
up(&op_arm_sem);
mutex_unlock(&op_arm_mutex);
return 0;
}

Expand Down Expand Up @@ -135,8 +135,6 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
#endif

if (spec) {
init_MUTEX(&op_arm_sem);

ret = spec->init();
if (ret < 0)
return ret;
Expand All @@ -163,4 +161,3 @@ void oprofile_arch_exit(void)
op_arm_model = NULL;
}
}

0 comments on commit f5f3f12

Please sign in to comment.