🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25174

Re: [PATCH net-next v3 2/2] net: phy: motorcomm: add missing trigger link for YT8521

#25174
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 10:58
141 lines
12550 bytes
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
Technical Details
Message-ID: <179612269042.3146.16320045925624198098@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374952-linux-kernel-netdev=dewy.ru
References: <20261130100001.3346131-2-amadeus@jmu.edu.cn>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374952-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179612269042.3146.16320045925624198098@kernel.org>
References: <20261130100001.3346131-2-amadeus@jmu.edu.cn>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1690753"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:XAGdpXft4Oyjea7giXvxt/z72E8= sha256:qXNUqsuFuhNMdtTk8Wxpy6mMyViscCXByv7YKAzA9jU=
	sha1:lMcov8IUIsSSKjWG0EcJGOpu1Sk= sha256:DUnN3wr+taPGY5dbpJCstsOIfXnTjgl57Vkp8+rO0U8=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 4A18E117339; Tue,  1 Dec 2026 13:58:37 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 09d1xwyNycNf;
	Tue,  1 Dec 2026 13:58:33 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374952-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 6423E117335; Tue,  1 Dec 2026 13:58:23 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id B059E26E69; Tue,  1 Dec 2026 10:58:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796122697;
	b=NRKTHfw1GUElm/IGiVa1EFOhcBToBTJOV14Gd2TDZSXtaGS/MplFOUq2iw56pglenE5p
	 00t7RARxpUmDs2cX72LEhVD9pu+TEBBCLpMHJ/3BkhBDQxeoyR04aeaPlPeGZ2QdK8W8E
	 yrVyCfI4fBsUVXxI8qYESdwOjZS4pcGCJdj/RK3TfITTOTNybUGcJO2AfXIVB1aSjJQ+z
	 UH3Z3kLw92nkSCDAltf9NI2lsqlV3lxEi3hSMNMT0mxKp0krCJGhfOQU49n6+FTweQg6U
	 gpxaMtUgj33Isv9RKQN4r63Cf7FoxWne6LiCod2dCj2cbhmtpvN6m4tH3MoyRxAW0Dw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796122697;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=YnNnxMeroWKF/MR8thhUJBIBxfAK7o5u4Na2UXosyWI=;
	b=02vIvsvjoeo+WFuxg6T3ZKeinTZtHQ7j9neLuDN6/zbV5nrZ8ywnUUuNdEkcFK8K6AoE
	 VwHB9jc1cOvP2K4ai6DemILBcV8tXpPWMUTcgRxAjgeY0N08MO3L8PlP5cygPHWeKYb12
	 2DUU2umQ2JrqypC6+TJ7y/AKf8Ai7Hp6cSG/9KxhxF4uC6XPOijnfeRUVsOssrIK9aE+G
	 ishRIURUWTxavFOVmPau4pwGfzhHqIdnG7Vj7yCjIJccbrKbxt1Ae1sC+MfwbYfS/sutc
	 BhAJEYmokuUrSP1RkX1HrIQub+TkmcZE/l6k0YrUJWU0YrB5cYeIzVwPnhpzKRRTyVA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="FB1D+3/6";
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id B092B606A33F;
	Tue,  1 Dec 2026 10:58:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FB1D+3/6
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796122691;
	b=rcI+FvDovP4HgF61S7KeKvMEVn4PPpD7zHRQNtWm84Myn8GTfiwhPPwQi8vm/6oq7nHN
	 SHtf6Gmni5anFex6Gvw0HnDh1C6Ess+Vrmm64Wc5NGxqu49Hm9YdUU8Rbla2+IPSyY0cn
	 SbZAy7Hp7GiC3CazQgVMKrzSAF+1DSfkF8d30o46+t0B0H9vyMOD5r6ILAZ+eRmKg/xes
	 vQCs+nhiW3A/K+sCpU/Ih+JAdDwm8j1zCZFQ/O+4z/t1trJnldevoQSn5szWm3E9uXEEQ
	 b7jpGYKA7gKNocNquplFg+CoRtM0G3caPeqfq+Z5gJgy3VR40TbG/hNuVMU+k49bfBg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796122691;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=YnNnxMeroWKF/MR8thhUJBIBxfAK7o5u4Na2UXosyWI=;
	b=Y2LZrn/6JSIh5YJBJCIv0vE9TJfzrSS0rFM7hQgvNQeQMdf88Kyw+/UwFzPAmH/xiQOW
	 /clrS01tTVdOIFUdeKNE/np/tSrNz+E9xzfYkToVVLIab0CVAaieSl9Co8AoJsVxDRpIn
	 FHV4QH0QRHP8r6R/BIJnWRoPmklcGVfzIHHLbiMiRAAk1A861ZU16vmwNR/vmIhhByoPz
	 7VT7y5ghND179finrThUS9p9c+N0OO31Fi97boBuY89UXYgO42wxMfhzNxBXbn8+JWFoD
	 SASjR6olqkS9LNKgVcoovkwIpAtEynH7/3lcCmm+/KyqGGaLXfC1DmzWwNXNXMzGL6w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="FB1D+3/6";
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDEF2606A334;
	Tue,  1 Dec 2026 10:58:11 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D91FF1F00898;
	Tue,  1 Dec 2026 10:58:10 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796122691;
	bh=YnNnxMeroWKF/MR8thhUJBIBxfAK7o5u4Na2UXosyWI=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=FB1D+3/6UdPmTHEKNmIz+/Iko2Zz2DUfZXR/oqbLwIP0g4UUG6SjD1XTYUOiLxHna
	 TETuuoYhbpU+K3rmCntCOqiznMwMkLNyJSomnGOZ/bHi9rAWU3RenCIu2wDz4jzRZw
	 qlLtQRIXxHzfc5GMYlWxXIIBGLT0vnDD5loTPHH6r9Pl3GGDkTLP6AQ2zWX+Gp7xpM
	 9TftsZnfYkwG/cU74AdDs2cy8XLuSbi5bj7IecPy1tQ4Hp/YIrq/hRtqxmYQodlBMy
	 vs1N6gzo5hiFdRpTXnSMl38h8OPU/oQeRCvh1vBGHmyqj6lQxcTCIjSwHTBU1OnzYB
	 KEsGuBo/vx+Ag==
X-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
X-In-Reply-To: <20261130100001.3346131-2-amadeus@jmu.edu.cn>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list