From a72350c4da4a13cb1103e989110115ba5d61b225 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 3 May 2015 10:02:29 +0200 Subject: [PATCH] platform/trivial: move ethtool_supports_carrier_detect() code (cherry picked from commit 2b8f3331d76497433b761bfa1c15640de28692f5) --- src/platform/nm-linux-platform.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index a991c8648e..1b83765de0 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -480,6 +480,18 @@ ethtool_get_permanent_address (const char *ifname, return TRUE; } +static gboolean +ethtool_supports_carrier_detect (const char *ifname) +{ + struct ethtool_cmd edata = { .cmd = ETHTOOL_GLINK }; + + /* We ignore the result. If the ETHTOOL_GLINK call succeeded, then we + * assume the device supports carrier-detect, otherwise we assume it + * doesn't. + */ + return ethtool_get (ifname, &edata); +} + /****************************************************************** * NMPlatform types and functions ******************************************************************/ @@ -2701,18 +2713,6 @@ link_set_user_ipv6ll_enabled (NMPlatform *platform, int ifindex, gboolean enable return FALSE; } -static gboolean -supports_ethtool_carrier_detect (const char *ifname) -{ - struct ethtool_cmd edata = { .cmd = ETHTOOL_GLINK }; - - /* We ignore the result. If the ETHTOOL_GLINK call succeeded, then we - * assume the device supports carrier-detect, otherwise we assume it - * doesn't. - */ - return ethtool_get (ifname, &edata); -} - static gboolean supports_mii_carrier_detect (const char *ifname) { @@ -2765,7 +2765,7 @@ link_supports_carrier_detect (NMPlatform *platform, int ifindex) * us whether the device actually supports carrier detection in the first * place. We assume any device that does implements one of these two APIs. */ - return supports_ethtool_carrier_detect (name) || supports_mii_carrier_detect (name); + return ethtool_supports_carrier_detect (name) || supports_mii_carrier_detect (name); } static gboolean