net: phy: add helpers for comparing phy IDs
authorRussell King <rmk+kernel@armlinux.org.uk>
Fri, 19 May 2023 13:03:59 +0000 (14:03 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 May 2023 10:21:48 +0000 (11:21 +0100)
commit4b159f5048b90844679dad08afb3240c1957aba1
tree51ccfbf4150eb0ed08c0ce77ef33c28591b0355d
parent8b6b7c1190c3da1137d320c3de5e8d7f69baba5b
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>
drivers/net/phy/micrel.c
drivers/net/phy/phy_device.c
drivers/net/phy/phylink.c
include/linux/phy.h