aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2019-04-13 20:53:43 +0200
committerDavid S. Miller <davem@davemloft.net>2019-04-14 13:37:06 -0700
commitc6576bfe2f4baa6cbbcd50a4dcd17e843e28fcd7 (patch)
treeca3e7147f9ecf0ed05d5afbc3fa9597cc4766fa2 /drivers/net/phy
parentnet: phy: add support for new modes in phylib (diff)
downloadlinux-dev-c6576bfe2f4baa6cbbcd50a4dcd17e843e28fcd7.tar.xz
linux-dev-c6576bfe2f4baa6cbbcd50a4dcd17e843e28fcd7.zip
phy: warn if phylib and ethtool PHY mode definitions are out of sync
If new PHY modes are added people may miss to update all relevant places in the kernel. Therefore add a build bug check for new modes in enum ethtool_link_mode_bit_indices that haven't been added to phylib yet. Suggested-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/phy-core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
index 2366d720ffd7..12ce671020a5 100644
--- a/drivers/net/phy/phy-core.c
+++ b/drivers/net/phy/phy-core.c
@@ -8,6 +8,11 @@
const char *phy_speed_to_str(int speed)
{
+ BUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 67,
+ "Enum ethtool_link_mode_bit_indices and phylib are out of sync. "
+ "If a speed or mode has been added please update phy_speed_to_str "
+ "and the PHY settings array.\n");
+
switch (speed) {
case SPEED_10:
return "10Mbps";