๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24844

Re: [PATCH net-next v23 05/15] net: phylink: make phylink_validate state locked

#24844
From: netdev-bot+sashiko
Date: Mon, 30 Nov 2026 23:47
79 lines
10983 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] This patch removes the last in-tree caller of the exported
  phy_get_rate_matching(), but leaves the export in place.

--

net: phylink: make phylink_validate state locked

This commit makes the phylink validation helpers run under
pl->state_mutex. It adds __phylink_validate(), __phylink_validate_mask()
and __phylink_validate_phy() for callers that already hold the mutex.
It also adds an internal __phy_get_rate_matching() helper in
phy-internal.h for callers that already hold phydev->lock.

> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 079c53516f424..a6d6a7c1a96dd 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c

[ ... ]

> @@ -146,13 +147,11 @@ EXPORT_SYMBOL(phy_print_status);
>  int phy_get_rate_matching(struct phy_device *phydev,
>  			  phy_interface_t iface)
>  {
> -	int ret = RATE_MATCH_NONE;
> +	int ret;
>  
> -	if (phydev->drv->get_rate_matching) {
> -		mutex_lock(&phydev->lock);
> -		ret = phydev->drv->get_rate_matching(phydev, iface);
> -		mutex_unlock(&phydev->lock);
> -	}
> +	mutex_lock(&phydev->lock);
> +	ret = __phy_get_rate_matching(phydev, iface);
> +	mutex_unlock(&phydev->lock);
>  
>  	return ret;
>  }

[Severity: Low]
Does phy_get_rate_matching() still have any in-tree users after this
change?

phylink was its only caller. This patch moves both phylink call sites
to the new internal helper:

  phylink_validate_one():
      tmp_state.rate_matching = __phy_get_rate_matching(phy, interface);

  __phylink_validate_phy():
      state->rate_matching = __phy_get_rate_matching(phy, state->interface);

After this patch, grepping for phy_get_rate_matching finds only these:

  - the definition and kernel-doc in drivers/net/phy/phy.c
  - EXPORT_SYMBOL_GPL(phy_get_rate_matching)
  - the prototype in include/linux/phy.h
  - the two __phy_get_rate_matching() calls in phylink.c

This stays the same at the end of the series.

The same patch also changes the exported function's locking. It now
always takes phydev->lock, where before it only took the lock when
phydev->drv->get_rate_matching was set. The commit message does not
mention that the export is left with no callers.

Should phy_get_rate_matching(), its export and its prototype be removed
in this patch? If it is being kept on purpose, could the commit message
say why?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129230558.612526-1-ansuelsmth%40gmail.com
Technical Details
Message-ID: <179608245900.3146.7642205996688289734@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374531-linux-kernel-netdev=dewy.ru
References: <20261129230558.612526-6-ansuelsmth@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374531-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v23 05/15] net: phylink: make phylink_validate
 state locked
Date: Mon, 30 Nov 2026 23:47:39 +0000
Organization: Usenet Network
Message-ID: <179608245900.3146.7642205996688289734@kernel.org>
References: <20261129230558.612526-6-ansuelsmth@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1568441"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:GLr9TkRymzhAFXry54xwHS/Wkqg= sha256:MageYRuP1WplbYsxlAS63amdZrrxl1UhnqaGIQDZZLE=
	sha1:xVkwi9hWV7IlvMEXpKb2Bn+hifI= sha256:YmSF2S71g/ZEEgCiiELyfvS0SLRTmn5lmeRKebknRDg=
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 73A53126015; Tue,  1 Dec 2026 02:47:58 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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 W5n_4r-XJh4j;
	Tue,  1 Dec 2026 02:47:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-374531-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id DD7BF126017; Tue,  1 Dec 2026 02:47:46 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 65BFA23DA8; Mon, 30 Nov 2026 23:47:44 +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=1796082462;
	b=JPUpX0S/kR2xs03x1fjhfLYrH1+QsqvtqtqKzRYiTEsRRWCirW/Q2FAoqqypWtf2Z+gc
	 iPo8pwnmhuMPQ/Zv9K69InxLNqGiZl29CBOveU3W5WlkzI7BDTzdS9vD4721piTIFzZLC
	 B+vfrNJjSMLAotB8DMuT7mjd98cVACudQXJah15DX95IpFBdigQo3maOV6eRaEuriJ5RF
	 lMCRaJrPQ1LsBX3raH+KHQfhDmvQ0hUO9C46BB8QGNJBKsFSjnwiP37T+onpdeCYrNbzc
	 Lwp6O5T+YHlcOEjPJXyTJ/kyW8aOuePLJwtTLdhRxSeEARasNvI5AvtYwflRJL0RsOQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796082462;
	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=9dbP14HBKDMReAZmTrF6eKOw0Xbv9NZ+wff2J9b/9pM=;
	b=FubNeaH204RB/RrurIIIZINguKHfa/Y/QIcQzZ5Vsq6HBCNPZs/mmt4Gp29Lw7bkNTGo
	 81Hn3qk/wt9UiU8Pcs4f+HQqIzkhr4kOaAmeMFOcr7ZJLk/y6rc26wpO5nvX5Cv7b1PLq
	 UV/g1688+56HHK5GhDrpMlXApODMe5pf55xlgPcsq/TxQEgzIKNwsSkX3bDJeYkT4aoaw
	 H26gStmh4jqagMPi3Dtl3O5bA+ns0g05GKRhsbtqGelK1xX1FY1L4g6ycosh5t2Y59v1E
	 9oEHTcU9OIRSjQCRmL0jgzNMBWBHpupYnAOzoJgqAWXcknOoUbpKckTDtsJMhnbli+g==
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=GDzuo9Ms;
	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 6A4F6606A33A;
	Mon, 30 Nov 2026 23:47:42 +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=GDzuo9Ms
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=1796082461;
	b=s1JoCP7T5oZHLYwhBnAgSgJBUZaq7SVJkY6HpvbmAo2LfDbzVZ8KnsGtyEs3q0SKR+Ae
	 uT07ZjETj6Za0C8Sr9Lag8vTsY9qmR3BpAzuqtK296L7tUr0/HzPQj20Sc51nd28QR1qT
	 ovExgfST9CzHDUMbjPTybYC2gIwDk8ITk0aBD3p+ajmHt6leB020QYKU2ipwU5BhxP/le
	 1/EL5n1PxFKU6ZUx0RpK8+efwdBN4QWO7EMUxtjn6MwovzYo1XE7+dWz1PXHcuoQkuIV4
	 1N4qYXJcR5lZ8TugtqmKexTSVf6oQ0uZmidvzVIJvnfgA7O+mlaUhqWcbhH1iPQdCJw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796082461;
	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=9dbP14HBKDMReAZmTrF6eKOw0Xbv9NZ+wff2J9b/9pM=;
	b=WT/eSWTxu7xe4jfq/PvadRT4eX20mert2K8Ez1dDnDi+B3bK5JmYD6y862zsOcJGjOXJ
	 /OwnF7yd5ibf4l7mAVWqeTcqIXHFd1JsQ/5d3nApoLgmpMEG337Q1DIZhty5/3JKBRoIz
	 nnWbpb48evkZ5wERkTlLa9iMxgEbIxsY4c2tLag6qqYTo4me+BTVNfdMx8QlNhVWnfomN
	 Lnc4JRtwaQAPCWygeackLOfd+xLl3WfXvmfs0O6vwcvQvOQ/+WzCy0aO/U3watqHkbvUS
	 ROSt705sLMjdZZm6DTISsJlrRuzd8mkQaz2E9jU0TSVdmWt70XLigYikGekvkywhW5w==
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=GDzuo9Ms;
	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 8C3F3606A32A;
	Mon, 30 Nov 2026 23:47:41 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74E421F00898;
	Mon, 30 Nov 2026 23:47:39 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796082461;
	bh=9dbP14HBKDMReAZmTrF6eKOw0Xbv9NZ+wff2J9b/9pM=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=GDzuo9MsMeiUwwxdBn/sInZ3CCJlXexdQy2zC+iQFc8Mgrdz5GByqgX9aahMdp3tl
	 evvQWy9Pbq7MSpPxn83poWOkMZ2uFOboFdICujBFP97fy9dQjFk7Z2QW3vIhBZwat+
	 pxgAhU3yaURzhqW4Se/7V+WtkSTdINfeA144vK2JZFOSCpi7becuiflFtGJ2BcntoH
	 lSPTnzl5ygXrfbqH02ss9nYNQnbpyyegWjk/L6KqB5s7bc4rDq6jcScjQkLcDrg+Ai
	 IdRKMaA9GdG7ikze06lAM1vF6IkEHXndyFwGk/vVa2LBhfAbjjgqT+3erY9zNKrduZ
	 C3wdHuY3Sr50A==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
 conor+dt@kernel.org, willemb@google.com, horms@kernel.org, corbet@lwn.net,
 skhan@linuxfoundation.org, rdunlap@infradead.org, lorenzo@kernel.org,
 hkallweit1@gmail.com, linux@armlinux.org.uk, maxime.chevallier@bootlin.com,
 p.zabel@pengutronix.de, nathan@kernel.org, ndesaulniers@google.com,
 morbo@google.com, justinstitt@google.com, rmk+kernel@armlinux.org.uk,
 netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
 linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
 linux-mediatek@lists.infradead.org, llvm@lists.linux.dev,
 zhengping.zhang@airoha.com
X-In-Reply-To: <20261129230558.612526-6-ansuelsmth@gmail.com>
X-sashiko-severity: Low
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