summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorIyappan Subramanian <isubramanian@apm.com>2017-05-18 15:13:43 -0700
committerBen Hutchings <ben@decadent.org.uk>2018-03-03 15:52:12 +0000
commitd95ab6c5767f0d172e0a2416819bfc4ac01bc4eb (patch)
tree5266b871cc58a25ed7ff846ed33aeb2a424f1612 /include/linux
parent8c491f23b547f3b0bd30593eeac1d8e9c4a5c705 (diff)
phy: Add helper function to check phy interface mode
commit 32d0f7830d9be5b1652a718e050d808b4908155f upstream. 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 <isubramanian@apm.com> Suggested-by: Florian Fainelli <f.fainelli@gmail.com> Suggested-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/phy.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 283cebb80443..fd51385d7541 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -630,14 +630,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);
}
/**