public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Kiwoong Kim <kwmad.kim@samsung.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com,
	martin.petersen@oracle.com, beanhuo@micron.com,
	adrian.hunter@intel.com, sc.suh@samsung.com,
	hy50.seo@samsung.com, sh425.lee@samsung.com,
	bhoon95.kim@samsung.com, kwangwon.min@samsung.com,
	junwoo80.lee@samsung.com
Subject: Re: [PATCH v2] ufs: poll pmc until another pa request is completed
Date: Wed, 10 May 2023 13:05:10 -0700	[thread overview]
Message-ID: <60542301-e77f-ad26-e249-29d42f446d74@acm.org> (raw)
In-Reply-To: <1682385635-43601-1-git-send-email-kwmad.kim@samsung.com>

On 4/24/23 18:20, Kiwoong Kim wrote:
> @@ -4138,6 +4141,61 @@ int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,
>   }
>   EXPORT_SYMBOL_GPL(ufshcd_dme_get_attr);
>   
> +static int __ufshcd_poll_uic_pwr(struct ufs_hba *hba, struct uic_command *cmd,
> +		struct completion *cnf)

What does the name "cnf" mean? To me it seems to be a weird name for a 
completion function pointer.

> +{
> +	unsigned long flags;
> +	int ret;
> +	ktime_t timeout;
> +	u32 mode = cmd->argument3;

Is my understanding correct that __ufshcd_send_uic_cmd() does not modify 
cmd->argument3? If so, why does this function copy cmd->argument3 and 
re-assign cmd->argument3?

> +	timeout = ktime_add_ms(ktime_get(), UIC_PA_RDY_TIMEOUT);

"deadline" is probably a better name for this variable than "timeout". 
Additionally, please consider using jiffies since I think that the 
accuracy of the jiffies counter is sufficient in this context.

> +	do {
> +		spin_lock_irqsave(hba->host->host_lock, flags);
> +		hba->active_uic_cmd = NULL;

Is my understanding correct that it is guaranteed that 
hba->active_uic_cmd is NULL here? If so, what is the purpose of the 
above statement?

> +		ret = __ufshcd_send_uic_cmd(hba, cmd, true);
> +		spin_unlock_irqrestore(hba->host->host_lock, flags);
> +		if (ret) {
> +			dev_err(hba->dev,
> +				"pwr ctrl cmd 0x%x with mode 0x%x uic error %d\n",
> +				cmd->command, cmd->argument3, ret);
> +			goto out;
> +		}
> +
> +		/* This value is heuristic */
> +		if (!wait_for_completion_timeout(&cmd->done,
> +		    msecs_to_jiffies(5))) {

Please align msecs_to_jiffies(5) with the first argument ("&cmd->done").

> +			ret = -ETIMEDOUT;
> +			dev_err(hba->dev,
> +				"pwr ctrl cmd 0x%x with mode 0x%x timeout\n",
> +				cmd->command, cmd->argument3);
> +			if (cmd->cmd_active)
> +				goto out;
> +
> +			dev_info(hba->dev, "%s: pwr ctrl cmd has already been completed\n", __func__);
> +		}
> +
> +		/* retry for only busy cases */

Please fix the word order in the above comment (for only -> only for)

Thanks,

Bart.

  reply	other threads:[~2023-05-10 20:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230425012857epcas2p45eaa3f5f87de424bbf951b22653b3e70@epcas2p4.samsung.com>
2023-04-25  1:20 ` [PATCH v2] ufs: poll pmc until another pa request is completed Kiwoong Kim
2023-05-10 20:05   ` Bart Van Assche [this message]
2023-05-11  0:26     ` Kiwoong Kim

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=60542301-e77f-ad26-e249-29d42f446d74@acm.org \
    --to=bvanassche@acm.org \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bhoon95.kim@samsung.com \
    --cc=hy50.seo@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=junwoo80.lee@samsung.com \
    --cc=kwangwon.min@samsung.com \
    --cc=kwmad.kim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox