From: Bart Van Assche <bvanassche@acm.org>
To: Can Guo <can.guo@oss.qualcomm.com>,
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: Thu, 28 May 2026 09:02:51 -0700 [thread overview]
Message-ID: <312d0eca-108f-48af-a1b9-a5dcc24e70fd@acm.org> (raw)
In-Reply-To: <20260528100614.3386423-3-can.guo@oss.qualcomm.com>
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.
Thanks,
Bart.
next prev parent reply other threads:[~2026-05-28 16:03 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 [this message]
2026-05-29 1:11 ` 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=312d0eca-108f-48af-a1b9-a5dcc24e70fd@acm.org \
--to=bvanassche@acm.org \
--cc=James.Bottomley@HansenPartnership.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=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®