Skip to content

Commit 45a2c87

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Simplify ufshcd_auto_hibern8_update()
Calls to ufshcd_auto_hibern8_update() are already serialized: this function is either called if user space software is not running (preparing to suspend) or from a single sysfs store callback function. Kernfs serializes sysfs .store() callbacks. No functionality is changed. Reviewed-by: Bao D. Nguyen <quic_nguyenb@quicinc.com> Reviewed-by: Can Guo <quic_cang@quicinc.com> Cc: Avri Altman <avri.altman@wdc.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20231214192416.3638077-3-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent bdf5c0b commit 45a2c87

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4423,21 +4423,13 @@ static void ufshcd_configure_auto_hibern8(struct ufs_hba *hba)
44234423

44244424
void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit)
44254425
{
4426-
unsigned long flags;
4427-
bool update = false;
4426+
const u32 cur_ahit = READ_ONCE(hba->ahit);
44284427

4429-
if (!ufshcd_is_auto_hibern8_supported(hba))
4428+
if (!ufshcd_is_auto_hibern8_supported(hba) || cur_ahit == ahit)
44304429
return;
44314430

4432-
spin_lock_irqsave(hba->host->host_lock, flags);
4433-
if (hba->ahit != ahit) {
4434-
hba->ahit = ahit;
4435-
update = true;
4436-
}
4437-
spin_unlock_irqrestore(hba->host->host_lock, flags);
4438-
4439-
if (update &&
4440-
!pm_runtime_suspended(&hba->ufs_device_wlun->sdev_gendev)) {
4431+
WRITE_ONCE(hba->ahit, ahit);
4432+
if (!pm_runtime_suspended(&hba->ufs_device_wlun->sdev_gendev)) {
44414433
ufshcd_rpm_get_sync(hba);
44424434
ufshcd_hold(hba);
44434435
ufshcd_configure_auto_hibern8(hba);

0 commit comments

Comments
 (0)