From patchwork Wed Sep 21 15:45:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 4220 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 09F2323EF6 for ; Wed, 21 Sep 2011 15:36:34 +0000 (UTC) Received: from mail-yi0-f52.google.com (mail-yi0-f52.google.com [209.85.218.52]) by fiordland.canonical.com (Postfix) with ESMTP id C1A95A18A87 for ; Wed, 21 Sep 2011 15:36:33 +0000 (UTC) Received: by yie30 with SMTP id 30so1638667yie.11 for ; Wed, 21 Sep 2011 08:36:33 -0700 (PDT) Received: by 10.223.94.134 with SMTP id z6mr1277459fam.8.1316619392894; Wed, 21 Sep 2011 08:36:32 -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 y6cs130274lad; Wed, 21 Sep 2011 08:36:32 -0700 (PDT) Received: by 10.220.153.206 with SMTP id l14mr195658vcw.247.1316619389888; Wed, 21 Sep 2011 08:36:29 -0700 (PDT) Received: from ch1outboundpool.messaging.microsoft.com (ch1ehsobe001.messaging.microsoft.com. [216.32.181.181]) by mx.google.com with ESMTPS id g10si1290684vce.5.2011.09.21.08.36.29 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Sep 2011 08:36:29 -0700 (PDT) Received-SPF: neutral (google.com: 216.32.181.181 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) client-ip=216.32.181.181; Authentication-Results: mx.google.com; spf=neutral (google.com: 216.32.181.181 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) smtp.mail=shawn.guo@linaro.org Received: from mail18-ch1-R.bigfish.com (216.32.181.168) by CH1EHSOBE011.bigfish.com (10.43.70.61) with Microsoft SMTP Server id 14.1.225.22; Wed, 21 Sep 2011 15:36:29 +0000 Received: from mail18-ch1 (localhost.localdomain [127.0.0.1]) by mail18-ch1-R.bigfish.com (Postfix) with ESMTP id AB855C203CE; Wed, 21 Sep 2011 15:36:28 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275dhz2dh87h2a8h668h839h) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-FB-DOMAIN-IP-MATCH: fail Received: from mail18-ch1 (localhost.localdomain [127.0.0.1]) by mail18-ch1 (MessageSwitch) id 1316619380858566_6230; Wed, 21 Sep 2011 15:36:20 +0000 (UTC) Received: from CH1EHSMHS017.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.251]) by mail18-ch1.bigfish.com (Postfix) with ESMTP id 83BCF18D8070; Wed, 21 Sep 2011 15:36:20 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS017.bigfish.com (10.43.70.17) with Microsoft SMTP Server (TLS) id 14.1.225.22; Wed, 21 Sep 2011 15:36:18 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.323.7; Wed, 21 Sep 2011 10:36:17 -0500 Received: from S2100-06.ap.freescale.net (S2100-06.ap.freescale.net [10.192.242.125]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p8LFa8sM001890; Wed, 21 Sep 2011 10:36:15 -0500 (CDT) From: Shawn Guo To: "David S. Miller" CC: Francois Romieu , =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= , Troy Kisky , Wolfram Sang , , Shawn Guo Subject: [PATCH v3 2/3] net/fec: fix fec1 check in fec_enet_mii_init() Date: Wed, 21 Sep 2011 23:45:50 +0800 Message-ID: <1316619951-27751-3-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1316619951-27751-1-git-send-email-shawn.guo@linaro.org> References: <1316619951-27751-1-git-send-email-shawn.guo@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com 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 Acked-by: Wolfram Sang --- 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;