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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 A1CA6C4338F for ; Mon, 26 Jul 2021 20:50:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7ADC660F5D for ; Mon, 26 Jul 2021 20:50:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232849AbhGZUJh (ORCPT ); Mon, 26 Jul 2021 16:09:37 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:46244 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232087AbhGZUJg (ORCPT ); Mon, 26 Jul 2021 16:09:36 -0400 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=rtibfudRO0hjjDrmT4vuOpKTLXLMMclz0vvJ18yEoQE=; b=b0ibxKJnxw5CkMwmWpgCaoDQS0 orDlmxifEw7f3A5GlYybKrxoj7r7IWa0FS/vXZ/FNF7mTK8vK5AWl3kUDJKKoNo8o1ot+OSmFrzdm rivPyloXX0fvpavpRUxFnDHPUleOIATfbUnKIuND/u23XvzLApbt+izYXgCIHb97Pxf4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1m87Xu-00Eujn-If; Mon, 26 Jul 2021 22:49:54 +0200 Date: Mon, 26 Jul 2021 22:49:54 +0200 From: Andrew Lunn To: Gerhard Engleder Cc: davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org, michal.simek@xilinx.com, netdev@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH net-next 4/5] tsnep: Add TSN endpoint Ethernet MAC driver Message-ID: References: <20210726194603.14671-1-gerhard@engleder-embedded.com> <20210726194603.14671-5-gerhard@engleder-embedded.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210726194603.14671-5-gerhard@engleder-embedded.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Gerhard > +int tsnep_read_md(struct tsnep_adapter *adapter, int phy, int reg, u16 *data) > +{ > + u32 md; > + int retval = 0; > + > + if (mutex_lock_interruptible(&adapter->md_lock) != 0) > + return -ERESTARTSYS; This probably means you have something wrong with your architecture. The core mdio layer will serialise access to the mdio bus. So you should not need such locks. > +int tsnep_enable_loopback(struct tsnep_adapter *adapter, int speed) > +{ > + int phy_address = adapter->phydev->mdio.addr; > + u16 val; > + int retval; > + > + adapter->loopback = true; > + adapter->loopback_speed = speed; > + > + retval = tsnep_read_md(adapter, phy_address, MII_BMCR, &val); And this might be why you have these locks? A MAC driver should never directly touch the PHY hardware. Use the phy_loopback(phydev) call. Andrew