From patchwork Thu Jan 7 20:13:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 7979701 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E529EBEEE5 for ; Thu, 7 Jan 2016 20:14:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA93320149 for ; Thu, 7 Jan 2016 20:13:59 +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 1101920142 for ; Thu, 7 Jan 2016 20:13:59 +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 1aHGwX-0006W0-22; Thu, 07 Jan 2016 20:13:57 +0000 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aHGwU-0006TF-Sa for linux-rockchip@lists.infradead.org; Thu, 07 Jan 2016 20:13:55 +0000 Received: by mail-wm0-x22e.google.com with SMTP id u188so112747514wmu.1 for ; Thu, 07 Jan 2016 12:13:33 -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=4IYhTm/5E2O+Bez+gmvY7IUm5ulW64qmsAmVCKYhbdw=; b=jRMBNCGfz9dH3zei02zsYXiva3Hjkf4Ks8xAQ74ocXI+oy1sUceIZNArp1byO5DR5p J3Xz2/nPkcugcs2ehf9wHRp4tUbPq/vJRt54MacTEOaIR2pwtYf/xFkYW5N/i/y8kK/1 VOSSnFJAZw9Sr5E0QQuHNUa3VsSCDEE2Pb2Uh11wvIKNEM0EdHkDaeEcOBOfWI0LPUmi T3NvsHrgRVu2B+wgVTjsO74h46hJfEPTFW2YRwiVkWHj7+gpCnzEVjj65vaUDINYO2ZF ogCPVEEoSklP1W52A6hcv+cMiZ1Mfg8LdnpUvKJ0f0XpItbZiWFRbRdvkk/G+nDCSO1Y zNrQ== X-Received: by 10.28.195.212 with SMTP id t203mr20062629wmf.46.1452197611924; Thu, 07 Jan 2016 12:13:31 -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 o7sm150236wjf.45.2016.01.07.12.13.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jan 2016 12:13:30 -0800 (PST) From: Romain Perier To: peppe.cavallaro@st.com Subject: [PATCH v2] stmmac: Don't exit mdio registration when mdio subnode is not found in the DTS Date: Thu, 7 Jan 2016 21:13:28 +0100 Message-Id: <1452197608-29060-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-20160107_121355_079840_0607360B X-CRM114-Status: GOOD ( 11.96 ) 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. Fixes: e34d65696d2e ("stmmac: create of compatible mdio bus for stmmac driver") Signed-off-by: Romain Perier Tested-by: Phil Reid --- Changes in v2: - Removed IS_ENABLED macro from the if statement before calling of_mdiobus_register. - Added Fixes tag in commit message 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..648488d 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 (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;