Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Fil Dunsky" <filipp.dunsky@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v5 2/3] net: mdio: Add Cortina CS7542 bus controller
Date: Sat, 05 Dec 2026 03:58:02 +0000	[thread overview]
Message-ID: <sashiko-outbox-251027@kernel.org> (raw)
In-Reply-To: <20261204-b4-cs7542-mdio-v5-2-c9b9b51bf58d@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: mdio: cs75xx_mdio_wait() uses 1 us sleep in
  readl_poll_timeout()
--

commit 4c7efb2b12f84962992af0098d7dfb6dd1589019
Author: Fil Dunsky <filipp.dunsky@gmail.com>

net: mdio: Add Cortina CS7542 bus controller

This commit adds a Clause 22 MDIO bus controller driver for the Cortina
Systems CS7542 using sleepable register polling and managed device resources.

> diff --git a/drivers/net/mdio/mdio-cs75xx.c b/drivers/net/mdio/mdio-cs75xx.c
> new file mode 100644
> index 0000000000000..0405723eb7932
> --- /dev/null
> +++ b/drivers/net/mdio/mdio-cs75xx.c
> @@ -0,0 +1,126 @@

[ ... ]

> +static int cs75xx_mdio_wait(struct cs75xx_mdio *priv)
> +{
> +	u32 val;
> +	int ret;
> +
> +	ret = readl_poll_timeout(priv->base + PER_MDIO_CTRL, val,
> +				 val & MDIO_CTRL_DONE, 1, CS75XX_MDIO_TIMEOUT_US);
> +	if (!ret)
> +		writel(MDIO_CTRL_DONE, priv->base + PER_MDIO_CTRL);
> +	return ret;
> +}

[Severity: Medium]
Should cs75xx_mdio_wait() use a larger sleep interval than 1 us in
readl_poll_timeout()?

poll_timeout_us() calls usleep_range((__sleep_us >> 2) + 1, __sleep_us), so
passing 1 results in usleep_range(1, 1) with zero slack.  That disables
hrtimer coalescing and arms an exact 1 us hrtimer on every iteration, where
timer and scheduling overhead exceed the delay.

A 64-bit Clause 22 transfer takes at least 25.6 us at 2.5 MHz MDC, so every
MDIO transaction loops through dozens of 1 us hrtimer wakeups (and up to
10,000 on timeout).  Using a sleep interval of at least 10 us (for example,
10 to 50 us) avoids hrtimer thrashing and allows timer coalescing.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-b4-cs7542-mdio-v5-0-c9b9b51bf58d@gmail.com?part=2

  parent reply	other threads:[~2026-12-05  3:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  3:57 [PATCH net-next v5 0/3] Add Cortina Systems CS7542 MDIO controller support Fil Dunsky via B4 Relay
2026-12-04  3:57 ` [PATCH net-next v5 1/3] dt-bindings: net: Add Cortina CS7542 MDIO controller Fil Dunsky via B4 Relay
2026-12-04  3:57 ` [PATCH net-next v5 2/3] net: mdio: Add Cortina CS7542 bus controller Fil Dunsky via B4 Relay
2026-12-04 13:31   ` Andrew Lunn
2026-12-05  3:58   ` sashiko-bot [this message]
2026-12-04  3:57 ` [PATCH net-next v5 3/3] MAINTAINERS: Add Cortina CS7542 MDIO controller entry Fil Dunsky via B4 Relay

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=sashiko-outbox-251027@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=filipp.dunsky@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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