Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1794063pxb; Wed, 20 Oct 2021 11:52:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMnEWGHBt/fN0NnwqmMdz1bI7QhWR504QunJQEvduQn1DiscXdi4HSa7BWtnW4CbXi6FJO X-Received: by 2002:a50:e004:: with SMTP id e4mr976142edl.246.1634755974210; Wed, 20 Oct 2021 11:52:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634755974; cv=none; d=google.com; s=arc-20160816; b=Ob9ruW0rje2Cw8Ufae408zWd6zxowNycWeFV04zBStuxdSdY1SUJOgS14CVOT9uFSa AImJ3t3GrGk9/gtZLAGdUokmx10cROVscCLaQmFSfto3rfv/i+nGNJlzQn6HvA3bQvFT sU6lzsI7E+2f9ABCUycOKlyMAFL0oSZ2jLvvOBfRkXkAms6+n0vEry2Xa59mvHszj1TS wLbICXG+HLbZ6cm/ILrBvewncovcHSNJeUdNoKbQwCt+ztBv+NPXW53PSv7nLhyXEkRq aeVkXgQwx+nEI+0PkodbyRQFmg+haQ+6Rh06sOvJs+G0VemOPGTIx4DZhiUyAYZPFBNS imnw== 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=F34CO4kJ2wlEtjVzrikO0cx1FdgTWcUmymX9zm/E3dc=; b=WsKhgUnyXLjpBdAaft+0sMWxtXAuQuorIfGOco4w397odQMVvq3xZkXJ1zdiUrM6EJ SwWsGC+/5KGH693DuSxLmb2uN1swXBdSuFlJ+UPLPpI6GMO1N9ocefGu+/9N5yF79l8E AsHIU60eCfXudeKtRCX39GURsUPEvROj/AROHRYN3W13bDRXaGugvwZzvrqdqZIZ5wJG +JJilgBTM8hPoAYznj1gWg5lMuz+gn8LINpQ5jMjBf5yKLCvxpdxMO4op1N7scTfth4m kIHlXa9yMJnGtTx/yFpAav0j+WstLOAFGGyl20/0SiM2hjCgaaQP3LyMXdQ7J38BpM6I fpdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=5ngATRZb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w7si5489398edd.351.2021.10.20.11.52.30; Wed, 20 Oct 2021 11:52:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=5ngATRZb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231460AbhJTSwx (ORCPT + 99 others); Wed, 20 Oct 2021 14:52:53 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:49292 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231328AbhJTSwr (ORCPT ); Wed, 20 Oct 2021 14:52:47 -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=F34CO4kJ2wlEtjVzrikO0cx1FdgTWcUmymX9zm/E3dc=; b=5ngATRZbztJzzNL+dFEJjjk3JB YmVvg796mdYlh7ep4ayNoCLyGGCchsBx9XZUjOeooNBzUYhts+VG1sUMzEHt8+wUdRVd0Fq71P29Y rQXQr04skMBB70z1LToITrVa+zFx1wfvrwLgBSDkF2wcVMt3zbnnzX28P2oADYZ/IDEg=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1mdGfS-00BDIQ-4A; Wed, 20 Oct 2021 20:50:26 +0200 Date: Wed, 20 Oct 2021 20:50:26 +0200 From: Andrew Lunn To: Matthias Schiffer Cc: Joakim Zhang , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: fec: defer probe if PHY on external MDIO bus is not available Message-ID: References: <20211014113043.3518-1-matthias.schiffer@ew.tq-group.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 > > I've not looked at the details yet, just back from vacation. But this > > seems wrong. I would of expected phylib to of returned -EPRODE_DEFER > > at some point, when asked for a PHY which does not exist yet. All the > > driver should need to do is make sure it returns the > > -EPRODE_DEFER. > > This is what I expected as well, however there are a few complications: > > - At the moment the first time the driver does anything with the PHY is > in fec_enet_open(), not in fec_probe() - way too late to defer > anything O.K. Right. Are you using NFS root? For normal user space opening of the interface, this has all been sorted out by the time user space does anything. The NFS root changes the time in a big way. Anyway, i would say some bits of code need moving from open to probe so EPROBE_DEFER can be used. We already have: phy_node = of_parse_phandle(np, "phy-handle", 0); if (!phy_node && of_phy_is_fixed_link(np)) { ret = of_phy_register_fixed_link(np); if (ret < 0) { dev_err(&pdev->dev, "broken fixed-link specification\n"); goto failed_phy; } phy_node = of_node_get(np); } fep->phy_node = phy_node; Go one step further. If fep->phy_node is not NULL, we know there should be a PHY. So call of_phy_find_device(). If it returns NULL, then -EPROBE_DEFER. Otherwise store the phydev into fep, and use it in open. You will need to move the call to fec_enet_mii_init(pdev) earlier, so the MDIO bus is available. Andrew