Skip to contentSkip to conversation

scsi: ufs: Fix system suspend status

PATCH New stanley.chu-NuS5LvNUpcJWk0Htik3J/[email protected] 3 participants 6 messages Jan 7, 2019 – Jan 12, 2019 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1546870774-19691-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/[email protected]

#3 lore raw

PATCH 1/1 scsi: ufs: Fix system suspend status

In reply to a message not in the archive

From: Stanley Chu <stanley.chu-NuS5LvNUpcJWk0Htik3J/[email protected]>

hba->is_sys_suspended is set after successful system suspend but not clear after successful system resume.

According to current behavior, hba->is_sys_suspended will not be set if host is runtime-suspended but not system-suspended. Thus we shall aligh the same policy: clear this flag even if host remains runtime-suspended after ufshcd_system_resume is successfully returned.

Simply fix this flag to correct host status logs.

---
 drivers/scsi/ufs/ufshcd.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/ufs/ufshcd.c +2 -0
index 23d7cca..17536bd 100644
@@ -7916,6 +7916,8 @@ int ufshcd_system_resume(struct ufs_hba *hba)
 	trace_ufshcd_system_resume(dev_name(hba->dev), ret,
 		ktime_to_us(ktime_sub(ktime_get(), start)),
 		hba->curr_dev_pwr_mode, hba->uic_link_state);
+	if (!ret)
+		hba->is_sys_suspended = false;
 	return ret;
 }
 EXPORT_SYMBOL(ufshcd_system_resume);
Signature · 1 line
1.9.1

A message that is not in the archive (sent off-list or not yet received): 1546870774-19691-3-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/[email protected]

#5 lore raw

(Add missing maintainers/reviewers)

Hi Vinayak, Avri,

What would you think about the simple patch as below ?

Regards.

Thanks.

Quoted 30 lines · On Mon, 2019-01-07 at 22:19 +0800, stanley.chu-NuS5LvNUpcJWk0Htik3J/[email protected]…

From: Stanley Chu <stanley.chu-NuS5LvNUpcJWk0Htik3J/[email protected]>

hba->is_sys_suspended is set after successful system suspend but not clear after successful system resume.

According to current behavior, hba->is_sys_suspended will not be set if host is runtime-suspended but not system-suspended. Thus we shall aligh the same policy: clear this flag even if host remains runtime-suspended after ufshcd_system_resume is successfully returned.

Simply fix this flag to correct host status logs.

---
 drivers/scsi/ufs/ufshcd.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/ufs/ufshcd.c +2 -0
index 23d7cca..17536bd 100644
@@ -7916,6 +7916,8 @@ int ufshcd_system_resume(struct ufs_hba *hba)
 	trace_ufshcd_system_resume(dev_name(hba->dev), ret,
 		ktime_to_us(ktime_sub(ktime_get(), start)),
 		hba->curr_dev_pwr_mode, hba->uic_link_state);
+	if (!ret)
+		hba->is_sys_suspended = false;
 	return ret;
 }
 EXPORT_SYMBOL(ufshcd_system_resume);
Reviewed-by
#6 lore raw
In reply to a message not in the archive

Hi,

Quoted 4 lines

hba->is_sys_suspended is set after successful system suspend but not clear after successful system resume.

Quoted 8 lines

According to current behavior, hba->is_sys_suspended will not be set if host is runtime-suspended but not system-suspended. Thus we shall aligh the same policy: clear this flag even if host remains runtime-suspended after ufshcd_system_resume is successfully returned.

Simply fix this flag to correct host status logs.

This is already happening today for Qualcomm's vops, but you are right - it should happen anyway, regardless the platform's vendor specific resume callback.

#7 lore raw
In reply to a message not in the archive

Stanley,

Quoted 9 lines

hba->is_sys_suspended is set after successful system suspend but not clear after successful system resume.

According to current behavior, hba->is_sys_suspended will not be set if host is runtime-suspended but not system-suspended. Thus we shall aligh the same policy: clear this flag even if host remains runtime-suspended after ufshcd_system_resume is successfully returned.

Simply fix this flag to correct host status logs.

Applied to 5.0/scsi-fixes. Thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering