All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kiwoong Kim" <kwmad.kim@samsung.com>
To: "'Avri Altman'" <Avri.Altman@wdc.com>,
	<linux-scsi@vger.kernel.org>, <alim.akhtar@samsung.com>,
	<jejb@linux.ibm.com>, <martin.petersen@oracle.com>,
	<beanhuo@micron.com>, <asutoshd@codeaurora.org>,
	<cang@codeaurora.org>, <bvanassche@acm.org>,
	<grant.jung@samsung.com>, <sc.suh@samsung.com>,
	<hy50.seo@samsung.com>, <sh425.lee@samsung.com>
Subject: RE: [PATCH v2] ufs: change the way to complete fDeviceInit
Date: Mon, 10 Aug 2020 19:07:58 +0900	[thread overview]
Message-ID: <006101d66efe$200279b0$60076d10$@samsung.com> (raw)
In-Reply-To: <SN6PR04MB464091A87323AD75C4453BE9FC440@SN6PR04MB4640.namprd04.prod.outlook.com>

> 
> > +       ktime_t start;
> > +       s64 time;
> Can this be done with less variables?  e.g is this working?
> ktime_t timeout; 
I checked it worked. Nevertheless, I'll replace with your style.

Thanks.
Kiwoong Kim
> 
> >
> >         err = ufshcd_query_flag_retry(hba, UPIU_QUERY_OPCODE_SET_FLAG,
> >                 QUERY_FLAG_IDN_FDEVICEINIT, 0, NULL); @@ -4161,20
> > +4165,27 @@ static int ufshcd_complete_dev_init(struct ufs_hba
> > *hba)
> >                 goto out;
> >         }
> >
> > -       /* poll for max. 1000 iterations for fDeviceInit flag to clear */
> > -       for (i = 0; i < 1000 && !err && flag_res; i++)
> > -               err = ufshcd_query_flag_retry(hba,
> > UPIU_QUERY_OPCODE_READ_FLAG,
> > -                       QUERY_FLAG_IDN_FDEVICEINIT, 0, &flag_res);
> > +       /* Poll fDeviceInit flag to be cleared */
> > +       start = ktime_get();
> timeout = ktime_add_ms(ktime_get(), FDEVICEINIT_COMPL_TIMEOUT);
> 
> > +       do {
> > +               err = ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG,
> > +                                       QUERY_FLAG_IDN_FDEVICEINIT, 0, &flag_res);
> > +               if (!flag_res)
> > +                       break;
> > +               usleep_range(5000, 10000);
> > +               time = ktime_to_ms(ktime_sub(ktime_get(), start));
> > +       } while (time < FDEVICEINIT_COMPL_TIMEOUT);
> while (ktime_before(ktime_get(), timeout));
> 
> 
> 
> Thanks,
> Avri


      reply	other threads:[~2020-08-10 10:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200810060457epcas2p3023e61584089a0f285338d7e04ccaefe@epcas2p3.samsung.com>
2020-08-10  5:56 ` [PATCH v2] ufs: change the way to complete fDeviceInit Kiwoong Kim
2020-08-10  6:54   ` Avri Altman
2020-08-10 10:07     ` Kiwoong Kim [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='006101d66efe$200279b0$60076d10$@samsung.com' \
    --to=kwmad.kim@samsung.com \
    --cc=Avri.Altman@wdc.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=grant.jung@samsung.com \
    --cc=hy50.seo@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sc.suh@samsung.com \
    --cc=sh425.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.