Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4675438rdb; Tue, 12 Dec 2023 06:28:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IGK8/ms03UGBi2v+uGzO0SklZTCNHScF7GVd1ItjMSXGiuYTAc03do1cZ3Y+A0cA3hMRv0h X-Received: by 2002:a05:6a20:158b:b0:16c:b5ce:50f with SMTP id h11-20020a056a20158b00b0016cb5ce050fmr2936586pzj.32.1702391338110; Tue, 12 Dec 2023 06:28:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702391338; cv=none; d=google.com; s=arc-20160816; b=OnrSS1QJatESYzdySGY/k07G3HdFf2VnnZTEaVFWMxZOdA7uSJ+v91neLnLM8us0IE JstlNyRMRbmHbBFjPG57LLKEicMzvRTsXOO8DtLPCACexO1dxnUgNbPEqhhJYtIf2j5L 4QclGJT4zoCnfYbZ3jfxqn1/QqTS9vAkOGxlO+T9piliJHcTM95fSTVv2hqOh3jAqlur KKuLWTv/AuFTgg4Y9UDje42j5tj0GCtcWY9xSb5jkPRfSOwKHPnIZl0RIee3mv/ktIDz kF4ExyNnefVof2dtCPOb6ImNzfCAf2oqzVmfjCOeN+vqg87CiNHqXuF2IwToY9/IEi// 1JjQ== 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=Sic7JgTbCqXENzuaXidvmcJDkf8Pxtwv2IpV4/8llXA=; fh=VyyvOSKoLwvbXUAp7DyX22CQ6LA4TzxQHaqY/qlDr1Q=; b=EwwxWQeY77Fo25NIBl9O6FXIDC3RkLfEtxpjk/L8ergeYtAnMExUeYcmbPQeE3HVlG 86BPZQkKEYBUcP8GknQey06ErXhoTfqqLY2ukQYz9SG+OrdGACytZrDPgUSYzVZgO4sc ArVFq9ru8X1QMLLVvA8eI1ORKbSFDGezuLd+cbQA3dxyQO5jxoQexjGuseO2o09T0ojt CH7XJbkSAMaWfytBR1A2ug9ET1uVLmXNtZUcR1kv9BPaCqP45+NeO69y8zLuzcLaMCzj RLLDvPleLu6vZlCwdkPqhilYypuatnrFXG50Fl3+PQD9Y+CFdMPL3TV6tJXjSkYpba6f GtgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hrXg1Qz2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id 37-20020a630c65000000b005c1c489bfc6si2524457pgm.627.2023.12.12.06.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 06:28:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hrXg1Qz2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 61C728051BAB; Tue, 12 Dec 2023 06:28:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376600AbjLLO2j (ORCPT + 99 others); Tue, 12 Dec 2023 09:28:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376605AbjLLO2h (ORCPT ); Tue, 12 Dec 2023 09:28:37 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75714E9 for ; Tue, 12 Dec 2023 06:28:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702391320; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Sic7JgTbCqXENzuaXidvmcJDkf8Pxtwv2IpV4/8llXA=; b=hrXg1Qz2qMriIzzDLT0EsESX/OqA3/o0ZhbZiH+ntnvNebIQpWuf+gcjg2eJqbBBcMFl9H QXPoWaF1XEncqvDNQfo6GZ9wlfwTrsERE8O3LQVgkSYZr1rj/VtkCc21Z6bT7TIDnmHGrE Z0O1H4aPEs4cgbupVw2TpWYf/XH0j+0= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-QJACo1pDP0GLWdWP7oQvOg-1; Tue, 12 Dec 2023 09:28:39 -0500 X-MC-Unique: QJACo1pDP0GLWdWP7oQvOg-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-67a940dcd1aso78706986d6.3 for ; Tue, 12 Dec 2023 06:28:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702391319; x=1702996119; 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=Sic7JgTbCqXENzuaXidvmcJDkf8Pxtwv2IpV4/8llXA=; b=hZX2oOYxxVsSehrkgr0FchC+PN0vShkpOnWfsmrQXsyMYsPQhRMkpLeH/CMwYrmd1Z G5D51pqeWlcu76OPhANJuKfEHsbgSTisAh0rCO6Gz5chQbZeJhJ7nzCuitTzPZytUfHx wKZBhDx+k/cS+LO7lJQfBtKDi9ufXm0Bnwvmq3V2DjSAU8W21cXydd7bEQKJhyNEhqeL CHNgYq9gWwhkwSo5ldh3v3slm8nfsnJT1wDjhKxwjKnwl4ajgKkn7LdX6nkYYNtwQ/zH TxP2MA4Dc/ROVGcZdQsWqXlfkREWXtEcze27OekUgjgLA06oBQAWkBtbJ0u70dmfXEPk D3PA== X-Gm-Message-State: AOJu0YxXbABLJcNQdngWXsCpqRZuY7MErv/YyjPoWCRGhdXwScjqdwdk yu7ai/P5qHiDsZltkNe8SdL8uDfdN94tA70WBYDdVuyIyitkWx/lmJhpDkqCdgCFG7khKnE2R1N i5a56kl9ZqinfZMpH5FlXyEfZ X-Received: by 2002:a05:6214:c25:b0:67a:a721:830b with SMTP id a5-20020a0562140c2500b0067aa721830bmr7837479qvd.101.1702391318784; Tue, 12 Dec 2023 06:28:38 -0800 (PST) X-Received: by 2002:a05:6214:c25:b0:67a:a721:830b with SMTP id a5-20020a0562140c2500b0067aa721830bmr7837469qvd.101.1702391318451; Tue, 12 Dec 2023 06:28:38 -0800 (PST) Received: from fedora ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id jr12-20020a0562142a8c00b0067a14d996e9sm4231045qvb.1.2023.12.12.06.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 06:28:37 -0800 (PST) Date: Tue, 12 Dec 2023 08:28:35 -0600 From: Andrew Halaney To: Serge Semin 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: X-Spam-Status: No, score=0.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Tue, 12 Dec 2023 06:28:55 -0800 (PST) On Tue, Dec 12, 2023 at 01:59:25PM +0300, Serge Semin wrote: > 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"); Thanks for all your reviews, I agree this is cleaner! I'm going to opt to use dev_info() here as this isn't something that's wrong, just worth noting. > 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 > > >