mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-01 08:00:25 +01: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.
(cherry picked from commit 7e472b4eb3)
This commit is contained in:
parent
f4600c7fa5
commit
83c2243d80
1 changed files with 12 additions and 11 deletions
|
|
@ -2303,6 +2303,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
|
||||
|
|
@ -2880,15 +2890,6 @@ config_changed (NMConfig *config,
|
|||
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
|
||||
realize_start_notify (NMDevice *self,
|
||||
const NMPlatformLink *pllink)
|
||||
|
|
@ -3020,7 +3021,7 @@ realize_start_setup (NMDevice *self,
|
|||
}
|
||||
|
||||
if (nm_device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)) {
|
||||
check_carrier (self);
|
||||
nm_device_set_carrier_from_platform (self);
|
||||
_LOGD (LOGD_PLATFORM,
|
||||
"carrier is %s%s",
|
||||
priv->carrier ? "ON" : "OFF",
|
||||
|
|
@ -10343,7 +10344,7 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
|
|||
|
||||
/* Store carrier immediately. */
|
||||
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);
|
||||
if (block && !device_is_up) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue