2010-02-02 20:23:15 +01:00
|
|
|
/*
|
|
|
|
* linux/arch/arm/kernel/pmu.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 picoChip Designs Ltd, Jamie Iles
|
2010-04-29 18:13:24 +02:00
|
|
|
* Copyright (C) 2010 ARM Ltd, Will Deacon
|
2010-02-02 20:23:15 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/err.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
|
|
|
|
#include <asm/pmu.h>
|
|
|
|
|
2011-07-26 23:10:28 +02:00
|
|
|
/*
|
|
|
|
* PMU locking to ensure mutual exclusion between different subsystems.
|
|
|
|
*/
|
|
|
|
static unsigned long pmu_lock[BITS_TO_LONGS(ARM_NUM_PMU_DEVICES)];
|
2010-02-02 20:23:15 +01:00
|
|
|
|
2011-07-26 23:10:28 +02:00
|
|
|
int
|
2011-08-12 11:42:48 +02:00
|
|
|
reserve_pmu(enum arm_pmu_type type)
|
2010-02-02 20:23:15 +01:00
|
|
|
{
|
2011-07-26 23:10:28 +02:00
|
|
|
return test_and_set_bit_lock(type, pmu_lock) ? -EBUSY : 0;
|
2010-02-02 20:23:15 +01:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(reserve_pmu);
|
|
|
|
|
2011-07-26 23:10:28 +02:00
|
|
|
void
|
2011-08-12 11:42:48 +02:00
|
|
|
release_pmu(enum arm_pmu_type type)
|
2010-02-02 20:23:15 +01:00
|
|
|
{
|
2011-07-26 23:10:28 +02:00
|
|
|
clear_bit_unlock(type, pmu_lock);
|
2010-02-02 20:23:15 +01:00
|
|
|
}
|
2011-11-14 17:12:52 +01:00
|
|
|
EXPORT_SYMBOL_GPL(release_pmu);
|