platform/trivial: move ethtool_supports_carrier_detect() code

(cherry picked from commit 2b8f3331d7)
This commit is contained in:
Thomas Haller 2015-05-03 10:02:29 +02:00
parent 716dd795de
commit a72350c4da

View file

@ -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