From patchwork Fri Sep 23 12:12:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 4301 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 181CA23F57 for ; Fri, 23 Sep 2011 12:11:20 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 061D6A180E6 for ; Fri, 23 Sep 2011 12:11:20 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 23so5220605fxe.11 for ; Fri, 23 Sep 2011 05:11:20 -0700 (PDT) Received: by 10.223.57.17 with SMTP id a17mr72487fah.65.1316779879925; Fri, 23 Sep 2011 05:11:19 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.18.198 with SMTP id y6cs209119lad; Fri, 23 Sep 2011 05:11:19 -0700 (PDT) Received: by 10.236.22.9 with SMTP id s9mr21516887yhs.129.1316779878519; Fri, 23 Sep 2011 05:11:18 -0700 (PDT) Received: from mail-gx0-f178.google.com (mail-gx0-f178.google.com [209.85.161.178]) by mx.google.com with ESMTPS id i27si12882142yhm.82.2011.09.23.05.11.18 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Sep 2011 05:11:18 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.161.178 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) client-ip=209.85.161.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.161.178 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) smtp.mail=shawn.guo@linaro.org Received: by mail-gx0-f178.google.com with SMTP id 21so4155297gxk.37 for ; Fri, 23 Sep 2011 05:11:18 -0700 (PDT) Received: by 10.68.11.138 with SMTP id q10mr9793457pbb.37.1316779877788; Fri, 23 Sep 2011 05:11:17 -0700 (PDT) Received: from localhost.localdomain ([117.82.33.48]) by mx.google.com with ESMTPS id 2sm22135119pbu.1.2011.09.23.05.11.09 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Sep 2011 05:11:17 -0700 (PDT) From: Shawn Guo To: "David S. Miller" Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org, Shawn Guo Subject: [PATCH v5 2/3] net/fec: fix fec1 check in fec_enet_mii_init() Date: Fri, 23 Sep 2011 20:12:47 +0800 Message-Id: <1316779968-21390-3-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1316779968-21390-1-git-send-email-shawn.guo@linaro.org> References: <1316779968-21390-1-git-send-email-shawn.guo@linaro.org> In function fec_enet_mii_init(), it uses non-zero pdev->id as part of the condition to check the second fec instance (fec1). This works before the driver supports device tree probe. But in case of device tree probe, pdev->id is -1 which is also non-zero, so the logic becomes broken when device tree probe gets supported. The patch change the logic to check "pdev->id > 0" as the part of the condition for identifying fec1. Signed-off-by: Shawn Guo --- drivers/net/ethernet/freescale/fec.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index 9c1d059..2bbe6a5 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c @@ -996,7 +996,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) * mdio interface in board design, and need to be configured by * fec0 mii_bus. */ - if ((id_entry->driver_data & FEC_QUIRK_ENET_MAC) && pdev->id) { + if ((id_entry->driver_data & FEC_QUIRK_ENET_MAC) && pdev->id > 0) { /* fec1 uses fec0 mii_bus */ fep->mii_bus = fec0_mii_bus; return 0;