All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/2] atmodem: remove CGACT command
@ 2010-05-26 15:36 Kalle Valo
  2010-05-26 15:36 ` [PATCH v4 2/2] atmodem: fix crash during context deactivation Kalle Valo
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kalle Valo @ 2010-05-26 15:36 UTC (permalink / raw)
  To: ofono

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

It's enough that we shutdown PPP, no need to send CGACT after that.
Recommended by Denis.
---

 drivers/atmodem/gprs-context.c |   51 +++++++++++++---------------------------
 1 files changed, 16 insertions(+), 35 deletions(-)

diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index ba5f0c0..9b32d59 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -65,22 +65,6 @@ struct gprs_context_data {
 	void *cb_data;                                  /* Callback data */
 };
 
-static void at_cgact_down_cb(gboolean ok, GAtResult *result, gpointer user_data)
-{
-	struct cb_data *cbd = user_data;
-	ofono_gprs_context_cb_t cb = cbd->cb;
-	struct ofono_gprs_context *gc = cbd->user;
-	struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
-	struct ofono_error error;
-
-	if (ok)
-		gcd->active_context = 0;
-
-	decode_at_error(&error, g_at_result_final_response(result));
-
-	cb(&error, cbd->data);
-}
-
 static void ppp_connect(const char *interface, const char *ip,
 			const char *dns1, const char *dns2,
 			gpointer user_data)
@@ -104,13 +88,21 @@ static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
 	struct ofono_gprs_context *gc = user_data;
 	struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
 
-	if (gcd->state == STATE_ENABLING) {
+	DBG("");
+
+	switch (gcd->state) {
+	case STATE_ENABLING:
 		CALLBACK_WITH_FAILURE(gcd->up_cb, NULL, FALSE, NULL,
 					NULL, NULL, NULL, gcd->cb_data);
-		return;
+		break;
+	case STATE_DISABLING:
+		CALLBACK_WITH_SUCCESS(gcd->down_cb, gcd->cb_data);
+		break;
+	default:
+		ofono_gprs_context_deactivated(gc, gcd->active_context);
+		break;
 	}
 
-	ofono_gprs_context_deactivated(gc, gcd->active_context);
 	gcd->active_context = 0;
 	gcd->state = STATE_IDLE;
 }
@@ -227,25 +219,14 @@ static void at_gprs_deactivate_primary(struct ofono_gprs_context *gc,
 					ofono_gprs_context_cb_t cb, void *data)
 {
 	struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
-	struct cb_data *cbd = cb_data_new(cb, data);
-	char buf[64];
-
-	if (!cbd)
-		goto error;
-
-	cbd->user = gc;
 
-	snprintf(buf, sizeof(buf), "AT+CGACT=0,%u", id);
+	DBG("");
 
-	if (g_at_chat_send(gcd->chat, buf, none_prefix,
-				at_cgact_down_cb, cbd, g_free) > 0)
-		return;
-
-error:
-	if (cbd)
-		g_free(cbd);
+	gcd->state = STATE_DISABLING;
+	gcd->down_cb = cb;
+	gcd->cb_data = data;
 
-	CALLBACK_WITH_FAILURE(cb, data);
+	g_at_ppp_shutdown(gcd->ppp);
 }
 
 static int at_gprs_context_probe(struct ofono_gprs_context *gc,


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

end of thread, other threads:[~2010-05-26 17:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-26 15:36 [PATCH v4 1/2] atmodem: remove CGACT command Kalle Valo
2010-05-26 15:36 ` [PATCH v4 2/2] atmodem: fix crash during context deactivation Kalle Valo
2010-05-26 17:37   ` Denis Kenzior
2010-05-26 16:12 ` [PATCH v4 1/2] atmodem: remove CGACT command Marcel Holtmann
2010-05-26 17:35   ` Kalle Valo
2010-05-26 17:37 ` 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.