Open Source Telephony
 help / color / mirror / Atom feed
From: Brian Ruptash <bruptash@gmail.com>
To: ofono@ofono.org
Subject: [PATCH] gprs: Correctly set driver_attached
Date: Wed, 09 Apr 2014 12:13:44 +0200	[thread overview]
Message-ID: <1397038424-3410-1-git-send-email-bruptash@gmail.com> (raw)

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

It seems to me gprs->driver_attached must always be set prior to
calling gprs->driver->set_attached(), since if set_attached() fails the
callback inverts driver_attached to revert to its prior state.
---
 src/gprs.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gprs.c b/src/gprs.c
index e379f7b..6fffe73 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1593,8 +1593,8 @@ static void gprs_netreg_update(struct ofono_gprs *gprs)
 
 	gprs->flags |= GPRS_FLAG_ATTACHING;
 
-	gprs->driver->set_attached(gprs, attach, gprs_attach_callback, gprs);
 	gprs->driver_attached = attach;
+	gprs->driver->set_attached(gprs, attach, gprs_attach_callback, gprs);
 }
 
 static void netreg_status_changed(int status, int lac, int ci, int tech,
@@ -2178,6 +2178,8 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)
 
 detach:
 	gprs->flags |= GPRS_FLAG_ATTACHING;
+
+	gprs->driver_attached = FALSE;
 	gprs->driver->set_attached(gprs, FALSE, gprs_attach_callback, gprs);
 }
 
-- 
1.7.9.5


                 reply	other threads:[~2014-04-09 10:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1397038424-3410-1-git-send-email-bruptash@gmail.com \
    --to=bruptash@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox