mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Daniel Lee <chullee@google.com>,
	James.Bottomley@hansenpartnership.com,
	martin.petersen@oracle.com
Cc: alim.akhtar@samsung.com, tanghuan@vivo.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ufs: sysfs: Add WB partial flush mode support
Date: Wed, 10 Jun 2026 11:19:53 -0700	[thread overview]
Message-ID: <fd67c7af-4e80-403f-bcde-0e0fadf6d5d0@acm.org> (raw)
In-Reply-To: <20260610134316.990430-1-chullee@google.com>

On 6/10/26 6:43 AM, Daniel Lee wrote:
> +static const char *ufs_wb_pfm_to_string(u32 pfm)
> +{
> +	if (pfm < NUM_WB_PARTIAL_FLUSH_MODES)
> +		return wb_partial_flush_modes[pfm];
> +
> +	return "unknown";
> +}

Is a new function really required for something that can be written as a
single ternary expression? Please consider folding this function into 
its caller since the above function only has one caller.

> +
> +

Please follow the convention used elsewhere in the Linux kernel and only 
insert a single blank line between definitions.

> +	ret = ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG,
> +		idn, index, &flag);
> +	ufshcd_rpm_put_sync(hba);
> +	if (ret) {
> +		ret = -EINVAL;
> +		goto out;
> +	}

Why is the error code returned by ufshcd_query_flag() changed into
-EINVAL? Isn't this something that should only happen if
ufshcd_query_flag() returns a positive value? From the comment block
above the definition of ufshcd_query_flag():

  * Return: 0 upon success; > 0 in case the UFS device reported an OCS 
error;
  * < 0 if another error occurred.

> +	ret = ufshcd_query_flag(hba,
> +		value ? UPIU_QUERY_OPCODE_SET_FLAG : UPIU_QUERY_OPCODE_CLEAR_FLAG,
> +		idn, index, NULL);
> +	ufshcd_rpm_put_sync(hba);
> +	if (ret) {
> +		ret = -EINVAL;
> +		goto out;
> +	}

Same comment here.

> +	if (ufshcd_is_qword_attr(idn))
> +		ret = ufshcd_query_attr_qword(hba, UPIU_QUERY_OPCODE_READ_ATTR,
> +			idn, index, 0, &qword_value);
> +	else
> +		ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR,
> +			idn, index, 0, &value);
> +	ufshcd_rpm_put_sync(hba);
> +	if (ret) {
> +		ret = -EINVAL;
> +		goto out;
> +	}

Same comment here.

> +	ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR,
> +		idn, index, 0, &value);
> +	ufshcd_rpm_put_sync(hba);
> +	if (ret) {
> +		ret = -EINVAL;
> +		goto out;
> +	}

Same comment here.

> +	ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR,
> +		QUERY_ATTR_IDN_WB_PFM, ufshcd_wb_get_query_index(hba), 0, &value);
> +	ufshcd_rpm_put_sync(hba);
> +	up(&hba->host_sem);
> +	if (ret)
> +		return -EINVAL;

Same comment here.

> +	ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR,
> +		QUERY_ATTR_IDN_WB_PFM, ufshcd_wb_get_query_index(hba), 0, &value);
> +	ufshcd_rpm_put_sync(hba);
> +	up(&hba->host_sem);
> +
> +	return ret ? -EINVAL : count;

Same comment here.

Otherwise this patch looks good to me.

Thanks,

Bart.

      reply	other threads:[~2026-06-10 18:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10 13:43 Daniel Lee
2026-06-10 18:19 ` Bart Van Assche [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=fd67c7af-4e80-403f-bcde-0e0fadf6d5d0@acm.org \
    --to=bvanassche@acm.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=alim.akhtar@samsung.com \
    --cc=chullee@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=tanghuan@vivo.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®