From da4cb9d4dea888570319e87c346a6e21703d2168 Mon Sep 17 00:00:00 2001 From: Prerna Kalla Date: Thu, 5 Dec 2019 21:36:25 +0530 Subject: [PATCH] msm: ice: Modify the waiting condition in suspend This change rectifies the condition which blocks suspend function of ice and prints debug message if timeout occurs when ice is busy. Change-Id: Id21e06ddb34b32867dfd86eef6c25cd4d2bb7fba Signed-off-by: Prerna Kalla --- drivers/crypto/msm/ice.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/msm/ice.c b/drivers/crypto/msm/ice.c index ab9f7f6dec84..fd34c0bc39f5 100644 --- a/drivers/crypto/msm/ice.c +++ b/drivers/crypto/msm/ice.c @@ -846,18 +846,27 @@ static int qcom_ice_remove(struct platform_device *pdev) static int qcom_ice_suspend(struct platform_device *pdev) { struct ice_device *ice_dev; + int ret = 0; ice_dev = (struct ice_device *)platform_get_drvdata(pdev); if (!ice_dev) return -EINVAL; - if (atomic_read(&ice_dev->is_ice_busy) != 0) - wait_event_interruptible_timeout( + if (atomic_read(&ice_dev->is_ice_busy) != 0) { + ret = wait_event_interruptible_timeout( ice_dev->block_suspend_ice_queue, - atomic_read(&ice_dev->is_ice_busy) != 0, + atomic_read(&ice_dev->is_ice_busy) == 0, msecs_to_jiffies(1000)); + if (!ret) { + pr_err("%s: Suspend ICE during an ongoing operation\n", + __func__); + atomic_set(&ice_dev->is_ice_suspended, 0); + return -ETIME; + } + } + atomic_set(&ice_dev->is_ice_suspended, 1); return 0;