Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1509097ybb; Sat, 11 Apr 2020 05:16:22 -0700 (PDT) X-Google-Smtp-Source: APiQypLazADo83/MbzsnFvTGbYaGEq9jLioBUYS+/YRr0j40BUzllAeOpm7Dm5VdGjCG5mc/MLOc X-Received: by 2002:a37:6fc5:: with SMTP id k188mr8136853qkc.145.1586607382001; Sat, 11 Apr 2020 05:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586607381; cv=none; d=google.com; s=arc-20160816; b=TJfwKi0vDeN0CIhwKO65mc9CWOgY3DP4SRjAtxt1dZZjysAkhq++gLJTGcgk29zBo+ /eky0WhKiWymHJeIWzPyhOGcaYgrvscw0MpH0RDQ25H0sUkjHQd+avQHjm4E2YFTuaLy LFIdjiItHy38OLhgSIcMCI4Uaf/266Sbtr4nb5xgJFsAxKeeMMEWkynMZx322ETqNrGZ tES+QDI5s5xQAzHkiLY/0QDusdBzwI6Lrmnj/lx4K4Cw/0hQOoaRGByJ2xl4lLjZcgYt SXS+ux6L5HN7PJ2j5rNn/1Ut03u2/gKIAfO6RwyQn0bICeDbwwzy70nfZ/IUaCnaniMd 62iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U1XFLX7dFjsJeUXAh7CE54+uELqBx+yz0wuDrLWnmTU=; b=FNN5x2q0N3srV1XMmuU0TYe3Rg+C7XN2BfJbc+XZbTyLxbk2snESvTHJPBzq0OofKV e8v06LnXoUpl4x+57tkRRpztt8NH6iV726qm3yUR5XVf7uu2qmI1BWUe0ub8FSulicep vUDM/wTZu8aL24cuqhOP9I3JtWuwr1j+Pak1XVJ/QNflkhReBzDSgkuXNx4/m5l+0odA iZEtDkTq25YVfjcws/bu+jLY0SDdX8lAxaZTZeIGifNjEfafEx90YoIyR6pWyjDI8IlI WO5XMIq0+mcTOMdcHTx6BoUE4XurDJbKQITiYSAuao6VRwoAfb62eAbZny4mk6HAQh1K LglQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YdLguhMC; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m23si2731178qtn.35.2020.04.11.05.16.08; Sat, 11 Apr 2020 05:16:21 -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=@kernel.org header.s=default header.b=YdLguhMC; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727193AbgDKMPa (ORCPT + 99 others); Sat, 11 Apr 2020 08:15:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:49382 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726913AbgDKMP1 (ORCPT ); Sat, 11 Apr 2020 08:15:27 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0C9C021775; Sat, 11 Apr 2020 12:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586607327; bh=0H/UmwArp6YOgWVzCo6khowge+q28SjPJwBk/7GX74E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YdLguhMCBYWTOatZ4M2SC5ZJKwH0LrJrqGD89aEEioHqVMZUf9MKYlSJJjRxNDnz5 4O8tT9/NUWf6bmyUKvAkX87VlvrxgFWBNvezChALEHBCywIHEHS8ypDqwzFp+1h1nA ySBrNRDELn/tkRCB353ZOt+tc71Fv9/0OgtP3X2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Vivien Didelot , "David S. Miller" Subject: [PATCH 4.19 29/54] net: dsa: bcm_sf2: Do not register slave MDIO bus with OF Date: Sat, 11 Apr 2020 14:09:11 +0200 Message-Id: <20200411115511.409766817@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200411115508.284500414@linuxfoundation.org> References: <20200411115508.284500414@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Florian Fainelli [ Upstream commit 536fab5bf5826404534a6c271f622ad2930d9119 ] 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 Reviewed-by: Vivien Didelot Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/bcm_sf2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -461,7 +461,7 @@ static int bcm_sf2_mdio_register(struct 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);