From patchwork Sun Mar 24 20:34:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Baatz X-Patchwork-Id: 2327241 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 85D57DFB79 for ; Sun, 24 Mar 2013 20:39:36 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UJrdI-0007Ki-0e; Sun, 24 Mar 2013 20:35:12 +0000 Received: from mo6-p00-ob.rzone.de ([2a01:238:20a:202:5300::1]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UJrd2-0007Hj-Om for linux-arm-kernel@lists.infradead.org; Sun, 24 Mar 2013 20:34:58 +0000 X-RZG-AUTH: :L20Qdkipd/NtQfa28f3iP6nsj1VEm6lxnnjU56eNUnjyVKhsoRrRYQqTg2VsKWBjXOD8qSDlEoJr1es= X-RZG-CLASS-ID: mo00 Received: from gandalf.schnuecks.de ([2001:4dd0:f8d2:2602::1]) by smtp.strato.de (josoe mo16) (RZmta 31.22 AUTH) with (DHE-RSA-AES256-SHA encrypted) ESMTPA id L020afp2OJU4H2 ; Sun, 24 Mar 2013 21:34:48 +0100 (CET) Received: by gandalf.schnuecks.de (Postfix, from userid 500) id A85764014B; Sun, 24 Mar 2013 21:34:47 +0100 (CET) From: Simon Baatz To: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, florian@openwrt.org, thomas.petazzoni@free-electrons.com Subject: [PATCH 2/2] mv643xx_eth: defer probing if Marvell Orion MDIO driver not loaded Date: Sun, 24 Mar 2013 21:34:00 +0100 Message-Id: <1364157240-28883-3-git-send-email-gmbnomis@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1364157240-28883-1-git-send-email-gmbnomis@gmail.com> References: <1364157240-28883-1-git-send-email-gmbnomis@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130324_163456_946066_F0542751 X-CRM114-Status: GOOD ( 11.00 ) X-Spam-Score: -1.0 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (gmbnomis[at]gmail.com) 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.9 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list Cc: Simon Baatz , andrew@lunn.ch, jason@lakedaemon.net, davem@davemloft.net X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When both the Marvell MV643XX ethernet driver and the Orion MDIO driver are compiled as modules, the ethernet driver may be probed before the MDIO driver. Let mv643xx_eth_probe() return EPROBE_DEFER in this case, i.e. when it cannot find the PHY. Signed-off-by: Simon Baatz --- drivers/net/ethernet/marvell/mv643xx_eth.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index a65a92e..aedbd82 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -2681,7 +2681,7 @@ static struct phy_device *phy_scan(struct mv643xx_eth_private *mp, } /* Attempt to connect to the PHY using orion-mdio */ - phydev = NULL; + phydev = ERR_PTR(-ENODEV); for (i = 0; i < num; i++) { int addr = (start + i) & 0x1f; @@ -2812,11 +2812,17 @@ static int mv643xx_eth_probe(struct platform_device *pdev) netif_set_real_num_tx_queues(dev, mp->txq_count); netif_set_real_num_rx_queues(dev, mp->rxq_count); - if (pd->phy_addr != MV643XX_ETH_PHY_NONE) + if (pd->phy_addr != MV643XX_ETH_PHY_NONE) { mp->phy = phy_scan(mp, pd->phy_addr); - if (mp->phy != NULL) + if (IS_ERR(mp->phy)) { + err = PTR_ERR(mp->phy); + if (err == -ENODEV) + err = -EPROBE_DEFER; + goto out; + } phy_init(mp, pd->speed, pd->duplex); + } SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops);