From: Drew Fustini <fustini@kernel.org>
To: Icenowy Zheng <zhengxingda@iscas.ac.cn>, sashiko-reviews@lists.linux.dev
Cc: neil.armstrong@linaro.org, linux-phy@lists.infradead.org,
robh@kernel.org, conor+dt@kernel.org, olteanv@gmail.com,
vkoul@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 2/2] phy: add a driver for T-Head TH1520 USB PHY
Date: Wed, 29 Jul 2026 08:51:38 -0700 [thread overview]
Message-ID: <amohirbdNtDLtXeH@x1> (raw)
In-Reply-To: <20260723085527.BDB5A1F000E9@smtp.kernel.org>
On Thu, Jul 23, 2026 at 08:55:27AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] Missing explicit inclusion of `<linux/delay.h>` for `udelay()`.
[..]
> > +static int th1520_usb_phy_init(struct phy *phy)
> > +{
> > + struct th1520_usb_phy *th1520_phy = phy_get_drvdata(phy);
> > + int ret;
> > +
> > + ret = clk_prepare_enable(th1520_phy->ref_clk);
> > + if (ret)
> > + return ret;
> > +
> > + ret = reset_control_assert(th1520_phy->phy_reset);
> > + if (ret)
> > + goto err_disable_clk;
> > +
> > + /*
> > + * Do some initial PHY setup:
> > + * - Set COMMONONN to allow the PHY to automatically power down.
> > + * - Set REF_SSP_EN to enable feeding reference clock to SuperSpeed
> > + * PHY clock PLL.
> > + */
> > + regmap_set_bits(th1520_phy->regmap, USB_SYS, USB_SYS_COMMONONN);
> > + regmap_set_bits(th1520_phy->regmap, USB_SSP_EN, USB_SSP_EN_REF_SSP_EN);
> > +
> > + ret = reset_control_deassert(th1520_phy->phy_reset);
> > + if (ret)
> > + goto err_disable_clk;
> > +
> > + udelay(10);
>
> [Severity: Low]
> This isn't a bug, but this code uses udelay() without explicitly including
> <linux/delay.h>.
>
> While it currently compiles due to indirect inclusions, should the header be
> explicitly included to prevent build failures if the include chain is later
> refactored?
I noticed that checkpatch complains about 'udelay()':
CHECK: usleep_range is preferred over udelay; see function description
of usleep_range() and udelay().
However, it seems that fsleep(10) may be a better choice than
usleep_range(). It is used by phy-snps-eusb2.c, phy-rzg3e-usb3.c and
phy-exynos5-usbdrd.c.
From include/linux/delay.h:
static inline void fsleep(unsigned long usecs)
{
if (usecs <= 10)
udelay(usecs);
else if (usecs < USLEEP_RANGE_UPPER_BOUND)
usleep_range(usecs, usecs + (usecs >> max_slack_shift));
else
msleep(DIV_ROUND_UP(usecs, USEC_PER_MSEC));
}
Thanks,
Drew
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-07-29 15:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 8:43 [PATCH v2 0/2] phy: add support for TH1520 USB PHY Icenowy Zheng
2026-07-23 8:43 ` [PATCH v2 1/2] dt-bindings: phy: add binding for T-Head " Icenowy Zheng
2026-07-23 8:47 ` sashiko-bot
2026-07-23 14:05 ` Icenowy Zheng
2026-07-28 23:38 ` Drew Fustini
2026-07-23 14:09 ` Icenowy Zheng
2026-07-28 21:08 ` Drew Fustini
2026-07-23 8:43 ` [PATCH v2 2/2] phy: add a driver " Icenowy Zheng
2026-07-23 8:55 ` sashiko-bot
2026-07-29 15:51 ` Drew Fustini [this message]
2026-07-28 21:44 ` Drew Fustini
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=amohirbdNtDLtXeH@x1 \
--to=fustini@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
--cc=zhengxingda@iscas.ac.cn \
/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;
as well as URLs for NNTP newsgroup(s).