Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 258214
b: refs/heads/master
c: f12482c
h: refs/heads/master
v: v3
  • Loading branch information
Mark Rutland authored and Russell King committed Jun 29, 2011
1 parent 23ca87f commit c7136fb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 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: 090ab3ff8ebb842c0f159d34d57d6e51bd94ace1
refs/heads/master: f12482c9393da2c1f5cb3217f29aa79c653dd980
2 changes: 1 addition & 1 deletion trunk/arch/arm/include/asm/pmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ reserve_pmu(enum arm_pmu_type device);
* a cookie.
*/
extern int
release_pmu(struct platform_device *pdev);
release_pmu(enum arm_pmu_type type);

/**
* init_pmu() - Initialise the PMU.
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/arm/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ armpmu_reserve_hardware(void)
if (irq >= 0)
free_irq(irq, NULL);
}
release_pmu(pmu_device);
release_pmu(ARM_PMU_DEVICE_CPU);
pmu_device = NULL;
}

Expand All @@ -454,7 +454,7 @@ armpmu_release_hardware(void)
}
armpmu->stop();

release_pmu(pmu_device);
release_pmu(ARM_PMU_DEVICE_CPU);
pmu_device = NULL;
}

Expand Down
33 changes: 19 additions & 14 deletions trunk/arch/arm/kernel/pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,41 @@ static volatile long pmu_lock;

static struct platform_device *pmu_devices[ARM_NUM_PMU_DEVICES];

static int __devinit pmu_device_probe(struct platform_device *pdev)
static int __devinit pmu_register(struct platform_device *pdev,
enum arm_pmu_type type)
{

if (pdev->id < 0 || pdev->id >= ARM_NUM_PMU_DEVICES) {
if (type < 0 || type >= ARM_NUM_PMU_DEVICES) {
pr_warning("received registration request for unknown "
"device %d\n", pdev->id);
"device %d\n", type);
return -EINVAL;
}

if (pmu_devices[pdev->id])
if (pmu_devices[type])
pr_warning("registering new PMU device type %d overwrites "
"previous registration!\n", pdev->id);
"previous registration!\n", type);
else
pr_info("registered new PMU device of type %d\n",
pdev->id);
type);

pmu_devices[pdev->id] = pdev;
pmu_devices[type] = pdev;
return 0;
}

static struct platform_driver pmu_driver = {
static int __devinit armpmu_device_probe(struct platform_device *pdev)
{
return pmu_register(pdev, ARM_PMU_DEVICE_CPU);
}

static struct platform_driver armpmu_driver = {
.driver = {
.name = "arm-pmu",
},
.probe = pmu_device_probe,
.probe = armpmu_device_probe,
};

static int __init register_pmu_driver(void)
{
return platform_driver_register(&pmu_driver);
return platform_driver_register(&armpmu_driver);
}
device_initcall(register_pmu_driver);

Expand All @@ -77,11 +82,11 @@ reserve_pmu(enum arm_pmu_type device)
EXPORT_SYMBOL_GPL(reserve_pmu);

int
release_pmu(struct platform_device *pdev)
release_pmu(enum arm_pmu_type device)
{
if (WARN_ON(pdev != pmu_devices[pdev->id]))
if (WARN_ON(!pmu_devices[device]))
return -EINVAL;
clear_bit_unlock(pdev->id, &pmu_lock);
clear_bit_unlock(device, &pmu_lock);
return 0;
}
EXPORT_SYMBOL_GPL(release_pmu);
Expand Down

0 comments on commit c7136fb

Please sign in to comment.