From e1aee10e879223fefab749664eb9ba563b72b038 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 9 Feb 2023 08:03:51 -0800 Subject: [PATCH] ANDROID: scsi: ufs: Backport the remainder of "Fix devfreq deadlocks" Stable kernel v5.15.91 includes commit b03f7ed9af6e ("scsi: ufs: core: Fix devfreq deadlocks"). That commit is a backport of upstream commit ba81043753ff ("scsi: ufs: core: Fix devfreq deadlocks"). Merge commit c45adc3d895d ("Merge 5.15.92 into android14-5.15") removed the 'err' argument from ufshcd_clock_scaling_unprepare(). Restore the 'err' argument. Fixes: c45adc3d895d ("Merge 5.15.92 into android14-5.15") Change-Id: Icce2a7cb69ba7ccf9a6d548406d786e15d279acc Signed-off-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 7d6dcff1c3d5..c010233dbbe6 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -1311,12 +1311,12 @@ out: return ret; } -static void ufshcd_clock_scaling_unprepare(struct ufs_hba *hba, bool scale_up) +static void ufshcd_clock_scaling_unprepare(struct ufs_hba *hba, int err, bool scale_up) { up_write(&hba->clk_scaling_lock); /* Enable Write Booster if we have scaled up else disable it */ - if (ufshcd_enable_wb_if_scaling_up(hba)) + if (ufshcd_enable_wb_if_scaling_up(hba) && !err) ufshcd_wb_toggle(hba, scale_up); mutex_unlock(&hba->wb_mutex); @@ -1374,7 +1374,7 @@ static int ufshcd_devfreq_scale(struct ufs_hba *hba, bool scale_up) } out_unprepare: - ufshcd_clock_scaling_unprepare(hba, scale_up); + ufshcd_clock_scaling_unprepare(hba, ret, scale_up); return ret; } @@ -1774,7 +1774,7 @@ EXPORT_SYMBOL_GPL(ufshcd_freeze_scsi_devs); /* Resume processing of SCSI commands. */ void ufshcd_unfreeze_scsi_devs(struct ufs_hba *hba) { - ufshcd_clock_scaling_unprepare(hba, true); + ufshcd_clock_scaling_unprepare(hba, 0, true); } EXPORT_SYMBOL_GPL(ufshcd_unfreeze_scsi_devs);