From: Can Guo <can.guo@oss.qualcomm.com>
To: Bart Van Assche <bvanassche@acm.org>,
beanhuo@micron.com, peter.wang@mediatek.com,
martin.petersen@oracle.com, mani@kernel.org
Cc: linux-scsi@vger.kernel.org, Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>,
Nitin Rawat <quic_nitirawa@quicinc.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 2/2] scsi: ufs: core: Add support for static TX Equalization settings
Date: Fri, 29 May 2026 09:11:18 +0800 [thread overview]
Message-ID: <e8c740d0-99d3-4c01-87e5-f324698eac2a@oss.qualcomm.com> (raw)
In-Reply-To: <312d0eca-108f-48af-a1b9-a5dcc24e70fd@acm.org>
On 5/29/2026 12:02 AM, Bart Van Assche wrote:
> On 5/28/26 3:06 AM, Can Guo wrote:
>> +static void ufshcd_parse_static_tx_eq_settings(struct ufs_hba *hba)
>> +{
>> + size_t sz = hba->lanes_per_direction * 2;
>
> Please mark constants with "const". Additionally, is "sz" a good name
> for this variable? The code below compares "count" and "sz". I haven't
> seen it before that a count and a size are compared with each other.
>
> Why "size_t" as data type? u32 should be sufficient, isn't it?
>
>> + u32 lpd = hba->lanes_per_direction;
>
> Is this another constant?
>
>> + if (!lpd || lpd > UFS_MAX_LANES)
>> + return;
>
> Should a kernel warning perhaps be issued if lpd > UFS_MAX_LANES?
>
>> + for (gear = UFS_HS_G1; gear <= UFS_HS_GEAR_MAX; gear++) {
>> + snprintf(prop_name, MAX_PROP_SIZE, "txeq-preshoot-g%d", gear);
>> + count = of_property_count_u32_elems(dev->of_node, prop_name);
>> + if (count <= 0)
>> + continue;
>
> The body of this for-loop is long. Please consider moving the body of
> this for-loop into a new function to reduce the indentation level of
> the code.
>
>> + for (i = 0; i < count; i++) {
>> + if (preshoot[i] >= TX_HS_NUM_PRESHOOT) {
>> + dev_err(dev, "An invalid TX EQ PreShoot (%d)
>> provided in %s property\n",
>> + preshoot[i], prop_name);
>> + break;
>> + }
>> + }
>> +
>> + if (i != count)
>> + continue;
>
> The traditional way in the Linux kernel for breaking out of a nested
> loop is using a "goto" or "return" statement.
Hi Bart,
Thanks for the review, I will address them in next version.
Can Guo.
>
> Thanks,
>
> Bart.
prev parent reply other threads:[~2026-05-29 1:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260528100614.3386423-1-can.guo@oss.qualcomm.com>
2026-05-28 10:06 ` [PATCH v4 1/2] dt-bindings: ufs: Document static TX Equalization settings properties Can Guo
2026-05-28 15:57 ` Bean Huo
2026-05-28 10:06 ` [PATCH v4 2/2] scsi: ufs: core: Add support for static TX Equalization settings Can Guo
2026-05-28 12:27 ` Manivannan Sadhasivam
2026-05-28 16:02 ` Bart Van Assche
2026-05-29 1:11 ` Can Guo [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=e8c740d0-99d3-4c01-87e5-f324698eac2a@oss.qualcomm.com \
--to=can.guo@oss.qualcomm.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mani@kernel.org \
--cc=martin.petersen@oracle.com \
--cc=peter.wang@mediatek.com \
--cc=quic_nitirawa@quicinc.com \
--cc=quic_rdwivedi@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®