From patchwork Tue Dec 29 14:05:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 7930061 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 31AF79F32E for ; Tue, 29 Dec 2015 14:06:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4613B201DD for ; Tue, 29 Dec 2015 14:06:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 76F21201CD for ; Tue, 29 Dec 2015 14:06:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aDuuZ-0003gW-02; Tue, 29 Dec 2015 14:06:03 +0000 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aDuuV-0003da-ES for linux-rockchip@lists.infradead.org; Tue, 29 Dec 2015 14:06:00 +0000 Received: by mail-wm0-x22a.google.com with SMTP id b14so14551203wmb.1 for ; Tue, 29 Dec 2015 06:05:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=USFph0mN0cWslCGY51AxGVsbrstozoraFKaIxDqo7OE=; b=J+RZip0ahKHxGldANwokSAspFdjR4jGaO3dxqpR1x+6FRaEhgULVl0OlY5aIQaD09o Yfi9Zg/cJAPxYRWRCmSmPFaI4AsPcM2Jv9SnH68IOCewIpfBw9DT6ICZAiY1dcGUngGC 9jatB8GaqW8hQpnBwK9ebXNdPSNMnT6ozFEZ0nnIuBvMbeWkdqFd7TU4SHBP/4VxcRR3 V2ixvMpMmPupGGh3ey+ujUVRI6AAMiOyjLuIUW5XzPeIF9RUsWeIDJ1rt0DU/MU5OI/U ABZ3a5UK+vOTC5qC4bc5owIw+QxaWeiGtSvee+wbI4ZKM7nkNlo2WqDsyXWmi2sVumEt tjDA== X-Received: by 10.194.87.39 with SMTP id u7mr64047145wjz.11.1451397937574; Tue, 29 Dec 2015 06:05:37 -0800 (PST) Received: from localhost.localdomain (i19-les01-ntr-176-186-2-137.sfr.lns.abo.bbox.fr. [176.186.2.137]) by smtp.gmail.com with ESMTPSA id z127sm5787457wme.2.2015.12.29.06.05.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Dec 2015 06:05:36 -0800 (PST) From: Romain Perier To: peppe.cavallaro@st.com Subject: [PATCH] stmmac: Don't exit mdio registration when mdio subnode is not found in the DTS Date: Tue, 29 Dec 2015 15:05:35 +0100 Message-Id: <1451397935-23643-1-git-send-email-romain.perier@gmail.com> X-Mailer: git-send-email 2.5.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151229_060559_686913_2FD46470 X-CRM114-Status: GOOD ( 11.94 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-rockchip@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Originally, most of the platforms using this driver did not define an mdio subnode in the devicetree. Commit e34d65 ("stmmac: create of compatible mdio bus for stmmac driver") introduced a backward compatibily issue by using of_mdiobus_register explicitly with an mdio subnode. This patch fixes the issue by calling the function mdiobus_register, when mdio subnode is not found. The driver is now compatible with both modes. Signed-off-by: Romain Perier --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 16c85cc..0034de44 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -218,8 +218,7 @@ int stmmac_mdio_register(struct net_device *ndev) if (mdio_node) { netdev_dbg(ndev, "FOUND MDIO subnode\n"); } else { - netdev_err(ndev, "NO MDIO subnode\n"); - return 0; + netdev_warn(ndev, "No MDIO subnode found\n"); } } @@ -251,7 +250,10 @@ int stmmac_mdio_register(struct net_device *ndev) new_bus->phy_mask = mdio_bus_data->phy_mask; new_bus->parent = priv->device; - err = of_mdiobus_register(new_bus, mdio_node); + if (IS_ENABLED(CONFIG_OF) && mdio_node) + err = of_mdiobus_register(new_bus, mdio_node); + else + err = mdiobus_register(new_bus); if (err != 0) { pr_err("%s: Cannot register as MDIO bus\n", new_bus->name); goto bus_register_fail;