All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Frank <Frank.Sae@motor-comm.com>,
	Peter Geis <pgwipeout@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	yinghong.zhang@motor-comm.com, fei.zhang@motor-comm.com,
	hua.sun@motor-comm.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2] net: phy: Add driver for Motorcomm yt8531 gigabit ethernet phy
Date: Fri, 2 Dec 2022 13:34:16 +0000	[thread overview]
Message-ID: <Y4n+2Ehvp6SInxUw@shell.armlinux.org.uk> (raw)
In-Reply-To: <Y4n9T+KGj/hX3C0e@lunn.ch>

On Fri, Dec 02, 2022 at 02:27:43PM +0100, Andrew Lunn wrote:
> > +static bool mdio_is_locked(struct phy_device *phydev)
> > +{
> > +	return mutex_is_locked(&phydev->mdio.bus->mdio_lock);
> > +}
> > +
> > +#define ASSERT_MDIO(phydev) \
> > +	WARN_ONCE(!mdio_is_locked(phydev), \
> > +		  "MDIO: assertion failed at %s (%d)\n", __FILE__,  __LINE__)
> > +
> 
> Hi Frank
> 
> You are not the only one who gets locking wrong. This could be used in
> other drivers. Please add it to include/linux/phy.h,

That placement doesn't make much sense.

As I already said, we have lockdep checks in drivers/net/phy/mdio_bus.c,
and if we want to increase their effectiveness, then that's the place
that it should be done.

I don't see any point in using __FILE__ and __LINE__ in the above
macro either. Firstly, WARN_ONCE() already includes the file and line,
and secondly, the backtrace is more useful than the file and line where
the assertion occurs especially if it's placed in mdio_bus.c

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2022-12-02 13:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02  7:36 [PATCH net-next v2] net: phy: Add driver for Motorcomm yt8531 gigabit ethernet phy Frank
2022-12-02 13:27 ` Andrew Lunn
2022-12-02 13:34   ` Russell King (Oracle) [this message]
2022-12-03 20:47     ` Andrew Lunn
2022-12-14  7:37 Frank
2022-12-14 11:07 Frank
2022-12-21  7:53 Frank

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=Y4n+2Ehvp6SInxUw@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=Frank.Sae@motor-comm.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fei.zhang@motor-comm.com \
    --cc=hkallweit1@gmail.com \
    --cc=hua.sun@motor-comm.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pgwipeout@gmail.com \
    --cc=yinghong.zhang@motor-comm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.