Resolve the deadlock issue during runtime suspend when an error triggers
the error handler. Prevent the deadlock by checking pm_op_in_progress
and performing a quick recovery. This approach ensures that the error
handler does not wait indefinitely for runtime PM to resume, allowing
runtime suspend to proceed smoothly.
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Suggested-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Message-Id: <
20250926012940.
3933367-1-peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
}
spin_unlock_irqrestore(hba->host->host_lock, flags);
+ ufshcd_rpm_get_noresume(hba);
+ if (hba->pm_op_in_progress) {
+ ufshcd_link_recovery(hba);
+ ufshcd_rpm_put(hba);
+ return;
+ }
+ ufshcd_rpm_put(hba);
+
ufshcd_err_handling_prepare(hba);
spin_lock_irqsave(hba->host->host_lock, flags);