mirror of https://lore.kernel.org/lkml/
 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 net-next v3 2/2] net: phy: motorcomm: add missing trigger link for YT8521
Date: Tue, 01 Dec 2026 10:58:10 +0000	[thread overview]
Message-ID: <179612269042.3146.16320045925624198098@kernel.org> (raw)
In-Reply-To: <20261130100001.3346131-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] After this patch, yt8521_led_hw_control_get()
  (drivers/net/phy/motorcomm.c) still sets TRIGGER_NETDEV_LINK_10,…
- [Low] The commit says it adds a 'missing' TRIGGER_NETDEV_LINK readback
  to yt8521_led_hw_control_get(), i.e. it fixes an omission.

--

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

This commit makes yt8521_led_hw_control_get() report TRIGGER_NETDEV_LINK
when the 10, 100 and 1000 ON_EN bits are all set in the LED config
register. This mirrors what yt8521_led_hw_control_set() does for
TRIGGER_NETDEV_LINK.

> 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]
This reads as a fix for an omission, but there is no Fixes: tag. Both
yt8521_led_hw_control_get() and the TRIGGER_NETDEV_LINK handling in
yt8521_led_hw_control_set() came from this commit:

Fixes: 355b82c54c12 ("net: phy: motorcomm: Add support for PHY LEDs on YT8521")

Should that tag be added?

The subject says "for YT8521", but the YT8531 phy_driver entry uses the
same callback:

	.led_hw_control_get = yt8521_led_hw_control_get,

So YT8531 behaviour changes as well.

Adding a Fixes: tag would also mark the LINK plus LINK_xxx issue below
for stable backport. It may be worth resolving that issue first.

> diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
> index e0c6477a53e44..27aee44a420fb 100644
> --- a/drivers/net/phy/motorcomm.c
> +++ b/drivers/net/phy/motorcomm.c
> @@ -1919,6 +1919,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]
The code just above still sets TRIGGER_NETDEV_LINK_10, LINK_100 and
LINK_1000 for each enabled speed bit. When all three bits are set, the
returned rules become LINK | LINK_10 | LINK_100 | LINK_1000.

Does ledtrig-netdev accept that combination?

yt8521_led_hw_control_set() writes exactly this register state when link
is selected:

drivers/net/phy/motorcomm.c:yt8521_led_hw_control_set() {
    ...
	if (test_bit(TRIGGER_NETDEV_LINK, &rules)) {
		val |= YT8521_LED_10_ON_EN;
		val |= YT8521_LED_100_ON_EN;
		val |= YT8521_LED_1000_ON_EN;
	}
    ...
}

A bootloader or hardware default with all three bits set would read
back the same way.

netdev_trig_activate() copies the hw_control_get() result straight into
trigger_data->mode:

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

netdev_led_attr_store() then starts from trigger_data->mode, flips one
bit, and rejects the result:

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;
    ...
}

Once the netdev trigger is active on such an LED, wouldn't these writes
all fail with -EINVAL?

  echo 1 > tx
  echo 0 > rx
  echo 0 > full_duplex
  echo 0 > link_100
  echo 1 > link

Only "echo 0 > link" would succeed. Sysfs would also show link=1 together
with link_10, link_100 and link_1000 set to 1. The store path itself
never allows that state.

Before this patch, the same register value read back as
LINK_10 | LINK_100 | LINK_1000 without LINK. That passes the check, and
attribute writes worked. Both YT8521 and YT8531 are affected, since they
share this callback.

realtek_main.c (rtl8211f, rtl8211e, rtl822x) and air_an8801.c use the
same pattern, but this patch adds it to the motorcomm driver.

Could the code report only TRIGGER_NETDEV_LINK, and skip the
LINK_10/100/1000 bits, when all three speed bits are set? The other
option would be to make ledtrig-netdev normalise or accept this
combination.

[ ... ]

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

  reply	other threads:[~2026-12-01 10:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 10:00 [PATCH net-next v3 1/2] net: phy: motorcomm: add led_brightness_set " Chukun Pan
2026-11-30 10:00 ` [PATCH net-next v3 2/2] net: phy: motorcomm: add missing trigger link " Chukun Pan
2026-12-01 10:58   ` netdev-bot+sashiko [this message]
2026-11-30 13:17 ` [PATCH net-next v3 1/2] net: phy: motorcomm: add led_brightness_set " Andrew Lunn
2026-12-01 10:58 ` 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=179612269042.3146.16320045925624198098@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

all inboxes | Powered by JetHome®