Re: [PATCH v5 2/2] scsi: ufs: core: Add support for static TX Equalization settings

From: Can Guo

Date: Fri May 29 2026 - 04:21:12 EST




On 5/29/2026 4:04 PM, Peter Wang (王信友) wrote:

On Thu, 2026-05-28 at 18:14 -0700, Can Guo wrote:
> +       for (i = 0; i < count; i++) {
> +               if (preshoot[i] >= TX_HS_NUM_PRESHOOT) {
> > > +       for (i = 0; i < count; i++) {
> +               if (deemphasis[i] >= TX_HS_NUM_DEEMPHASIS) {
> > +                       for (i = 0; i < count; i++) {
> +                               if (precode_en[i] > 1) {
>
Hi Can,

I suggest using
for (i = 0; i < num_elems; i++) { ... }
instead of
for (i = 0; i < count; i++) { ... }
as it is more clear.
Thanks for the review. Let me change to num_elems.
> > +static void ufshcd_parse_static_tx_eq_settings(struct ufs_hba *hba)
> +{
> +       const u32 lpd = hba->lanes_per_direction;
> +       const u32 num_elems = lpd * 2;
> +       int gear;
> +
> +       if (!lpd) {
> +               return;
> +       } else if (lpd > UFS_MAX_LANES) {

Unnecessary else if after return.
You mean removing 'else if (lpd > UFS_MAX_LANES)' and the dev_warn()?

Thanks,
Can Guo.

The others look good to me.

Thanks.
Peter

************* MEDIATEK Confidentiality Notice
********************
The information contained in this e-mail message (including any
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be
conveyed only to the designated recipient(s). Any use, dissemination,
distribution, printing, retaining or copying of this e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited and may
be unlawful. If you are not an intended recipient of this e-mail, or believe
that you have received this e-mail in error, please notify the sender
immediately (by replying to this e-mail), delete any and all copies of
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!