Re: [PATCH net-next 4/5] net: ethernet: adi: adin1110: Add OA TC6 protocol support for ADIN1110
From: Andrew Lunn
Date: Wed Nov 04 2026 - 20:29:16 EST
> > +static int adin1110_set_rx_mode_tc6(struct net_device *dev,
> > + struct netdev_hw_addr_list *uc,
> > + struct netdev_hw_addr_list *mc)
> > +{
> > + struct adin1110_port_priv *port_priv = netdev_priv(dev);
> > + struct adin1110_priv *priv = port_priv->priv;
> > + int ret;
> > +
> > + mutex_lock(&priv->lock);
>
> guard(mutex)(&priv->lock)?
netdev Maintainers have a strong dislike for this sort of guard. Not
in this case, but often it protects too much, since the end of the
function is frequently passed the end of the critical section.
The scoped variant can be used, since that explicitly marks the end of
the critical section.
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
Using device-managed and cleanup.h constructs
Netdev remains skeptical about promises of all “auto-cleanup” APIs,
including even devm_ helpers, historically. They are not the preferred
style of implementation, merely an acceptable one.
Use of guard() is discouraged within any function longer than 20
lines, scoped_guard() is considered more readable. Using normal
lock/unlock is still (weakly) preferred.
Andrew