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/2026…%40gmail.com