diff mbox series

[v1,1/1] scsi: ufs: Fix system suspend status

Message ID 1546870774-19691-3-git-send-email-stanley.chu@mediatek.com (mailing list archive)
State New, archived
Headers show
Series [v1,1/1] scsi: ufs: Fix system suspend status | expand

Commit Message

Stanley Chu Jan. 7, 2019, 2:19 p.m. UTC
From: Stanley Chu <stanley.chu@mediatek.com>

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.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufshcd.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stanley Chu Jan. 10, 2019, 3:13 a.m. UTC | #1
(Add missing maintainers/reviewers)

Hi Vinayak, Avri,

What would you think about the simple patch as below ?

Regards.

Thanks.


On Mon, 2019-01-07 at 22:19 +0800, stanley.chu@mediatek.com wrote:
> From: Stanley Chu <stanley.chu@mediatek.com>
> 
> 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.
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 23d7cca..17536bd 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -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);
Avri Altman Jan. 10, 2019, 11:59 a.m. UTC | #2
Hi,
> 
> 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.
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>

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.
Martin K. Petersen Jan. 12, 2019, 3:17 a.m. UTC | #3
Stanley,

> 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!
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 23d7cca..17536bd 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -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);