summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-09-21 16:48:50 +0200
committerThomas Haller <thaller@redhat.com>2015-09-21 18:25:50 +0200
commitf0ea0cd40274a7347a2c007941df02d597641e9c (patch)
treea52d2a278e4ccc6c741be1686131e1ef973bc4cb
parent4cb0ab5d29426e15cb3bdffc1efbc7cde5f6f02a (diff)
downloadNetworkManager-f0ea0cd40274a7347a2c007941df02d597641e9c.tar.gz
device: refactor beginning of _set_state_full()
- Reorder statements, to first g_return_if_fail() and log state-change. - Also log a message when leaving _set_state_full() early due to missing firmware.
-rw-r--r--src/devices/nm-device.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 32e42d571c..928481ec12 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -8727,17 +8727,20 @@ _set_state_full (NMDevice *self,
NMDeviceStateReason reason,
gboolean quitting)
{
- NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
+ NMDevicePrivate *priv;
NMDeviceState old_state;
NMActRequest *req;
gboolean no_firmware = FALSE;
NMSettingsConnection *connection;
+ g_return_if_fail (NM_IS_DEVICE (self));
+
+ priv = NM_DEVICE_GET_PRIVATE (self);
+
/* Track re-entry */
g_warn_if_fail (priv->in_state_changed == FALSE);
- priv->in_state_changed = TRUE;
- g_return_if_fail (NM_IS_DEVICE (self));
+ old_state = priv->state;
/* Do nothing if state isn't changing, but as a special case allow
* re-setting UNAVAILABLE if the device is missing firmware so that we
@@ -8745,14 +8748,16 @@ _set_state_full (NMDevice *self,
*/
if ( (priv->state == state)
&& !(state == NM_DEVICE_STATE_UNAVAILABLE && priv->firmware_missing)) {
- priv->in_state_changed = FALSE;
+ _LOGt (LOGD_DEVICE, "device state change: %s -> %s (reason '%s') [%d %d %d] (skip due to missing firmware)",
+ state_to_string (old_state),
+ state_to_string (state),
+ reason_to_string (reason),
+ old_state,
+ state,
+ reason);
return;
}
- old_state = priv->state;
- priv->state = state;
- priv->state_reason = reason;
-
_LOGI (LOGD_DEVICE, "device state change: %s -> %s (reason '%s') [%d %d %d]",
state_to_string (old_state),
state_to_string (state),
@@ -8761,6 +8766,11 @@ _set_state_full (NMDevice *self,
state,
reason);
+ priv->in_state_changed = TRUE;
+
+ priv->state = state;
+ priv->state_reason = reason;
+
/* Clear any queued transitions */
nm_device_queued_state_clear (self);