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: 230486 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A62172C00A7 for ; Mon, 25 Mar 2013 07:34:54 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754117Ab3CXUeu (ORCPT ); Sun, 24 Mar 2013 16:34:50 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.162]:57532 "EHLO mo-p00-ob.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753869Ab3CXUet (ORCPT ); Sun, 24 Mar 2013 16:34:49 -0400 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 Cc: jason@lakedaemon.net, andrew@lunn.ch, davem@davemloft.net, Simon Baatz 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> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.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);