From: sashiko-bot@kernel.org
To: "Arthur Crepin Leblond" <arthur@marmottus.net>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v9 3/3] w5100: detect carrier state using link status bit and optional interrupt
Date: Sat, 19 Sep 2026 15:14:20 +0000 [thread overview]
Message-ID: <20260919151421.2FE471F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260918-wiznet-link-gpio-v9-3-5536f24d8d6d@marmottus.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] net: w5100: sleep in atomic context in w5100_restart()
--
commit d7738510984843a0b85d7198fe804aebe167d280
Author: Arthur Crepin Leblond <arthur@marmottus.net>
w5100: detect carrier state using link status bit and optional interrupt
This commit introduces carrier state detection for the w5500 Ethernet
controller via the PHY Configuration register. It uses an optional interrupt
wired to the LINKLED pin to handle link status changes, and refactors several
aspects of the driver's initialization and teardown sequences.
> diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
> --- a/drivers/net/ethernet/wiznet/w5100.c
> +++ b/drivers/net/ethernet/wiznet/w5100.c
[ ... ]
> @@ -448,12 +526,25 @@ static void w5100_restart(struct net_device *ndev)
> {
> struct w5100_priv *priv = netdev_priv(ndev);
>
> + if (!netif_running(ndev) || !netif_device_present(ndev))
> + return;
> +
> + disable_irq(priv->irq);
> + if (priv->link_irq > 0)
> + disable_irq(priv->link_irq);
> +
[Severity: Medium]
Is it safe to call disable_irq() here? disable_irq() is a sleepable function,
but w5100_restart() can be called from atomic context when using memory-mapped
I/O.
Looking at w5100_tx_timeout(), which executes in atomic context, the timeout
handler falls back to calling w5100_restart() directly if the device cannot
sleep:
w5100_tx_timeout() {
...
if (priv->ops->may_sleep)
schedule_work(&priv->restart_work);
else
w5100_restart(ndev);
}
While current in-tree drivers might set may_sleep to true, this code path
explicitly exists to support may_sleep == false. Could this introduce a
'scheduling while atomic' panic for non-sleepable devices?
> netif_stop_queue(ndev);
> w5100_hw_reset(priv);
> + enable_irq(priv->irq);
> w5100_hw_start(priv);
> ndev->stats.tx_errors++;
> netif_trans_update(ndev);
> netif_wake_queue(ndev);
> +
> + if (priv->link_irq > 0) {
> + w5500_report_carrier_state(ndev);
> + enable_irq(priv->link_irq);
> + }
[Severity: Medium]
Similarly, w5500_report_carrier_state() attempts to acquire a mutex
(priv->link_lock).
If priv->link_irq > 0 and priv->ops->may_sleep is false, wouldn't taking
this mutex in the w5100_tx_timeout() -> w5100_restart() call chain also
result in sleeping in atomic context?
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260918-wiznet-link-gpio-v9-0-5536f24d8d6d@marmottus.net?part=3
next prev parent reply other threads:[~2026-09-19 15:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 15:13 [PATCH net-next v9 0/3] w5100: restore GPIO-based link detection Arthur Crepin Leblond
2026-09-18 15:13 ` [PATCH net-next v9 1/3] dt-bindings: net: wiznet,w5100: convert to DT schema Arthur Crepin Leblond
2026-09-22 15:43 ` netdev-bot+sashiko
2026-09-23 9:12 ` Arthur Crepin Leblond
2026-09-18 15:13 ` [PATCH net-next v9 2/3] dt-bindings: net: wiznet,w5100: add link status interrupt Arthur Crepin Leblond
2026-09-18 15:13 ` [PATCH net-next v9 3/3] w5100: detect carrier state using link status bit and optional interrupt Arthur Crepin Leblond
2026-09-19 15:14 ` sashiko-bot [this message]
2026-09-21 9:04 ` Arthur Crepin Leblond
2026-09-21 10:42 ` Arthur Crepin Leblond
2026-09-22 15:43 ` netdev-bot+sashiko
2026-09-23 9:36 ` Arthur Crepin Leblond
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=20260919151421.2FE471F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arthur@marmottus.net \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--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