gprs: deattach driver when gprs status indicates unregistered

In the same way as we consider the driver attached when the
gprs status indicates we are registered, we should consider
it deattached when the status indicates unregistration.

If we don't, then we would not always recover from the case
when deattaching the driver fails. We would just revert back
the driver attached status to true, and "ignore" if the status
indicates the opposite when we check the registration status
afterwards.
This commit is contained in:
Richard Röjfors 2019-09-17 23:48:07 +02:00 committed by Denis Kenzior
parent f3a5016a67
commit 336a5b4274
1 changed files with 6 additions and 6 deletions

View File

@ -2568,12 +2568,6 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)
gprs->status = status;
if (status != NETWORK_REGISTRATION_STATUS_REGISTERED &&
status != NETWORK_REGISTRATION_STATUS_ROAMING) {
gprs_attached_update(gprs);
return;
}
/*
* If we're already taking action, e.g. attaching or detaching, then
* ignore this notification for now, we will take appropriate action
@ -2582,6 +2576,12 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)
if (gprs->flags & GPRS_FLAG_ATTACHING)
return;
if (status != NETWORK_REGISTRATION_STATUS_REGISTERED &&
status != NETWORK_REGISTRATION_STATUS_ROAMING) {
ofono_gprs_detached_notify(gprs);
return;
}
/* We registered without being powered */
if (gprs->powered == FALSE)
goto detach;