summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-08-30 07:47:53 +0200
committerThomas Haller <thaller@redhat.com>2019-09-22 16:05:50 +0200
commitd6df0339ff3d3129d0a36d2d82bef82a3088cb38 (patch)
tree4610809646815e2ccb3568d825840fe028cd6711
parentf796be3d7dcda422fd56fddf5d721f99e7e7a871 (diff)
downloadNetworkManager-d6df0339ff3d3129d0a36d2d82bef82a3088cb38.tar.gz
wwan: simplify API of nm_modem_act_stage2_config() to never fail
The previous function arguments of nm_modem_act_stage2_config() act as if the function could fail or even postpone the action. It never did. We cannot treat this generic. A caller needs to know whether nm_modem_act_stage2_config() can postpone the action, and when it does, which signal is emitted upon completion. That is, the caller needs to know how to proceed after postponing. In other words, since this function currently cannot fail or postpone the stage, so must all callers already rely on that. At this point it makes no sense to pretend that the function could be any different, if all callers assume it is not. Simplify the API.
-rw-r--r--src/devices/bluetooth/nm-device-bt.c20
-rw-r--r--src/devices/wwan/nm-device-modem.c7
-rw-r--r--src/devices/wwan/nm-modem.c8
-rw-r--r--src/devices/wwan/nm-modem.h4
4 files changed, 7 insertions, 32 deletions
diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c
index 1511f42188..e904fd44ea 100644
--- a/src/devices/bluetooth/nm-device-bt.c
+++ b/src/devices/bluetooth/nm-device-bt.c
@@ -459,25 +459,9 @@ modem_prepare_result (NMModem *modem,
g_return_if_fail (state == NM_DEVICE_STATE_CONFIG || state == NM_DEVICE_STATE_NEED_AUTH);
if (success) {
- NMActRequest *req;
- NMActStageReturn ret;
- NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
+ nm_modem_act_stage2_config (modem);
- req = nm_device_get_act_request (device);
- g_return_if_fail (req);
-
- ret = nm_modem_act_stage2_config (modem, req, &failure_reason);
- switch (ret) {
- case NM_ACT_STAGE_RETURN_POSTPONE:
- break;
- case NM_ACT_STAGE_RETURN_SUCCESS:
- nm_device_activate_schedule_stage3_ip_config_start (device);
- break;
- case NM_ACT_STAGE_RETURN_FAILURE:
- default:
- nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, failure_reason);
- break;
- }
+ nm_device_activate_schedule_stage3_ip_config_start (device);
} else {
if (nm_device_state_reason_check (reason) == NM_DEVICE_STATE_REASON_SIM_PIN_INCORRECT) {
/* If the connect failed because the SIM PIN was wrong don't allow
diff --git a/src/devices/wwan/nm-device-modem.c b/src/devices/wwan/nm-device-modem.c
index b380612f63..e81115ca3d 100644
--- a/src/devices/wwan/nm-device-modem.c
+++ b/src/devices/wwan/nm-device-modem.c
@@ -605,12 +605,9 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
static NMActStageReturn
act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
{
- NMActRequest *req;
+ nm_modem_act_stage2_config (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem);
- req = nm_device_get_act_request (device);
- g_return_val_if_fail (req, NM_ACT_STAGE_RETURN_FAILURE);
-
- return nm_modem_act_stage2_config (NM_DEVICE_MODEM_GET_PRIVATE (device)->modem, req, out_failure_reason);
+ return NM_ACT_STAGE_RETURN_SUCCESS;
}
static NMActStageReturn
diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c
index e8109628b3..32490da1a6 100644
--- a/src/devices/wwan/nm-modem.c
+++ b/src/devices/wwan/nm-modem.c
@@ -1063,10 +1063,8 @@ nm_modem_act_stage1_prepare (NMModem *self,
/*****************************************************************************/
-NMActStageReturn
-nm_modem_act_stage2_config (NMModem *self,
- NMActRequest *req,
- NMDeviceStateReason *out_failure_reason)
+void
+nm_modem_act_stage2_config (NMModem *self)
{
NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
@@ -1074,8 +1072,6 @@ nm_modem_act_stage2_config (NMModem *self,
* already if we get here.
*/
priv->secrets_tries = 0;
-
- return NM_ACT_STAGE_RETURN_SUCCESS;
}
/*****************************************************************************/
diff --git a/src/devices/wwan/nm-modem.h b/src/devices/wwan/nm-modem.h
index 5541c9363b..37f8b42fe9 100644
--- a/src/devices/wwan/nm-modem.h
+++ b/src/devices/wwan/nm-modem.h
@@ -213,9 +213,7 @@ NMActStageReturn nm_modem_act_stage1_prepare (NMModem *modem,
NMActRequest *req,
NMDeviceStateReason *out_failure_reason);
-NMActStageReturn nm_modem_act_stage2_config (NMModem *modem,
- NMActRequest *req,
- NMDeviceStateReason *out_failure_reason);
+void nm_modem_act_stage2_config (NMModem *modem);
NMActStageReturn nm_modem_stage3_ip4_config_start (NMModem *modem,
NMDevice *device,