mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 18:28:03 +02:00
device: rename and minor refactoring of check_carrier()
The name should mirror what we already have: nm_device_set_carrier(). Also, move the code closer to nm_device_set_carrier() and refactor it a bit.
This commit is contained in:
parent
eaba285375
commit
7e472b4eb3
1 changed files with 12 additions and 11 deletions
|
|
@ -2306,6 +2306,16 @@ nm_device_set_carrier (NMDevice *self, gboolean carrier)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nm_device_set_carrier_from_platform (NMDevice *self)
|
||||||
|
{
|
||||||
|
if (!nm_device_has_capability (self, NM_DEVICE_CAP_NONSTANDARD_CARRIER)) {
|
||||||
|
nm_device_set_carrier (self,
|
||||||
|
nm_platform_link_is_connected (nm_device_get_platform (self),
|
||||||
|
nm_device_get_ip_ifindex (self)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -2883,15 +2893,6 @@ config_changed (NMConfig *config,
|
||||||
device_init_sriov_num_vfs (self);
|
device_init_sriov_num_vfs (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
check_carrier (NMDevice *self)
|
|
||||||
{
|
|
||||||
int ifindex = nm_device_get_ip_ifindex (self);
|
|
||||||
|
|
||||||
if (!nm_device_has_capability (self, NM_DEVICE_CAP_NONSTANDARD_CARRIER))
|
|
||||||
nm_device_set_carrier (self, nm_platform_link_is_connected (nm_device_get_platform (self), ifindex));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
realize_start_notify (NMDevice *self,
|
realize_start_notify (NMDevice *self,
|
||||||
const NMPlatformLink *pllink)
|
const NMPlatformLink *pllink)
|
||||||
|
|
@ -3023,7 +3024,7 @@ realize_start_setup (NMDevice *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nm_device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)) {
|
if (nm_device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)) {
|
||||||
check_carrier (self);
|
nm_device_set_carrier_from_platform (self);
|
||||||
_LOGD (LOGD_PLATFORM,
|
_LOGD (LOGD_PLATFORM,
|
||||||
"carrier is %s%s",
|
"carrier is %s%s",
|
||||||
priv->carrier ? "ON" : "OFF",
|
priv->carrier ? "ON" : "OFF",
|
||||||
|
|
@ -10287,7 +10288,7 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
|
||||||
|
|
||||||
/* Store carrier immediately. */
|
/* Store carrier immediately. */
|
||||||
if (nm_device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT))
|
if (nm_device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT))
|
||||||
check_carrier (self);
|
nm_device_set_carrier_from_platform (self);
|
||||||
|
|
||||||
device_is_up = nm_device_is_up (self);
|
device_is_up = nm_device_is_up (self);
|
||||||
if (block && !device_is_up) {
|
if (block && !device_is_up) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue