touch: pt: cancel all pending works

In some scenarios, back to back suspend and resume calls causing
concurrency issues. This change cancel pending queued works before
executing current task.

Change-Id: I1c0971b68a08a4c634767ea1bb6d783f495a1093
Signed-off-by: Srinu Gorle <quic_sgorle@quicinc.com>
Signed-off-by: Anand Abhishek <quic_anandabh@quicinc.com>
This commit is contained in:
Anand Abhishek
2022-09-29 13:32:08 +05:30
committed by Gerrit - the friendly Code Review server
parent 34a4271847
commit b29e79f702
2 changed files with 26 additions and 1 deletions

View File

@@ -10831,6 +10831,11 @@ static int pt_core_suspend(struct device *dev)
if (cd->cpdata->flags & PT_CORE_FLAG_SKIP_SYS_SLEEP)
return 0;
cancel_work_sync(&cd->resume_offload_work);
cancel_work_sync(&cd->suspend_offload_work);
cancel_work_sync(&cd->resume_work);
cancel_work_sync(&cd->suspend_work);
queue_work(cd->pt_workqueue, &cd->suspend_offload_work);
pt_debug(cd->dev, DL_ERROR, "%s End\n", __func__);
@@ -11004,6 +11009,11 @@ static int pt_core_resume(struct device *dev)
if (cd->cpdata->flags & PT_CORE_FLAG_SKIP_SYS_SLEEP)
return 0;
cancel_work_sync(&cd->resume_offload_work);
cancel_work_sync(&cd->suspend_offload_work);
cancel_work_sync(&cd->resume_work);
cancel_work_sync(&cd->suspend_work);
queue_work(cd->pt_workqueue, &cd->resume_offload_work);
pt_debug(cd->dev, DL_ERROR, "%s End\n", __func__);
@@ -12845,6 +12855,11 @@ static int drm_notifier_callback(struct notifier_block *self,
if (cd->fb_state != FB_ON) {
pt_debug(cd->dev, DL_INFO, "%s: Resume notifier called!\n",
__func__);
cancel_work_sync(&cd->resume_offload_work);
cancel_work_sync(&cd->suspend_offload_work);
cancel_work_sync(&cd->resume_work);
cancel_work_sync(&cd->suspend_work);
queue_work(cd->pt_workqueue, &cd->resume_work);
#if defined(CONFIG_PM_SLEEP)
pt_debug(cd->dev, DL_INFO, "%s: Resume notifier called!\n",
@@ -12866,7 +12881,11 @@ static int drm_notifier_callback(struct notifier_block *self,
if (cd->cpdata->flags & PT_CORE_FLAG_SKIP_RUNTIME)
pt_core_suspend_(cd->dev);
#endif
cancel_work_sync(&cd->resume_offload_work);
cancel_work_sync(&cd->suspend_offload_work);
cancel_work_sync(&cd->resume_work);
cancel_work_sync(&cd->suspend_work);
queue_work(cd->pt_workqueue, &cd->suspend_work);
cd->fb_state = FB_OFF;
pt_debug(cd->dev, DL_INFO, "%s: Suspend notified!\n", __func__);
@@ -17937,6 +17956,12 @@ int pt_release(struct pt_core_data *cd)
call_atten_cb(cd, PT_ATTEN_CANCEL_LOADER, 0);
cancel_work_sync(&cd->ttdl_restart_work);
cancel_work_sync(&cd->enum_work);
cancel_work_sync(&cd->resume_offload_work);
cancel_work_sync(&cd->suspend_offload_work);
cancel_work_sync(&cd->resume_work);
cancel_work_sync(&cd->suspend_work);
destroy_workqueue(cd->pt_workqueue);
pt_stop_wd_timer(cd);
pt_release_modules(cd);

View File

@@ -177,7 +177,7 @@ enum PT_DEBUG_LEVEL {
DL_DEBUG = 4,
DL_MAX
};
#define PT_INITIAL_DEBUG_LEVEL DL_WARN
#define PT_INITIAL_DEBUG_LEVEL DL_MAX
/* Startup DUT enum status bitmask */
enum PT_STARTUP_STATUS {