Hi Will, On 06/04/2012 04:44 PM, Jon Hunter wrote: [...] > diff --git a/arch/arm/kernel/pmu.c b/arch/arm/kernel/pmu.c > index 2334bf8..8ffbb09 100644 > --- a/arch/arm/kernel/pmu.c > +++ b/arch/arm/kernel/pmu.c > @@ -13,6 +13,8 @@ > #include <linux/err.h> > #include <linux/kernel.h> > #include <linux/module.h> > +#include <linux/pm_runtime.h> > +#include <linux/platform_device.h> > > #include <asm/pmu.h> > > @@ -22,15 +24,17 @@ > static unsigned long pmu_lock[BITS_TO_LONGS(ARM_NUM_PMU_DEVICES)]; > > int > -reserve_pmu(enum arm_pmu_type type) > +reserve_pmu(struct arm_pmu *armpmu) > { > - return test_and_set_bit_lock(type, pmu_lock) ? -EBUSY : 0; > + pm_runtime_get_sync(&armpmu->plat_device->dev); > + return test_and_set_bit_lock(armpmu->type, pmu_lock) ? -EBUSY : 0; > } > EXPORT_SYMBOL_GPL(reserve_pmu); > > void > -release_pmu(enum arm_pmu_type type) > +release_pmu(struct arm_pmu *armpmu) > { > - clear_bit_unlock(type, pmu_lock); > + clear_bit_unlock(armpmu->type, pmu_lock); > + pm_runtime_put_sync(&armpmu->plat_device->dev); > } > EXPORT_SYMBOL_GPL(release_pmu); I have realised that there is a slight bug in the above pm_runtime_get/put. The calls to pm_runtime_get/put need to be symmetrical otherwise the if we call _get more than _put the pmu will stay on. So in the reserve_pmu, I should only call pm_runtime_get if we acquire the lock. Anyway, let me know what you think of this approach. An alternative is to put the calls pm_runtime_get/put outside of the reserve/release_pmu, which would be a simpler change, but I was thinking that the above maybe more aligned with your thinking. Cheers Jon -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html