Received: by 10.223.185.116 with SMTP id b49csp6396821wrg; Wed, 28 Feb 2018 08:44:01 -0800 (PST) X-Google-Smtp-Source: AH8x224vf3RwiKBl08Bt3ELHm29IyPWvcBNuAdl+x8ljd2BE5Yk4xxj4o7Tdgaecvm9yvS9zXgCB X-Received: by 2002:a17:902:e65:: with SMTP id 92-v6mr18557604plw.268.1519836241755; Wed, 28 Feb 2018 08:44:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519836241; cv=none; d=google.com; s=arc-20160816; b=S7etjDFDAuQ+CNpXywl4MKc2FgExW/mE007yxYWFfd1QURfcT++jRPLm4KPrpP1Vqz hVqAMkp7kku1Yhn8JKExT+nOmeDEqjit/Xdo8/qUSLpmJo2P11fCC7xtW2R2QDkwybc7 sfcAi9GiM7w+mrp6VX8df2tHiRx1y8kHL+HL3Ni/WKxfSXNCes8py9neNA3U9gA47qyf STWOqffKnSVFHqX8uXNc/3wMvDXIn6k8cH0ALNDwYSm0H9LVP6ZTqGl91pFSgYcQVqHX iuf0/vYCidceteJu7kJbmM5BEJgKSBsD46fWa//Gj5sv2aQp+SiBOG5u+uQdYH1Sl+tJ nsbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=OgkOgClNuPyCerLoX9ePCgnYp2ErgzH6wmxRgRml0sU=; b=E9ieHZqteS7DZ+LztpABgL2zEEc/m7TW4SxiIOOtP9kkaVxFe4lQLD7XTCZZVgEF7Q E/RZuUn2pD1HIymfmo0IHrKnSwS76aa3oYMvj/Z0O78KrwCEnU4MVnqgyG/EME1eTXo2 ux2USacQHrAACRDAsp753wMmzy2FxiBAFutUGkk8w9dRafGxXdfI0cbXqR6lr+Zn6aPu 5Cekq3ftHRBG7cmUdtG/1G5mZ/+mBZhgU8wf0mpEac5xLQlwT0Yft17kv+BrhWD74lqH hvI4lG+ZV6+CKkQfL9EDcSJ88bN1wSeuhidtXPa398/7ishprXOdUSa8ZDOEl8O2/Sxv 5Qtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s125si1220900pgc.468.2018.02.28.08.43.47; Wed, 28 Feb 2018 08:44:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932731AbeB1QDO (ORCPT + 99 others); Wed, 28 Feb 2018 11:03:14 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34745 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932224AbeB1QDM (ORCPT ); Wed, 28 Feb 2018 11:03:12 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yq-0006XP-OP; Wed, 28 Feb 2018 15:22:29 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yi-0000Ba-EL; Wed, 28 Feb 2018 15:22:20 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "David S. Miller" , "Florian Fainelli" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 165/254] net: phy: Add phy_interface_is_rgmii helper In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Florian Fainelli commit e463d88c36d42211aa72ed76d32fb8bf37820ef1 upstream. RGMII interfaces come in 4 different flavors that the PHY library needs to care about: regular RGMII (no delays), RGMII with either RX or TX delay, and both. In order to avoid errors of checking only for one type of RGMII interface and miss the 3 others, introduce a convenience function which tests for all values. Suggested-by: David S. Miller Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings --- include/linux/phy.h | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -630,6 +630,17 @@ static inline bool phy_is_internal(struc } /** + * 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; +} + +/** * phy_write_mmd - Convenience function for writing a register * on an MMD on a given PHY. * @phydev: The phy_device struct