Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3891574rwb; Sat, 3 Dec 2022 13:02:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Z9cZBaCpWzovjchNNUCU745r0UZ/jc3wXLuPGlNZHE2TdKXivJvF9e9xlcG2VIefaNAb2 X-Received: by 2002:a50:fc02:0:b0:46b:7ba0:dace with SMTP id i2-20020a50fc02000000b0046b7ba0dacemr19757917edr.243.1670101377954; Sat, 03 Dec 2022 13:02:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670101377; cv=none; d=google.com; s=arc-20160816; b=R+IAEwzlN1svkgyy838Hv4A8SZpE7pZumEPCZz/Xg7awVdY6ISFb0dBFcKO9Lbm9U1 ixoSX9dITK5Jcf/2B2z+v22r1CkCJo4R/QuX+iRqVslSOOrGIxBMxyYtCOClvWh7qmCj UU1V+h4nUAPdNwcfRjMPRqKZe9mLD+AFaJVHA5Uf0z52P+rmtC6cqt8/NrH4PsOBAJ/9 eKayigwq0X8MapCfKTZlPqy/XacnNJ8XwjQo8e3TdVdLlupJWsIAda7X1AQdfBfJTGS3 sObAwibm9sp7vHlZ5xCAdkEsOEMSXRpp8gpCfaP7t/zMxrGn1KD5reiIyrscDayelkce mgeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nrIUiqu0rhHfNsiWFPaaq3UEuLRQT2XtfSlEcQWCe80=; b=hP09sC0J5O7GpDjdk595/oVKj4mIXARarknPa0t8ysOVzyT/9pYevK5g+35EDwWSPk IDtLfRRSlhP6M1FrjCVP4DTqhFu2cF1r9JF2o5Vr0fiSSpI2o58SyrZpKi/cIHsrogj6 w6+CZPr6P5o1qSoPULKZYInJaZ/mPahyI57umpsqgfOaN5feqhxG3s0MoJfqudlw1UWr UV+8bxMiylpRLYW/hhbEpHmKqSNNZgj2bnTyI7blPD3421eKko9OTL7/NvDXhOfRnblb lMZoZmaY857Z6ZMnHBuCCHLdSB2dLm7TWb+UQWhQy3AYHu0upnUmNYQQxr0ZYCe2ERta KQhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=AofCRjqn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y7-20020a056402358700b0046777becff2si9213203edc.629.2022.12.03.13.02.38; Sat, 03 Dec 2022 13:02:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=AofCRjqn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229800AbiLCUsD (ORCPT + 82 others); Sat, 3 Dec 2022 15:48:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbiLCUsB (ORCPT ); Sat, 3 Dec 2022 15:48:01 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C457564E3; Sat, 3 Dec 2022 12:48:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=nrIUiqu0rhHfNsiWFPaaq3UEuLRQT2XtfSlEcQWCe80=; b=AofCRjqnSYXZ8feR+kEmJkOUC2 MZqTyRCe/KBWz+8IvZVZ6dP9aoc32d9xigxVoFXBUvYAM5W/tqxdMQ/Wg7ysLy9nBa63WByVgYLZn BtjSVsFqoOMwaBUNqIAEf14fT/gtqQn9eua1PyIk//lpbk6Hc0JuppW6HfrnwQMPNGLk=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1p1ZQE-004HrO-Th; Sat, 03 Dec 2022 21:47:42 +0100 Date: Sat, 3 Dec 2022 21:47:42 +0100 From: Andrew Lunn To: "Russell King (Oracle)" Cc: Frank , Peter Geis , Heiner Kallweit , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , 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 Message-ID: References: <20221202073648.3182-1-Frank.Sae@motor-comm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 02, 2022 at 01:34:16PM +0000, Russell King (Oracle) wrote: > 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 was following the ASSERT_RTNL model, but that is used in quite deep and complex call stacks, and it is useful to scatter the macro in lots of places. PHY drivers are however very shallow, so yes, putting them in mdio_bus.c makes a lot of sense. > 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 And PHY driver functions are simpler, there is a lot less inlining going on, so the function name is probably all you need to know to find where you messed up the locking. So i agree, they can be removed. Andrew