From patchwork Mon Sep 5 17:24:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 113414 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id BF968B6F7F for ; Tue, 6 Sep 2011 03:31:48 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 328DB280BF; Mon, 5 Sep 2011 19:31:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qLAt1E83jKp7; Mon, 5 Sep 2011 19:31:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B19C7280A4; Mon, 5 Sep 2011 19:31:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 41F5528094 for ; Mon, 5 Sep 2011 19:31:05 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZRSxs1QTLrhQ for ; Mon, 5 Sep 2011 19:31:04 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail.mleia.com (li271-223.members.linode.com [178.79.152.223]) by theia.denx.de (Postfix) with ESMTPS id 0BE07280A8 for ; Mon, 5 Sep 2011 19:31:01 +0200 (CEST) From: Vladimir Zapolskiy To: u-boot@lists.denx.de Date: Mon, 5 Sep 2011 20:24:08 +0300 Message-Id: <1315243448-29959-3-git-send-email-vz@mleia.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1315243448-29959-1-git-send-email-vz@mleia.com> References: <1315243448-29959-1-git-send-email-vz@mleia.com> Subject: [U-Boot] [PATCH 2/2] phylib: remove a couple of redundant code lines X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This change slightly improves readability of the phydev speed/duplex assignment logic. Signed-off-by: Vladimir Zapolskiy Acked-by: Detlev Zundel --- drivers/net/phy/phy.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 8da7688..833a051 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -318,13 +318,10 @@ static int genphy_parse_link(struct phy_device *phydev) lpa = phy_read(phydev, MDIO_DEVAD_NONE, MII_ADVERTISE); lpa &= phy_read(phydev, MDIO_DEVAD_NONE, MII_LPA); - if (lpa & (LPA_100FULL | LPA_100HALF)) { + if (lpa & (LPA_100FULL | LPA_100HALF)) phydev->speed = SPEED_100; - if (lpa & LPA_100FULL) - phydev->duplex = DUPLEX_FULL; - - } else if (lpa & LPA_10FULL) + if (lpa & (LPA_100FULL | LPA_10FULL)) phydev->duplex = DUPLEX_FULL; } else { u32 bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);