@@ -4411,21 +4411,13 @@ static void ufshcd_configure_auto_hibern8(struct ufs_hba *hba)
int ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit)
{
- unsigned long flags;
- bool update = false;
+ const u32 cur_ahit = READ_ONCE(hba->ahit);
- if (!ufshcd_is_auto_hibern8_supported(hba))
+ if (!ufshcd_is_auto_hibern8_supported(hba) || cur_ahit == ahit)
return 0;
- spin_lock_irqsave(hba->host->host_lock, flags);
- if (hba->ahit != ahit) {
- hba->ahit = ahit;
- update = true;
- }
- spin_unlock_irqrestore(hba->host->host_lock, flags);
-
- if (update &&
- !pm_runtime_suspended(&hba->ufs_device_wlun->sdev_gendev)) {
+ WRITE_ONCE(hba->ahit, ahit);
+ if (!pm_runtime_suspended(&hba->ufs_device_wlun->sdev_gendev)) {
ufshcd_rpm_get_sync(hba);
ufshcd_hold(hba);
ufshcd_configure_auto_hibern8(hba);