From patchwork Thu May 18 22:13:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iyappan Subramanian X-Patchwork-Id: 9735325 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E327C601C8 for ; Thu, 18 May 2017 22:11:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC8CF28A33 for ; Thu, 18 May 2017 22:11:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C040928A37; Thu, 18 May 2017 22:11:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 223BF28A33 for ; Thu, 18 May 2017 22:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=jfj2uqceyKm4jItBWkfpUqNKYCoFdcESO9BIfveOq/4=; b=I33ds2BDd6sR3OyNvlY1KqKifL JVk4GIG+lQsQWNUsL/pk5taD0HWqns4IR3/9ZqUwEEaq+o9Keey7LUShI/vSCwy3XgrLXJboRhziB UcsJW3JKyfwXFhc7UsJhi1jwG6McU2dlsQ892ZiGVO00z5gcnhtER/XqNxK2lRKjjiAfPscmJ1CPC YlZ1xorFaSjUNJp6ETFmTy9wxyjcZG918q5VAB0ICoJMKJtYAbsRat/DI2BwIB+CIM+XORSeRRl3r hJrLzIKOEDdd01SDGuwVAwyn0Vjmh0TZVrUv8tg6xt6U2QnjmWtZ1kvURY8o6CvUwu/XUgh8lbo4G 2SDZZdYQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dBTdq-0000R1-Mu; Thu, 18 May 2017 22:11:30 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dBTdd-0000Dx-CL for linux-arm-kernel@bombadil.infradead.org; Thu, 18 May 2017 22:11:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=o152qBVE8LD3/QtbO/Khe8gharsGtPYRzZ0X/8ucrYE=; b=we5whCdqIRU3cmRGygjY05MCR Wj/VihNvO7fVn1quj6xvm1q5hAcPlH3M1ru4k6JNQNU0GeYaI66iYIVOQ/MqBkbabr3bHY/Ujg8Pe uD+30As3lQ+BWLWAU+4IdDL7RjlLGcdvxQuWLIEA8QpOZmlUJDsBPrealWkDLD50dA5Y4bgRMzxZE nmN4Wb3SdeXHq+NRrXoRs1P870Hjvs3pNF8tOqQiLDSj3yQalp339wtYsssrrdoA5uuH12vOY2JQ7 HGdsW1vjlmP8rk+ZtA+CZS4drTWY4+oPDk3+J8+zgnf++FY/64Zzs5u4YVre1aAIeIYFFUhTPeg3+ fFmgDR5/g==; Received: from mail-pf0-x22f.google.com ([2607:f8b0:400e:c00::22f]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dBTda-0003c3-Rv for linux-arm-kernel@lists.infradead.org; Thu, 18 May 2017 22:11:16 +0000 Received: by mail-pf0-x22f.google.com with SMTP id 9so30129681pfj.1 for ; Thu, 18 May 2017 15:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o152qBVE8LD3/QtbO/Khe8gharsGtPYRzZ0X/8ucrYE=; b=S4M7QtHaX9f5STCQjZkis5i0ruLCvdpi9uqaEEEnyHJ3+DHZc77cemi+QEN0kx5XLr jn5O96Va94rjkepSerOpLV2vYp53v7C65R7CY2jhtwdvU2fNk2fBLhlHy++crN+09fdM ZxB7xS/IzP2AwRSlexyWMqU3T8dFtey+EUbz0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o152qBVE8LD3/QtbO/Khe8gharsGtPYRzZ0X/8ucrYE=; b=WukpAoxXl6r/vPCfKdndvNepLmlGCuGSCG4Qjly3/slF9heAlCVNl35F3FCFHZvNcM 8xD05jHr7H0JEdi2ilFigYJWvkAZZCjNOSIcMRk/dIFqAh6edWp7huVA+YvN0SQm6+l5 qUDF68MMRz8xeLg6Gzcpg5kJSj+pIYlOPd/k5JwoWHzqBC8BcsM9kOozK4W08vr7pykh Cqy1ErutUqlfM9GvQLhYGhPSK/ytyxNf+Qtl16TBidtk89y//dZt2fXnsFFytq7Y2nXy wDpmseZFov3PEWsrhxeDSA0ZdxcCQymtogJn8DOOU5y7czzOQi5xGyuCNQO4TgVQ6wfM 6N4A== X-Gm-Message-State: AODbwcC0TuYGiGeo+2v5hbFreL175ywW78ZruVa9WBjvhQA1cpq9wuXF Su7hbhwwsk2JEqIs X-Received: by 10.84.248.12 with SMTP id p12mr7485987pll.155.1495145450963; Thu, 18 May 2017 15:10:50 -0700 (PDT) Received: from isubrama-dev.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id e124sm11964897pfc.64.2017.05.18.15.10.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 May 2017 15:10:50 -0700 (PDT) From: Iyappan Subramanian To: davem@davemloft.net, netdev@vger.kernel.org Subject: [PATCH v2 net-next 1/2] include: linux: Add helper function to check phy interface mode Date: Thu, 18 May 2017 15:13:43 -0700 Message-Id: <1495145624-29463-2-git-send-email-isubramanian@apm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1495145624-29463-1-git-send-email-isubramanian@apm.com> References: <1495145624-29463-1-git-send-email-isubramanian@apm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170518_181115_010000_DBEDCA5D X-CRM114-Status: GOOD ( 11.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, f.fainelli@gmail.com, patches@apm.com, linux-arm-kernel@lists.infradead.org, Iyappan Subramanian MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Added helper function that checks phy_mode is RGMII (all variants) 'bool phy_interface_mode_is_rgmii(phy_interface_t mode)' Changed the following function, to use the above. 'bool phy_interface_is_rgmii(struct phy_device *phydev)' Signed-off-by: Iyappan Subramanian Suggested-by: Florian Fainelli Suggested-by: Andrew Lunn Reviewed-by: Florian Fainelli --- include/linux/phy.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/include/linux/phy.h b/include/linux/phy.h index 54ef458..5a808a2 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -716,14 +716,24 @@ static inline bool phy_is_internal(struct phy_device *phydev) } /** + * phy_interface_mode_is_rgmii - Convenience function for testing if a + * PHY interface mode is RGMII (all variants) + * @mode: the phy_interface_t enum + */ +static inline bool phy_interface_mode_is_rgmii(phy_interface_t mode) +{ + return mode >= PHY_INTERFACE_MODE_RGMII && + mode <= PHY_INTERFACE_MODE_RGMII_TXID; +}; + +/** * phy_interface_is_rgmii - Convenience function for testing if a PHY interface * is RGMII (all variants) * @phydev: the phy_device struct */ static inline bool phy_interface_is_rgmii(struct phy_device *phydev) { - return phydev->interface >= PHY_INTERFACE_MODE_RGMII && - phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID; + return phy_interface_mode_is_rgmii(phydev->interface); }; /*