device/ethernet: refactor loading s390 subchannels during realize

Instead of overwriting constructed(), update the s390 subchannels via
realize_start_notify(). This makes more sense and is also more similar
to what other device implementations do.
This commit is contained in:
Thomas Haller 2017-01-02 16:06:51 +01:00
parent 7e4120860f
commit 0bb84d1b85

View file

@ -259,18 +259,6 @@ _update_s390_subchannels (NMDeviceEthernet *self)
_notify (self, PROP_S390_SUBCHANNELS);
}
static void
constructed (GObject *object)
{
const NMPlatformLink *pllink;
G_OBJECT_CLASS (nm_device_ethernet_parent_class)->constructed (object);
pllink = nm_platform_link_get (NM_PLATFORM_GET, nm_device_get_ifindex ((NMDevice *) object));
if (pllink && pllink->initialized)
_update_s390_subchannels ((NMDeviceEthernet *) object);
}
static void
clear_secrets_tries (NMDevice *device)
{
@ -1679,13 +1667,23 @@ carrier_changed (NMDevice *device, gboolean carrier)
}
static void
link_changed (NMDevice *device, const NMPlatformLink *pllink)
link_changed (NMDevice *device,
const NMPlatformLink *pllink)
{
NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->link_changed (device, pllink);
if (pllink->initialized)
_update_s390_subchannels ((NMDeviceEthernet *) device);
}
static void
realize_start_notify (NMDevice *device,
const NMPlatformLink *pllink)
{
NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->realize_start_notify (device, pllink);
if (pllink->initialized)
_update_s390_subchannels ((NMDeviceEthernet *) device);
}
static gboolean
is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
{
@ -1772,7 +1770,6 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_WIRED_SETTING_NAME, NM_LINK_TYPE_ETHERNET)
object_class->constructed = constructed;
object_class->dispose = dispose;
object_class->finalize = finalize;
object_class->get_property = get_property;
@ -1792,6 +1789,7 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
parent_class->update_connection = update_connection;
parent_class->carrier_changed = carrier_changed;
parent_class->link_changed = link_changed;
parent_class->realize_start_notify = realize_start_notify;
parent_class->is_available = is_available;
parent_class->state_changed = device_state_changed;