public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daejun Park <daejun7.park@samsung.com>
To: Bart Van Assche <bvanassche@acm.org>,
	Daejun Park <daejun7.park@samsung.com>,
	"avri.altman@wdc.com" <avri.altman@wdc.com>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"asutoshd@codeaurora.org" <asutoshd@codeaurora.org>,
	"beanhuo@micron.com" <beanhuo@micron.com>,
	"stanley.chu@mediatek.com" <stanley.chu@mediatek.com>,
	"cang@codeaurora.org" <cang@codeaurora.org>,
	"tomas.winkler@intel.com" <tomas.winkler@intel.com>,
	ALIM AKHTAR <alim.akhtar@samsung.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Sang-yoon Oh <sangyoon.oh@samsung.com>,
	Sung-Jun Park <sungjun07.park@samsung.com>,
	yongmyung lee <ymhungry.lee@samsung.com>,
	Jinyoung CHOI <j-young.choi@samsung.com>,
	Adel Choi <adel.choi@samsung.com>,
	BoRam Shin <boram.shin@samsung.com>
Subject: Re: [PATCH v8 2/4] scsi: ufs: Introduce HPB feature
Date: Thu, 13 Aug 2020 11:13:09 +0900	[thread overview]
Message-ID: <1239183618.61597285503620.JavaMail.epsvc@epcpadp1> (raw)
In-Reply-To: <4a91d02c-488c-86cd-325c-5e0ad9addd0b@acm.org>

Hi Bart,

On 2020-08-06 02:11, Daejun Park wrote:
> > +static void ufshpb_issue_hpb_reset_query(struct ufs_hba *hba)
> > +{
> > +    int err;
> > +    int retries;
> > +
> > +    for (retries = 0; retries < HPB_RESET_REQ_RETRIES; retries++) {
> > +        err = ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_SET_FLAG,
> > +                QUERY_FLAG_IDN_HPB_RESET, 0, NULL);
> > +        if (err)
> > +            dev_dbg(hba->dev,
> > +                "%s: failed with error %d, retries %d\n",
> > +                __func__, err, retries);
> > +        else
> > +            break;
> > +    }
> > +
> > +    if (err) {
> > +        dev_err(hba->dev,
> > +            "%s setting fHpbReset flag failed with error %d\n",
> > +            __func__, err);
> > +        return;
> > +    }
> > +}
> 
> Please change the "break" into an early return, remove the last
> occurrence "if (err)" and remove the final return statement.

OK, I will.

> 
> > +static void ufshpb_check_hpb_reset_query(struct ufs_hba *hba)
> > +{
> > +    int err;
> > +    bool flag_res = true;
> > +    int try = 0;
> > +
> > +    /* wait for the device to complete HPB reset query */
> > +    do {
> > +        if (++try == HPB_RESET_REQ_RETRIES)
> > +            break;
> > +
> > +        dev_info(hba->dev,
> > +            "%s start flag reset polling %d times\n",
> > +            __func__, try);
> > +
> > +        /* Poll fHpbReset flag to be cleared */
> > +        err = ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG,
> > +                QUERY_FLAG_IDN_HPB_RESET, 0, &flag_res);
> > +        usleep_range(1000, 1100);
> > +    } while (flag_res);
> > +
> > +    if (err) {
> > +        dev_err(hba->dev,
> > +            "%s reading fHpbReset flag failed with error %d\n",
> > +            __func__, err);
> > +        return;
> > +    }
> > +
> > +    if (flag_res) {
> > +        dev_err(hba->dev,
> > +            "%s fHpbReset was not cleared by the device\n",
> > +            __func__);
> > +    }
> > +}
> 
> Should "polling %d times" perhaps be changed into "attempt %d"?

I will change it.

> The "if (err)" statement may be reached without "err" having been
> initialized. Please fix.

OK, I will initialize err to 0.

> Additionally, please change the do-while loop into a for-loop, e.g. as
> follows:
> 
>     for (try = 0; try < HPB_RESET_REQ_RETRIES; try++)
>         ...

OK, I will change do-while to for-loop.

Thanks,

Daejun

  reply	other threads:[~2020-08-13  2:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200806073257epcms2p61564ed62e02fc42fc3c2b18fa92a038d@epcms2p6>
2020-08-06  7:32 ` [PATCH v8 0/4] scsi: ufs: Add Host Performance Booster Support Daejun Park
2020-08-06  9:02   ` [PATCH v8 1/4] scsi: ufs: Add UFS feature related parameter Daejun Park
2020-08-06  9:11     ` [PATCH v8 2/4] scsi: ufs: Introduce HPB feature Daejun Park
2020-08-06  9:15       ` [PATCH v8 3/4] scsi: ufs: L2P map management for HPB read Daejun Park
2020-08-06  9:18         ` [PATCH v8 4/4] scsi: ufs: Prepare HPB read for cached sub-region Daejun Park
2020-08-09  0:35           ` Bart Van Assche
2020-08-13  3:15             ` Daejun Park
2020-08-09  0:29         ` [PATCH v8 3/4] scsi: ufs: L2P map management for HPB read Bart Van Assche
2020-08-13  3:13           ` Daejun Park
2020-08-08 22:56       ` [PATCH v8 2/4] scsi: ufs: Introduce HPB feature Bart Van Assche
2020-08-13  2:13         ` Daejun Park [this message]
2020-08-09  0:07       ` Bart Van Assche
2020-08-13  3:00         ` Daejun Park
2020-08-13  3:22           ` Bart Van Assche
2020-08-08 23:00     ` [PATCH v8 1/4] scsi: ufs: Add UFS feature related parameter Bart Van Assche
2020-08-13  2:16       ` Daejun Park
2020-08-06  9:52   ` [PATCH v8 0/4] scsi: ufs: Add Host Performance Booster Support Bean Huo
2020-08-06  9:56     ` Avri Altman
2020-08-06 10:02       ` Bean Huo
2020-08-06 10:12         ` Avri Altman
2020-08-06 10:28           ` Bean Huo
2020-08-06 13:56             ` Avri Altman
2020-08-06 16:36               ` Alim Akhtar
2020-08-06 18:39                 ` Bart Van Assche
2020-08-06 23:15               ` Daejun Park
2020-08-07  4:32               ` Martin K. Petersen

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=1239183618.61597285503620.JavaMail.epsvc@epcpadp1 \
    --to=daejun7.park@samsung.com \
    --cc=adel.choi@samsung.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=boram.shin@samsung.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=j-young.choi@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sangyoon.oh@samsung.com \
    --cc=stanley.chu@mediatek.com \
    --cc=sungjun07.park@samsung.com \
    --cc=tomas.winkler@intel.com \
    --cc=ymhungry.lee@samsung.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