From patchwork Sun Sep 18 11:54:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 4161 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 5A30023EFB for ; Sun, 18 Sep 2011 11:52:35 +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 496B0A183F2 for ; Sun, 18 Sep 2011 11:52:35 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 23so4345047fxe.11 for ; Sun, 18 Sep 2011 04:52:35 -0700 (PDT) Received: by 10.223.34.143 with SMTP id l15mr3072685fad.46.1316346755186; Sun, 18 Sep 2011 04:52:35 -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 y6cs4602lad; Sun, 18 Sep 2011 04:52:35 -0700 (PDT) Received: by 10.68.59.138 with SMTP id z10mr2702420pbq.412.1316346753848; Sun, 18 Sep 2011 04:52:33 -0700 (PDT) Received: from mail-pz0-f45.google.com (mail-pz0-f45.google.com [209.85.210.45]) by mx.google.com with ESMTPS id f6si8439655pbd.152.2011.09.18.04.52.33 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Sep 2011 04:52:33 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.45 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) client-ip=209.85.210.45; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.45 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-pz0-f45.google.com with SMTP id 33so12982704pzk.4 for ; Sun, 18 Sep 2011 04:52:33 -0700 (PDT) Received: by 10.68.6.135 with SMTP id b7mr2453948pba.113.1316346752883; Sun, 18 Sep 2011 04:52:32 -0700 (PDT) Received: from localhost.localdomain ([180.106.36.88]) by mx.google.com with ESMTPS id 4sm2053371pbk.5.2011.09.18.04.52.27 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Sep 2011 04:52:32 -0700 (PDT) From: Shawn Guo To: netdev@vger.kernel.org Cc: "David S. Miller" , linux-arm-kernel@lists.infradead.org, patches@linaro.org, Shawn Guo Subject: [PATCH 2/4] net/fec: fix fec1 check in fec_enet_mii_init() Date: Sun, 18 Sep 2011 19:54:10 +0800 Message-Id: <1316346852-17090-3-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1316346852-17090-1-git-send-email-shawn.guo@linaro.org> References: <1316346852-17090-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/fec.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 6a638e9..5ef0e34 100644 --- a/drivers/net/fec.c +++ b/drivers/net/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;