All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gprs: deattach driver when gprs status indicates unregistered
@ 2019-09-17 21:48 richard.rojfors
  2019-09-17 21:56 ` Richard =?unknown-8bit?q?R=C3=B6jfors?=
  2019-09-20 14:58 ` Denis Kenzior
  0 siblings, 2 replies; 3+ messages in thread
From: richard.rojfors @ 2019-09-17 21:48 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1553 bytes --]

From: Richard Röjfors <richard@puffinpack.se>

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.
---
 src/gprs.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index de172979..c7b181f5 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -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;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-20 14:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-17 21:48 [PATCH] gprs: deattach driver when gprs status indicates unregistered richard.rojfors
2019-09-17 21:56 ` Richard =?unknown-8bit?q?R=C3=B6jfors?=
2019-09-20 14:58 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.