public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Peter Wang (王信友)" <peter.wang@mediatek.com>
To: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"bvanassche@acm.org" <bvanassche@acm.org>,
	"avri.altman@wdc.com" <avri.altman@wdc.com>,
	"Stanley Chu (朱原陞)" <stanley.chu@mediatek.com>,
	"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>
Cc: "linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"Jiajie Hao (郝加节)" <jiajie.hao@mediatek.com>,
	"CC Chou (周志杰)" <cc.chou@mediatek.com>,
	"Eddie Huang (黃智傑)" <eddie.huang@mediatek.com>,
	"Alice Chao (趙珮均)" <Alice.Chao@mediatek.com>,
	wsd_upstream <wsd_upstream@mediatek.com>,
	"Lin Gui (桂林)" <Lin.Gui@mediatek.com>,
	"Chun-Hung Wu (巫駿宏)" <Chun-hung.Wu@mediatek.com>,
	"Tun-yu Yu (游敦聿)" <Tun-yu.Yu@mediatek.com>,
	"Chaotian Jing (井朝天)" <Chaotian.Jing@mediatek.com>,
	"Powen Kao (高伯文)" <Powen.Kao@mediatek.com>,
	"Naomi Chu (朱詠田)" <Naomi.Chu@mediatek.com>,
	"Qilin Tan (谭麒麟)" <Qilin.Tan@mediatek.com>
Subject: Re: [PATCH v3] ufs: core: wlun suspend SSU/enter hibern8 fail recovery
Date: Tue, 6 Dec 2022 03:07:40 +0000	[thread overview]
Message-ID: <f27ddbdef80a8007c8c0cf170a7a442a40c91b37.camel@mediatek.com> (raw)
In-Reply-To: <6785696a-cb52-5934-dbd6-28472b4cd7c6@acm.org>

On Mon, 2022-12-05 at 10:41 -0800, Bart Van Assche wrote:
> On 12/1/22 23:35, peter.wang@mediatek.com wrote:
> > From: Peter Wang <peter.wang@mediatek.com>
> > 
> > When SSU/enter hibern8 fail in wlun suspend flow, trigger error
> > handler and return busy to break the suspend.
> > If not, wlun runtime pm status become error and the consumer will
> > stuck in runtime suspend status.
> > 
> > Signed-off-by: Peter Wang <peter.wang@mediatek.com>
> > ---
> >   drivers/ufs/core/ufshcd.c | 26 ++++++++++++++++++++++++++
> >   1 file changed, 26 insertions(+)
> > 
> > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> > index b1f59a5fe632..a0dbf2c410b1 100644
> > --- a/drivers/ufs/core/ufshcd.c
> > +++ b/drivers/ufs/core/ufshcd.c
> > @@ -9049,6 +9049,19 @@ static int __ufshcd_wl_suspend(struct
> > ufs_hba *hba, enum ufs_pm_op pm_op)
> >   
> >   		if (!hba->dev_info.b_rpm_dev_flush_capable) {
> >   			ret = ufshcd_set_dev_pwr_mode(hba,
> > req_dev_pwr_mode);
> > +			if (ret && (pm_op != UFS_SHUTDOWN_PM)) {
> > +				/*
> > +				 * If return err in suspend flow, IO
> > will hang.
> > +				 * Trigger error handler and break
> > suspend for
> > +				 * error recovery.
> > +				 */
> > +				spin_lock_irq(hba->host->host_lock);
> > +				hba->force_reset = true;
> > +				ufshcd_schedule_eh_work(hba);
> > +				spin_unlock_irq(hba->host->host_lock);
> > +
> > +				ret = -EBUSY;
> > +			}
> >   			if (ret)
> >   				goto enable_scaling;
> >   		}
> > @@ -9060,6 +9073,19 @@ static int __ufshcd_wl_suspend(struct
> > ufs_hba *hba, enum ufs_pm_op pm_op)
> >   	 */
> >   	check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba);
> >   	ret = ufshcd_link_state_transition(hba, req_link_state,
> > check_for_bkops);
> > +	if ((ret) && (pm_op != UFS_SHUTDOWN_PM)) {
> > +		/*
> > +		 * If return err in suspend flow, IO will hang.
> > +		 * Trigger error handler and break suspend for
> > +		 * error recovery.
> > +		 */
> > +		spin_lock_irq(hba->host->host_lock);
> > +		hba->force_reset = true;
> > +		ufshcd_schedule_eh_work(hba);
> > +		spin_unlock_irq(hba->host->host_lock);
> > +
> > +		ret = -EBUSY;
> > +	}
> >   	if (ret)
> >   		goto set_dev_active;
> >   
> 
> Please follow the coding style that is used elsewhere in the kernel
> and
> remove the superfluous parentheses from this patch. "if (ret &&
> (pm_op !=
> UFS_SHUTDOWN_PM)) {" can be changed into "if (ret && pm_op !=
> UFS_SHUTDOWN_PM) {" and "if ((ret) && (pm_op != UFS_SHUTDOWN_PM)) {"
> can be
> changed into "if ((ret) && (pm_op != UFS_SHUTDOWN_PM)) {".
> 
> Otherwise this patch looks good to me.
> 
> Thanks,

Hi Bart,

Got it, will remove parentheses next version.
Thanks for review.

BR
Peter


> 
> Bart.

      reply	other threads:[~2022-12-06  3:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02  7:35 [PATCH v3] ufs: core: wlun suspend SSU/enter hibern8 fail recovery peter.wang
2022-12-05 18:41 ` Bart Van Assche
2022-12-06  3:07   ` Peter Wang (王信友) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f27ddbdef80a8007c8c0cf170a7a442a40c91b37.camel@mediatek.com \
    --to=peter.wang@mediatek.com \
    --cc=Alice.Chao@mediatek.com \
    --cc=Chaotian.Jing@mediatek.com \
    --cc=Chun-hung.Wu@mediatek.com \
    --cc=Lin.Gui@mediatek.com \
    --cc=Naomi.Chu@mediatek.com \
    --cc=Powen.Kao@mediatek.com \
    --cc=Qilin.Tan@mediatek.com \
    --cc=Tun-yu.Yu@mediatek.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=cc.chou@mediatek.com \
    --cc=eddie.huang@mediatek.com \
    --cc=jejb@linux.ibm.com \
    --cc=jiajie.hao@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stanley.chu@mediatek.com \
    --cc=wsd_upstream@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox