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=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 8DF6DFA3728 for ; Wed, 16 Oct 2019 15:36:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5E73B207FF for ; Wed, 16 Oct 2019 15:36:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="KGODKyti" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405088AbfJPPgx (ORCPT ); Wed, 16 Oct 2019 11:36:53 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:48680 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726707AbfJPPgx (ORCPT ); Wed, 16 Oct 2019 11:36:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=+5f6dY8evhyxODaTKehL/4N9iRbwuC90F8UXeraO9vA=; b=KGODKytivjW/MSdVeEUIQ+rVkz 3ilT5scwlhtrAdRHOF5qItaKrEvpjoegAiPCMPGunYirlMsdopw/WifZ62cYSu1bXEWg3cGchJyqv I2zBjIlQlLU5Ufceb9tXkmUxGwTa9MBw9eRtzdp5iw7V2/FWc8ui2HX70BCRCMcncdK8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.92.2) (envelope-from ) id 1iKlLy-0008Fe-Gc; Wed, 16 Oct 2019 17:36:46 +0200 Date: Wed, 16 Oct 2019 17:36:46 +0200 From: Andrew Lunn To: Russell King - ARM Linux admin Cc: Heiner Kallweit , Woojung Huh , Microchip Linux Driver Support , Florian Fainelli , Daniel Wagner , netdev@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, Stefan Wahren , linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org Subject: Re: lan78xx and phy_state_machine Message-ID: <20191016153646.GG17013@lunn.ch> References: <20191014140604.iddhmg5ckqhzlbkw@beryllium.lan> <20191014163004.GP25745@shell.armlinux.org.uk> <20191014192529.z7c5x6hzixxeplvw@beryllium.lan> <25cfc92d-f72b-d195-71b1-f5f238c7988d@gmx.net> <20191014221211.GR25745@shell.armlinux.org.uk> <524267e6-df8e-d884-aeef-1ed8700e4e58@gmail.com> <20191015220925.GW25745@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191015220925.GW25745@shell.armlinux.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > > - lan78xx_phy_init() (incl. the call to phy_connect_direct()) is called > > after register_netdev(). This may cause races. > > That isn't a problem. We have lots of network device drivers that do > this - in their open() function. Hi Russell Actually, here is it. lan7801_phy_init() finds the PHY device and connects it to the MAC. lan78xx_open() calls phy_start(), with the assumption lan7801_phy_init() has been called. But the stack trace just provided shows this assumption is wrong. As soon a register_netdev() is called, the kernel auto configuration is kicking in and opening the device. lan78xx_phy_init() needs to happen before register_netdev(), or inside lan78xx_open(). Andrew