Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4553294rdb; Tue, 12 Dec 2023 02:59:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEb7w7wkKfMCsSQYWxkztfBFCghNXk6wxYkCQ3jzX2tRkzz+/CXd0oKcSRrkBdlSJ8N1k9E X-Received: by 2002:a05:6808:3190:b0:3ba:1287:f3dd with SMTP id cd16-20020a056808319000b003ba1287f3ddmr3190478oib.96.1702378781856; Tue, 12 Dec 2023 02:59:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702378781; cv=none; d=google.com; s=arc-20160816; b=uTbIS1ksOJY0rYEMUwlYUCVpjheZvpNLvDg/oI7VFXNHbxomqrGOazwFFWm1GH6ajJ XDgzDW/tlcw+a3urO+71a6HxdwZqnKZuY2roB9+NH6LDIqZssRujZ3p9mAkcd4LjyNH1 J34BlNrv7CbYHb5eCO8uKWr6+mySbqTKpySp8XVxKrL04o4y6VZxwIz9Ds6DkkvFL+3j 76pkiIGjsUE7/4xIfapsuyVQo8Sfn1ifiMCdwSaMIF8bpcOhuygDtCP+2ZG9E5UP1qrk QNLoH+yHpryOtNdJKncgtKt/B83VelIPE9NbxyCKXQwrhwj6cWWPHRq038ezXGoG8YyU FvXg== 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=UBACCwW/u1iAUGLoPTfmihwXKrVJVbnjXJdVbLxBVuc=; fh=pd9xlk1C2gMakI4WVH8G/YnBBlIkN3c8ehH2O3tPrwc=; b=CmlFWv/N+6nwUoGPp3vTw9AV1oUKaDU2TuDSf7fDCcOFt4TwP3bY0TAxVFLbh14ay8 8JSNDgso07/fm6PAqCAgyj6mX3Y5LRy6ck1ML1OLsC96YLF7hqpjFQIyLzzWMZwRPuSP QiYeOP8y6gIgx41E4zqbgGOrhSOUpLVSABTKGkQdF7caUvRVeSVhPkTSv8IBHChIV696 KzXGXTf1TW5NszKRd7wQl+OsIfgIatECwiTimZejFWgSZTxTQXGQIoQ0dbcnIzje7pDt FbkoiJs89vnfqUEmbN9I1ByRYtnFhpNu4A+FMX6/3NkuDoxR7qknJHQRUibrTs7EeNwb Yo+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TLImtWxI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id j11-20020a056a00174b00b006cd84368e8dsi7511979pfc.190.2023.12.12.02.59.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:59:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TLImtWxI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 9B47D804C645; Tue, 12 Dec 2023 02:59:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231703AbjLLK7Y (ORCPT + 99 others); Tue, 12 Dec 2023 05:59:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230055AbjLLK7X (ORCPT ); Tue, 12 Dec 2023 05:59:23 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D775BA0; Tue, 12 Dec 2023 02:59:29 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-50bffb64178so6520251e87.2; Tue, 12 Dec 2023 02:59:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702378768; x=1702983568; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=UBACCwW/u1iAUGLoPTfmihwXKrVJVbnjXJdVbLxBVuc=; b=TLImtWxIKnyiWo1goY5pw6aJzjGur/5b98LF/msLof+FovWePPK8Ly+FTkqGsilDyk rYZ9G3tAAuaISfmw3fcA2zxI8MUlhm0RXkRWtGplCLdEkOFWBcinlf2zBgYr6T75HNcz GoAEEttWA8ah34s5fFD3e4HTg3OFZ6qypvQhmKF0x+8gXxQ4tf9+AIQ5VOGFYMq0OacT +LvULlZKmnrf6MQlMuTbriPeQuzjlV5EbL+xhTVwxueYoPknlHwvJ7PVK/D5yfGB+m21 Yt9dpiFucVjkn+AJ0CFoWN+P9R8Li0fn/Rfk+/EeOGApEdYJ1NddLoYQKOoaHUwK9iVB gDMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702378768; x=1702983568; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UBACCwW/u1iAUGLoPTfmihwXKrVJVbnjXJdVbLxBVuc=; b=myLu1xckwUWVhEHqfKsjvYqYuKk8NztlCCGLCgcnEDlQOCeBc476coTZYQWXZ2hYZd CKkqE74DJeBOMM7FnCU+GvNAKZzCtcI7WTheAtUsDRduYenLWcUqUIm+p7Frc8NE62vH o8oG8V6JLENcUpMzQdePNFufkPBxCJKanlpbyGOT0/jPeQToh6EVYieFbpzcdu2xml0j CNlX80Ilwecwi3+7W2iRQcwH7gyQFX2ot51mzJKsfwqiiwwJL6NdFZTG/TtUkmOkBkZi xwqaAvnUn+y7AucZV1lhHeuLhEXxr6NmzOsR0TAqEy7aceG/W6Ox/jCVzMHNXoxybrwJ eeHw== X-Gm-Message-State: AOJu0YxkO94NprVSaRXx4e/dw44yWDu3aY25wblb28xnGG5iCuFubzFU OLYkk1dpvkpGqx0chteKYy0= X-Received: by 2002:a05:6512:6cb:b0:50d:12ea:cba0 with SMTP id u11-20020a05651206cb00b0050d12eacba0mr3566985lff.95.1702378767797; Tue, 12 Dec 2023 02:59:27 -0800 (PST) Received: from mobilestation ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id dx7-20020a0565122c0700b0050d12fa98fesm1289491lfb.300.2023.12.12.02.59.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:59:27 -0800 (PST) Date: Tue, 12 Dec 2023 13:59:25 +0300 From: Serge Semin To: Andrew Halaney Cc: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Giuseppe Cavallaro , Andrew Lunn , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: stmmac: Handle disabled MDIO busses from devicetree Message-ID: References: <20231211-b4-stmmac-handle-mdio-enodev-v1-1-73c20c44f8d6@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231211-b4-stmmac-handle-mdio-enodev-v1-1-73c20c44f8d6@redhat.com> X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:59:39 -0800 (PST) On Mon, Dec 11, 2023 at 03:31:17PM -0600, Andrew Halaney wrote: > Many hardware configurations have the MDIO bus disabled, and are instead > using some other MDIO bus to talk to the MAC's phy. > > of_mdiobus_register() returns -ENODEV in this case. Let's handle it > gracefully instead of failing to probe the MAC. > > Fixes: 47dd7a540b8a (net: add support for STMicroelectronics Ethernet controllers.") > Signed-off-by: Andrew Halaney > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c > index fa9e7e7040b9..a39be15d41a8 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c > @@ -591,7 +591,13 @@ int stmmac_mdio_register(struct net_device *ndev) > new_bus->parent = priv->device; > > err = of_mdiobus_register(new_bus, mdio_node); > - if (err != 0) { > + if (err) { > + if (err == -ENODEV) { > + /* The bus is disabled in the devicetree, that's ok */ > + mdiobus_free(new_bus); > + return 0; > + } > + > dev_err_probe(dev, err, "Cannot register the MDIO bus\n"); > goto bus_register_fail; > } This can be implemented a bit simpler, more maintainable and saving one indentations level: err = of_mdiobus_register(new_bus, mdio_node); if (err == -ENODEV) { err = 0; dev_warn(dev, "MDIO bus is disabled\n"); goto bus_register_fail; } else if (err) { dev_err_probe(dev, err, "Cannot register the MDIO bus\n"); goto bus_register_fail; } -Serge(y) > > --- > base-commit: bbd220ce4e29ed55ab079007cff0b550895258eb > change-id: 20231211-b4-stmmac-handle-mdio-enodev-82168de68c6a > > Best regards, > -- > Andrew Halaney >