From patchwork Wed Sep 21 16:07:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 4224 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 498AE23F56 for ; Wed, 21 Sep 2011 15:59:28 +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 353C0A188BD for ; Wed, 21 Sep 2011 15:59:28 +0000 (UTC) Received: by fxe23 with SMTP id 23so2517029fxe.11 for ; Wed, 21 Sep 2011 08:59:28 -0700 (PDT) Received: by 10.223.5.76 with SMTP id 12mr1257475fau.103.1316620732602; Wed, 21 Sep 2011 08:58:52 -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 y6cs131173lad; Wed, 21 Sep 2011 08:58:51 -0700 (PDT) Received: by 10.216.14.221 with SMTP id d71mr1021502wed.23.1316620731008; Wed, 21 Sep 2011 08:58:51 -0700 (PDT) Received: from DB3EHSOBE002.bigfish.com (db3ehsobe002.messaging.microsoft.com. [213.199.154.140]) by mx.google.com with ESMTPS id m23si4653471weq.48.2011.09.21.08.58.50 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Sep 2011 08:58:51 -0700 (PDT) Received-SPF: neutral (google.com: 213.199.154.140 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) client-ip=213.199.154.140; Authentication-Results: mx.google.com; spf=neutral (google.com: 213.199.154.140 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) smtp.mail=shawn.guo@linaro.org Received: from mail11-db3-R.bigfish.com (10.3.81.252) by DB3EHSOBE002.bigfish.com (10.3.84.22) with Microsoft SMTP Server id 14.1.225.22; Wed, 21 Sep 2011 15:58:50 +0000 Received: from mail11-db3 (localhost.localdomain [127.0.0.1]) by mail11-db3-R.bigfish.com (Postfix) with ESMTP id D2B3D18804C6; Wed, 21 Sep 2011 15:58:49 +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-SS: 13, X-FB-DOMAIN-IP-MATCH: fail Received: from mail11-db3 (localhost.localdomain [127.0.0.1]) by mail11-db3 (MessageSwitch) id 1316620723236813_23382; Wed, 21 Sep 2011 15:58:43 +0000 (UTC) Received: from DB3EHSMHS008.bigfish.com (unknown [10.3.81.254]) by mail11-db3.bigfish.com (Postfix) with ESMTP id 29E6A15F8056; Wed, 21 Sep 2011 15:58:43 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS008.bigfish.com (10.3.87.108) with Microsoft SMTP Server (TLS) id 14.1.225.22; Wed, 21 Sep 2011 15:58:39 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server id 14.1.323.7; Wed, 21 Sep 2011 10:58:26 -0500 Received: from S2100-06.ap.freescale.net (S2100-06.ap.freescale.net [10.192.242.125]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p8LFwI53000611; Wed, 21 Sep 2011 10:58:24 -0500 (CDT) From: Shawn Guo To: "David S. Miller" CC: , , , Shawn Guo Subject: [PATCH v3 2/3] net/fec: fix fec1 check in fec_enet_mii_init() Date: Thu, 22 Sep 2011 00:07:49 +0800 Message-ID: <1316621270-27805-3-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1316621270-27805-1-git-send-email-shawn.guo@linaro.org> References: <1316621270-27805-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 --- 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;