提交 32d0f783 编写于 作者: I Iyappan Subramanian 提交者: David S. Miller

phy: Add helper function to check phy interface mode

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: NIyappan Subramanian <isubramanian@apm.com>
Suggested-by: NFlorian Fainelli <f.fainelli@gmail.com>
Suggested-by: NAndrew Lunn <andrew@lunn.ch>
Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5d65a16a
...@@ -715,6 +715,17 @@ static inline bool phy_is_internal(struct phy_device *phydev) ...@@ -715,6 +715,17 @@ static inline bool phy_is_internal(struct phy_device *phydev)
return phydev->is_internal; return phydev->is_internal;
} }
/**
* 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 * phy_interface_is_rgmii - Convenience function for testing if a PHY interface
* is RGMII (all variants) * is RGMII (all variants)
...@@ -722,8 +733,7 @@ static inline bool phy_is_internal(struct phy_device *phydev) ...@@ -722,8 +733,7 @@ static inline bool phy_is_internal(struct phy_device *phydev)
*/ */
static inline bool phy_interface_is_rgmii(struct phy_device *phydev) static inline bool phy_interface_is_rgmii(struct phy_device *phydev)
{ {
return phydev->interface >= PHY_INTERFACE_MODE_RGMII && return phy_interface_mode_is_rgmii(phydev->interface);
phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID;
}; };
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册