From 4c57393d1a7db06b775f1da48478bb12d24125a1 Mon Sep 17 00:00:00 2001 From: Hongzhang Yang Date: Thu, 10 Oct 2013 11:12:06 +0800 Subject: [PATCH] ENGR00283192 Avoid vpu rmmod failure and modprobe warning - Avoid vpu rmmod failure caused by regulator free failure Do not call regulator_put because regulators returned from devm_regulator_get are automatically regulator_put() on driver detach - Avoid vpu modprobe warning caused by unbalanced pm_runtime_enable Add missing call to pm_runtime_disable Signed-off-by: Hongzhang Yang --- drivers/mxc/vpu/mxc_vpu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mxc/vpu/mxc_vpu.c b/drivers/mxc/vpu/mxc_vpu.c index ecd286b8b825..96c79d5add1c 100644 --- a/drivers/mxc/vpu/mxc_vpu.c +++ b/drivers/mxc/vpu/mxc_vpu.c @@ -140,11 +140,13 @@ static wait_queue_head_t vpu_queue; static int vpu_jpu_irq; #endif +#ifdef CONFIG_PM static unsigned int regBk[64]; +static unsigned int pc_before_suspend; +#endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0) || LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) static struct regulator *vpu_regulator; #endif -static unsigned int pc_before_suspend; static atomic_t clk_cnt_from_ioc = ATOMIC_INIT(0); #define READ_REG(x) readl_relaxed(vpu_base + x) @@ -192,7 +194,7 @@ static long vpu_power_get(bool on) ret = IS_ERR(vpu_regulator); #endif } else { -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0) || LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0) if (!IS_ERR(vpu_regulator)) regulator_put(vpu_regulator); #endif @@ -1035,6 +1037,9 @@ out: static int vpu_dev_remove(struct platform_device *pdev) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0) + pm_runtime_disable(&pdev->dev); +#endif free_irq(vpu_ipi_irq, &vpu_data); #ifdef MXC_VPU_HAS_JPU free_irq(vpu_jpu_irq, &vpu_data); -- 2.39.5