video: tegra: host: finish actmon work if pending
Shridhar Rasal [Thu, 10 Dec 2015 05:15:00 +0000 (10:15 +0530)]
- This make sure that, pending work is finished before deinit
  complete to avoid scheduled work queued after deinit.

Bug 200155744

Change-Id: Id0a3a93f4a9b07bf39758be58e4e3c37834b5e5e
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: http://git-master/r/921284
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Xianhui Wang <xianhuiw@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

drivers/video/tegra/host/host1x/host1x_actmon_t124.c

index de67cc0..1c897a3 100644 (file)
@@ -229,12 +229,18 @@ static void host1x_actmon_deinit(struct host1x_actmon *actmon)
        if (actmon->init != ACTMON_READY)
                return;
 
-       actmon->init = ACTMON_SLEEP;
-
        actmon_writel(actmon, 0, actmon_ctrl_r());
        actmon_writel(actmon, 0xffffffff, actmon_intr_status_r());
        nvhost_intr_disable_host_irq(&nvhost_get_host(host_pdev)->intr,
                                     engine_pdata->actmon_irq);
+
+       /* wait for work to finish and then cancel*/
+       if (engine_pdata->actmon_irq) {
+               cancel_work_sync(&actmon->above_wmark_worker.work);
+               cancel_work_sync(&actmon->below_wmark_worker.work);
+       }
+
+       actmon->init = ACTMON_SLEEP;
 }
 
 static int host1x_actmon_avg(struct host1x_actmon *actmon, u32 *val)