mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Can Guo <can.guo@oss.qualcomm.com>,
	avri.altman@wdc.com, beanhuo@micron.com,
	martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, Alim Akhtar <alim.akhtar@samsung.com>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	Peter Wang <peter.wang@mediatek.com>,
	"Bao D. Nguyen" <quic_nguyenb@quicinc.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 06/11] scsi: ufs: core: Add support to retrain TX Equalization via debugfs
Date: Thu, 5 Mar 2026 08:11:02 -0600	[thread overview]
Message-ID: <22dcd303-db72-4661-9d42-67c7215cc089@acm.org> (raw)
In-Reply-To: <20260304135313.413688-7-can.guo@oss.qualcomm.com>

On 3/4/26 7:53 AM, Can Guo wrote:
> +	ret = kstrtoint_from_user(buf, count, 0, &val);
> +	if (ret)
> +		return ret;
> +
> +	if (val != 1)
> +		return -EINVAL;

Why does "1" have to be written into the "retrain_tx_eq" attribute to
trigger retraining? Nobody will know that "1" has to be written into
this attribute without reading the code. I propose to accept strings
for this attribute, e.g. "retrain" to trigger retraining. I expect that
this will make shell scripts that write into this attribute easier to
read.

> +int ufshcd_retrain_tx_eq(struct ufs_hba *hba, u32 gear)
> +{
> +	struct ufs_pa_layer_attr new_pwr_info, final_params = { 0 };
> +	int ret;

The recommended style for zero-initializing data structures is "{}"
instead of "{ 0 }". The initializer "{}" doesn't trigger any compiler
warnings if the first member of a data structure is a pointer. A
compiler warning will be triggered when using "{ 0 }" and the first
member of a data structure is a pointer.

> +	ret = ufshcd_pause_command_processing(hba, 1 * USEC_PER_SEC);
> +	if (ret)
> +		return ret;
> +
> +	ufshcd_hold(hba);

The ufshcd_hold() call probably should come before the
ufshcd_pause_command_processing() call to reduce latency.

> +int ufshcd_pause_command_processing(struct ufs_hba *hba, u64 timeout_us)
> +{
> +	int ret = 0;
> +
> +	mutex_lock(&hba->host->scan_mutex);
> +	blk_mq_quiesce_tagset(&hba->host->tag_set);
> +	down_write(&hba->clk_scaling_lock);
> +
> +	if (ufshcd_wait_for_pending_cmds(hba, 1 * USEC_PER_SEC)) {
> +		ret = -EBUSY;
> +		up_write(&hba->clk_scaling_lock);
> +		blk_mq_unquiesce_tagset(&hba->host->tag_set);
> +		mutex_unlock(&hba->host->scan_mutex);
> +	}
> +
> +	return ret;
> +}
> +
> +void ufshcd_resume_command_processing(struct ufs_hba *hba)
> +{
> +	up_write(&hba->clk_scaling_lock);
> +	blk_mq_unquiesce_tagset(&hba->host->tag_set);
> +	mutex_unlock(&hba->host->scan_mutex);
> +}

Because of the "one change per patch" rule, introduction of these two
helper functions should go into a separate patch.

Thanks,

Bart.

  reply	other threads:[~2026-03-05 14:11 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 13:53 [PATCH v2 00/11] scsi: ufs: Add TX Equalization support for UFS 5.0 Can Guo
2026-03-04 13:53 ` [PATCH v2 01/11] scsi: ufs: core: Introduce a new ufshcd vops negotiate_pwr_mode() Can Guo
2026-03-05 12:53   ` Krzysztof Kozlowski
2026-03-06 12:25     ` Can Guo
2026-03-05 21:03   ` Bean Huo
2026-03-06 12:41     ` Can Guo
2026-03-04 13:53 ` [PATCH v2 02/11] scsi: ufs: core: Pass force_pmc to ufshcd_config_pwr_mode() as a parameter Can Guo
2026-03-05 13:54   ` Bart Van Assche
2026-03-04 13:53 ` [PATCH v2 03/11] scsi: ufs: core: Add UFS_HS_G6 and UFS_HS_GEAR_MAX to enum ufs_hs_gear_tag Can Guo
2026-03-05 13:53   ` Bart Van Assche
2026-03-04 13:53 ` [PATCH v2 04/11] scsi: ufs: core: Add support for TX Equalization Can Guo
2026-03-04 20:46   ` kernel test robot
2026-03-04 23:18   ` kernel test robot
2026-03-05 21:50   ` Bean Huo
2026-03-06 12:59     ` Can Guo
2026-03-04 13:53 ` [PATCH v2 05/11] scsi: ufs: core: Add debugfs entries for TX Equalization params Can Guo
2026-03-05 14:00   ` Bart Van Assche
2026-03-04 13:53 ` [PATCH v2 06/11] scsi: ufs: core: Add support to retrain TX Equalization via debugfs Can Guo
2026-03-05 14:11   ` Bart Van Assche [this message]
2026-03-07 13:02     ` Can Guo
2026-03-05 21:25   ` Bean Huo
2026-03-06 13:26     ` Can Guo
2026-03-04 13:53 ` [PATCH v2 07/11] scsi: ufs: ufs-qcom: Fixup PAM-4 TX L0_L1_L2_L3 adaptation pattern length Can Guo
2026-03-04 15:10   ` Manivannan Sadhasivam
2026-03-06 11:14     ` Can Guo
2026-03-04 13:53 ` [PATCH v2 08/11] scsi: ufs: ufs-qcom: Implement vops tx_eqtr_notify() Can Guo
2026-03-04 15:20   ` Manivannan Sadhasivam
2026-03-06 13:41     ` Can Guo
2026-03-05 21:17   ` Bean Huo
2026-03-06 13:33     ` Can Guo
2026-03-04 13:53 ` [PATCH v2 09/11] scsi: ufs: ufs-qcom: Implement vops get_rx_fom() Can Guo
2026-03-04 15:39   ` Manivannan Sadhasivam
2026-03-06 14:04     ` Can Guo
2026-03-04 13:53 ` [PATCH v2 10/11] scsi: ufs: ufs-qcom: Implement vops apply_tx_eqtr_settings() Can Guo
2026-03-04 15:41   ` Manivannan Sadhasivam
2026-03-06 14:05     ` Can Guo
2026-03-04 13:53 ` [PATCH v2 11/11] scsi: ufs: ufs-qcom: Enable TX Equalization Can Guo
2026-03-05 15:04 ` [PATCH v2 00/11] scsi: ufs: Add TX Equalization support for UFS 5.0 Bean Huo
2026-03-06 14:14   ` Can Guo

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=22dcd303-db72-4661-9d42-67c7215cc089@acm.org \
    --to=bvanassche@acm.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=can.guo@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=peter.wang@mediatek.com \
    --cc=quic_nguyenb@quicinc.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

all inboxes | Powered by JetHome®