From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH net-next] net: phy: switch to lockdep_assert_held in phylib Date: Mon, 12 Nov 2018 18:44:16 +0100 Message-ID: <20181112174416.GF5075@lunn.ch> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Florian Fainelli , David Miller , "netdev@vger.kernel.org" To: Heiner Kallweit Return-path: Received: from vps0.lunn.ch ([185.16.172.187]:59926 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729460AbeKMDie (ORCPT ); Mon, 12 Nov 2018 22:38:34 -0500 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Sun, Nov 11, 2018 at 10:33:08PM +0100, Heiner Kallweit wrote: > diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c > index 2e59a8419..5cb06f021 100644 > --- a/drivers/net/phy/mdio_bus.c > +++ b/drivers/net/phy/mdio_bus.c > @@ -541,7 +541,7 @@ int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum) > { > int retval; > > - WARN_ON_ONCE(!mutex_is_locked(&bus->mdio_lock)); > + lockdep_assert_held_once(&bus->mdio_lock); Hi Heiner I don't think there is a clear right/wrong here. This is not hot path code. The cost for checking the lock is held is very small compared to the actual MDIO transaction. So i don't think we really need to optimise this. I do sometimes build with lockdep on, but not always. So it is good to know when locking is broken on normal builds. Florian, what do you think? Andrew