Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1862820ybb; Sat, 4 Apr 2020 14:39:10 -0700 (PDT) X-Google-Smtp-Source: APiQypLNQj06Ca6Otvr/idJ9jiLL+z2JkxHeZ6Gej3Ql8Ozh33TrfbAnLg7BXSX7nEJ775v1dZDU X-Received: by 2002:a9d:8f3:: with SMTP id 106mr11710281otf.328.1586036350019; Sat, 04 Apr 2020 14:39:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586036350; cv=none; d=google.com; s=arc-20160816; b=N+pTMcWIHez8uJIuuSzi6um+ecVfPUa38y2BpF2Zt+MFCctDwfA2LpemxJV0lv3bcG guv+n3PBI06K0XAfDA8BNdHjMgxQw4fSaTZwu+x87KEd60LkcAV6qFTiAq1EieIOv3Ty WvTAy9UFB9gFaBIb4KlXiPEGlKd8niVi/BoMxKFoMMruAc4ZwOiiYlvnmwW5yK+yLZsJ ZLYkfOci7sWb+0pklQvKca+qeyTG7FaZBx68f/aDvk77tffRNvEHA7rtxWrq8PmSGLCX OIg5/JoRz0r+pK3iLtP0MsQ1WV/VdaeiGeMyHDa9kSes2RqOMtWOrXRv7dWkYVD+RGA4 k4SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=U/fdAWib9uvfMhjdQ8dR7Ha7hvvoVTtYuarTgINT4Oo=; b=JYphmqDDSf6bSnBNojSOpqtQqBeINKS22bL4aIwX0CfducExc23O4YdND19sxGUhjW 2IfOWB2biz2utDWvbhaPcK+E32FcLq4xhFRxGs5SdCA9ZT3JO3DcMt5jatytNNwQjaKa GUOSIRQIdPJO4yj8qXr8ZDUMQrY1h1Y8Q3YZN95fyDMLgd37xl3qTS4aBP/vXbyTNorP MzEdF+Oe/AShDoZUkfuEuNKgRgSoTgLLJ02/xo16zKWMv1PlEbewme+dkMuNgohaLC8t MCxdqZOLeW4n9JmX3yMCspaG1E0xO0KtxueXJqY6fJh7PaIQRvleUFtNH9OA7dNapVEI VxOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lg2HXQHW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s5si5338217ood.66.2020.04.04.14.38.58; Sat, 04 Apr 2020 14:39:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lg2HXQHW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726443AbgDDVf1 (ORCPT + 99 others); Sat, 4 Apr 2020 17:35:27 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:37516 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726399AbgDDVf1 (ORCPT ); Sat, 4 Apr 2020 17:35:27 -0400 Received: by mail-wm1-f65.google.com with SMTP id j19so11744557wmi.2; Sat, 04 Apr 2020 14:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=U/fdAWib9uvfMhjdQ8dR7Ha7hvvoVTtYuarTgINT4Oo=; b=lg2HXQHW+52dOosQI4mBoJYzeXxFXai5axcdyrcyNCS9mAmMPwDCbJ2qhn7auxvUBL /Ieb5jGKMxTaCLEkJAX2toSK4VZGYhIsz3TYzc/skrQDldYlwP3yLq6mghWRtPbYgqNV FMb4WCjUHW48pY6tPsb4czRAI11XAE5Pf1npn1s//VBVNc5Qideu0h6QRW1RgfeMPEu9 lsrnXuEOdnp1LFUEYef/osk7kGrBmrcAyoEDcbSH5tLLy4bx6LVaHqlq0Z6YBEgPkrEt mjO5TWdq/uBzDXYLETCEbEXfTks+cBAMlCiv4P8mfJx1FM+DpSNhdnKWU7GKcK08lqL7 5bng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=U/fdAWib9uvfMhjdQ8dR7Ha7hvvoVTtYuarTgINT4Oo=; b=XOursfWENeGHowmvPv/Fg7UoUQVJSdN4KJKS22Vl7QElyvXnUXX61KJTNnCNWS2QLo UPD4uukHscwl12oV69ys8YFp5q+Awa+PY/aYLK88YTeJ8fZhfxAQ/4p8xD8ReGVf+bKP IuYgVfsYIAckTgxytDEH4EQ69Zb8dLVDnFOSYwhuquryjht5DOhDNRurj5tdpzEA0Nng 1wSX1Q5SbfOzJWpkTi3pTPezuIpgwmA3DhOUPV+9MIp7BdA1FNJJQ0rxeUbsh/czWlKD qJsMnYq22xs3MINwCpBQuOD3+vD/R74Yt/aAK5OO8V+ay5t77SU8j78TsfpiJzMoqhB0 wt/Q== X-Gm-Message-State: AGi0PubEXnIyiGsNOSRRL+dignah0ZJfxO5L2njtvMIiStGgGk2EYMLd xHxHy2dox2xy9uTCQ+EeVfeQDfF0 X-Received: by 2002:a1c:4c0f:: with SMTP id z15mr15097456wmf.95.1586036122532; Sat, 04 Apr 2020 14:35:22 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id u5sm20147834wrp.81.2020.04.04.14.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Apr 2020 14:35:21 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, Florian Fainelli , Andrew Lunn , Vivien Didelot , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net] net: dsa: bcm_sf2: Do not register slave MDIO bus with OF Date: Sat, 4 Apr 2020 14:35:17 -0700 Message-Id: <20200404213517.12783-1-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We were registering our slave MDIO bus with OF and doing so with assigning the newly created slave_mii_bus of_node to the master MDIO bus controller node. This is a bad thing to do for a number of reasons: - we are completely lying about the slave MII bus is arranged and yet we still want to control which MDIO devices it probes. It was attempted before to play tricks with the bus_mask to perform that: https://www.spinics.net/lists/netdev/msg429420.html but the approach was rightfully rejected - the device_node reference counting is messed up and we are effectively doing a double probe on the devices we already probed using the master, this messes up all resources reference counts (such as clocks) The proper fix for this as indicated by David in his reply to the thread above is to use a platform data style registration so as to control exactly which devices we probe: https://www.spinics.net/lists/netdev/msg430083.html By using mdiobus_register(), our slave_mii_bus->phy_mask value is used as intended, and all the PHY addresses that must be redirected towards our slave MDIO bus is happening while other addresses get redirected towards the master MDIO bus. Fixes: 461cd1b03e32 ("net: dsa: bcm_sf2: Register our slave MDIO bus") Signed-off-by: Florian Fainelli --- drivers/net/dsa/bcm_sf2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index affa5c6e135c..cc95adc5ab4b 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -480,7 +480,7 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) priv->slave_mii_bus->parent = ds->dev->parent; priv->slave_mii_bus->phy_mask = ~priv->indir_phy_mask; - err = of_mdiobus_register(priv->slave_mii_bus, dn); + err = mdiobus_register(priv->slave_mii_bus); if (err && dn) of_node_put(dn); -- 2.17.1