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.
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user