From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5449AC433B4 for ; Wed, 5 May 2021 12:06:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2AAFA613BF for ; Wed, 5 May 2021 12:06:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232796AbhEEMHs (ORCPT ); Wed, 5 May 2021 08:07:48 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:54294 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232013AbhEEMHQ (ORCPT ); Wed, 5 May 2021 08:07:16 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1leGI6-002fRJ-OJ; Wed, 05 May 2021 14:06:10 +0200 Date: Wed, 5 May 2021 14:06:10 +0200 From: Andrew Lunn To: Ansuel Smith Cc: Florian Fainelli , Heiner Kallweit , Russell King , "David S. Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [RFC PATCH net-next v3 20/20] net: phy: add qca8k driver for qca8k switch internal PHY Message-ID: References: <20210504222915.17206-1-ansuelsmth@gmail.com> <20210504222915.17206-20-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 05, 2021 at 03:17:20AM +0200, Ansuel Smith wrote: > On Wed, May 05, 2021 at 03:11:36AM +0200, Andrew Lunn wrote: > > > +/* QCA specific MII registers access function */ > > > +static void qca8k_phy_dbg_write(struct mii_bus *bus, int phy_addr, u16 dbg_addr, u16 dbg_data) > > > +{ > > > + mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); > > > + bus->write(bus, phy_addr, MII_ATH_DBG_ADDR, dbg_addr); > > > + bus->write(bus, phy_addr, MII_ATH_DBG_DATA, dbg_data); > > > + mutex_unlock(&bus->mdio_lock); > > > +} > > > > What are you locking against here? > > > > Andrew > > Added the locking if in the future it will be used outside the > config_init function but since it's used only there, yes, I can drop the > useless lock. The PHY core will take the phydev->lock whenever it calls the PHY driver functions. The only exception to this is suspend/resume. So long as you only access the devices own addresses on the MDIO bus, you don't need any additional locks. Andrew