diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2023-05-19 14:03:59 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-05-22 11:21:48 +0100 |
commit | 4b159f5048b90844679dad08afb3240c1957aba1 (patch) | |
tree | 51ccfbf4150eb0ed08c0ce77ef33c28591b0355d /drivers/net/phy/phylink.c | |
parent | 8b6b7c1190c3da1137d320c3de5e8d7f69baba5b (diff) |
net: phy: add helpers for comparing phy IDs
There are several places which open code comparing PHY IDs. Provide a
couple of helpers to assist with this, using a slightly simpler test
than the original:
- phy_id_compare() compares two arbitary PHY IDs and a mask of the
significant bits in the ID.
- phydev_id_compare() compares the bound phydev with the specified
PHY ID, using the bound driver's mask.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/phylink.c')
-rw-r--r-- | drivers/net/phy/phylink.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index f2106d17847a..a4dd5197355a 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -3151,8 +3151,8 @@ static void phylink_sfp_link_up(void *upstream) */ static bool phylink_phy_no_inband(struct phy_device *phy) { - return phy->is_c45 && - (phy->c45_ids.device_ids[1] & 0xfffffff0) == 0xae025150; + return phy->is_c45 && phy_id_compare(phy->c45_ids.device_ids[1], + 0xae025150, 0xfffffff0); } static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy) |