Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: amadeus@jmu.edu.cn
Cc: Frank.Sae@motor-comm.com, andrew@lunn.ch, pabeni@redhat.com,
	kuba@kernel.org, edumazet@kernel.org, davem@davemloft.net,
	hkallweit1@gmail.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH v2 2/2] net: phy: motorcomm: add missing trigger link for YT8521
Date: Tue, 24 Nov 2026 10:39:16 +0000	[thread overview]
Message-ID: <179551675643.3135.11872464978293733694@kernel.org> (raw)
In-Reply-To: <20261120100001.1568757-2-amadeus@jmu.edu.cn>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] Since this patch, yt8521_led_hw_control_get()
  (drivers/net/phy/motorcomm.c, lines 1912-1924) reports…
- [Low] The commit message describes this as a fix for missing behaviour:
  TRIGGER_NETDEV_LINK is accepted by yt8521_led_hw_control_set() but was…

--

net: phy: motorcomm: add missing trigger link for YT8521

This patch makes yt8521_led_hw_control_get() report TRIGGER_NETDEV_LINK
when the 10, 100 and 1000 link-on bits are all set in the LED config
register. yt8521_led_hw_control_set() already accepts that rule.

> net: phy: motorcomm: add missing trigger link for YT8521
>
> TRIGGER_NETDEV_LINK is available in led_hw_control_set,
> but missing in led_hw_control_get. Add it.

[Severity: Low]
Should this have a Fixes: tag? The commit message describes this as adding
missing behaviour. The getter was added by commit 355b82c54c122e ("net:
phy: motorcomm: Add support for PHY LEDs on YT8521").

The subject only mentions YT8521. The PHY_ID_YT8531 phy_driver entry in
drivers/net/phy/motorcomm.c uses the same getter:

    .led_hw_control_get = yt8521_led_hw_control_get,

so YT8531 behaviour changes too. Would it be worth mentioning that?

If this gets a Fixes: tag and goes to stable, it will also bring along the
trigger state problem described below.

> diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
> index 5a0cd4d7d6336..4552eee872a8c 100644
> --- a/drivers/net/phy/motorcomm.c
> +++ b/drivers/net/phy/motorcomm.c
> @@ -1918,6 +1918,11 @@ static int yt8521_led_hw_control_get(struct phy_device *phydev, u8 index,
>  	if (val & YT8521_LED_10_ON_EN)
>  		__set_bit(TRIGGER_NETDEV_LINK_10, rules);
>  
> +	if ((val & YT8521_LED_10_ON_EN) &&
> +	    (val & YT8521_LED_100_ON_EN) &&
> +	    (val & YT8521_LED_1000_ON_EN))
> +		__set_bit(TRIGGER_NETDEV_LINK, rules);

[Severity: Medium]
LINK_10, LINK_100 and LINK_1000 are already set just above this. Doesn't
yt8521_led_hw_control_get() now return LINK|LINK_10|LINK_100|LINK_1000?
Can the netdev trigger handle that combination?

netdev_trig_activate() copies the result without checking it:

drivers/leds/trigger/ledtrig-netdev.c:netdev_trig_activate() {
    ...
			rc = led_cdev->hw_control_get(led_cdev, &mode);
			if (!rc)
				trigger_data->mode = mode;
    ...
}

However, netdev_led_attr_store() rejects LINK combined with any LINK_xx
bit:

drivers/leds/trigger/ledtrig-netdev.c:netdev_led_attr_store() {
    ...
	if (test_bit(TRIGGER_NETDEV_LINK, &mode) &&
	    (test_bit(TRIGGER_NETDEV_LINK_10, &mode) ||
	     test_bit(TRIGGER_NETDEV_LINK_100, &mode) ||
	     test_bit(TRIGGER_NETDEV_LINK_1000, &mode) ||
	     ...
		return -EINVAL;
    ...
}

The register can have all three speed bits set in three ways:

- left that way by the bootloader
- as the hardware default
- written by yt8521_led_hw_control_set(), which sets all three bits for
  either a LINK request or a LINK_10|LINK_100|LINK_1000 request

Suppose the netdev trigger is activated on a YT8521 or YT8531 LED in that
state. Any later sysfs write that leaves LINK set then fails with -EINVAL
until link=0 is written first. Examples are writing 1 to tx, rx,
full_duplex or half_duplex, or writing 0 to link_10.

Before this patch the activated mode was LINK_10|LINK_100|LINK_1000, and
those writes worked.

realtek_main.c and air_an8801.c use the same pattern. It still breaks the
trigger's rule that LINK and LINK_xx are mutually exclusive.

Would it be better to report only LINK here and leave out the speed bits?
Or should ledtrig-netdev normalise or accept this combination?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120100001.1568757-1-amadeus%40jmu.edu.cn

  reply	other threads:[~2026-11-24 10:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 10:00 [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set for YT8521 Chukun Pan
2026-11-20 10:00 ` [PATCH v2 2/2] net: phy: motorcomm: add missing trigger link " Chukun Pan
2026-11-24 10:39   ` netdev-bot+sashiko [this message]
2026-11-21 16:57 ` [PATCH v2 1/2] net: phy: motorcomm: add led_brightness_set " Andrew Lunn
2026-11-24  6:50   ` Chukun Pan
2026-11-24 10:39 ` netdev-bot+sashiko

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=179551675643.3135.11872464978293733694@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=Frank.Sae@motor-comm.com \
    --cc=amadeus@jmu.edu.cn \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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