All of lore.kernel.org
 help / color / mirror / Atom feed
* [gisi-notify-fix PATCH 0/4]
@ 2011-01-12 19:24 Pekka.Pessi
  2011-01-12 19:24 ` [gisi-notify-fix PATCH 1/4] gisi: remove before notify Pekka.Pessi
  0 siblings, 1 reply; 9+ messages in thread
From: Pekka.Pessi @ 2011-01-12 19:24 UTC (permalink / raw)
  To: ofono

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

Hi Aki,

Here are patches simplifying the gisi client/server implementation and
also making it more robust.

--Pekka


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

* [gisi-notify-fix PATCH 1/4] gisi: remove before notify
  2011-01-12 19:24 [gisi-notify-fix PATCH 0/4] Pekka.Pessi
@ 2011-01-12 19:24 ` Pekka.Pessi
  2011-01-12 19:24   ` [gisi-notify-fix PATCH 2/4] gisi: simplify handling of pending Pekka.Pessi
  2011-01-18 20:30   ` [gisi-notify-fix PATCH 1/4] gisi: remove before notify Aki Niemi
  0 siblings, 2 replies; 9+ messages in thread
From: Pekka.Pessi @ 2011-01-12 19:24 UTC (permalink / raw)
  To: ofono

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

From: Pekka Pessi <Pekka.Pessi@nokia.com>

Just in case, remove pending operations before calling notifys.
The notify function can remove client, service or modem.
---
 gisi/client.c |    6 ++--
 gisi/modem.c  |   71 +++++++++++++++++++++++++++++++++++++--------------------
 2 files changed, 49 insertions(+), 28 deletions(-)

diff --git a/gisi/client.c b/gisi/client.c
index 03ed5de..85e1fa7 100644
--- a/gisi/client.c
+++ b/gisi/client.c
@@ -66,11 +66,11 @@ static void pending_resp_notify(const GIsiMessage *msg, void *data)
 	if (pd == NULL)
 		return;
 
-	if (pd->notify != NULL)
-		pd->notify(msg, pd->data);
-
 	pd->client->pending = g_slist_remove(pd->client->pending,
 						g_isi_pending_from_msg(msg));
+
+	if (pd->notify != NULL)
+		pd->notify(msg, pd->data);
 }
 
 static void pending_notify(const GIsiMessage *msg, void *data)
diff --git a/gisi/modem.c b/gisi/modem.c
index 0682666..14827d8 100644
--- a/gisi/modem.c
+++ b/gisi/modem.c
@@ -155,9 +155,41 @@ static void pending_dispatch(GIsiPending *pend, GIsiMessage *msg)
 		g_isi_msg_resource(msg), g_isi_msg_id(msg),
 		g_isi_msg_utid(msg));
 
+	msg->private = pend;
+
 	pend->notify(msg, pend->data);
 }
 
+static void pending_remove_and_dispatch(GIsiPending *op, GIsiMessage *msg)
+{
+	GIsiModem *modem;
+
+	op->service->pending = g_slist_remove(op->service->pending, op);
+
+	if (op->notify == NULL || msg == NULL)
+		goto destroy;
+
+	modem = op->service->modem;
+
+	ISIDBG(modem, "%s %s to %p [res=0x%02X, id=0x%02X, utid=0x%02X]",
+		g_isi_msg_strerror(msg), pend_type_to_str(op->type), op,
+		g_isi_msg_resource(msg), g_isi_msg_id(msg),
+		g_isi_msg_utid(msg));
+
+	msg->private = op;
+
+	op->notify(msg, op->data);
+
+destroy:
+	if (op->timeout > 0)
+		g_source_remove(op->timeout);
+
+	if (op->destroy != NULL)
+		op->destroy(op->data);
+
+	g_free(op);
+}
+
 static void service_dispatch(GIsiServiceMux *mux, GIsiMessage *msg,
 				gboolean is_indication)
 {
@@ -169,7 +201,6 @@ static void service_dispatch(GIsiServiceMux *mux, GIsiMessage *msg,
 	while (l != NULL) {
 		GSList *next = l->next;
 		GIsiPending *pend = l->data;
-		msg->private = pend;
 
 		/*
 		 * REQs, NTFs and INDs are dispatched on message ID.  While
@@ -192,24 +223,18 @@ static void service_dispatch(GIsiServiceMux *mux, GIsiMessage *msg,
 			pending_dispatch(pend, msg);
 
 		} else if (pend->type == GISI_MESSAGE_TYPE_RESP &&
-				!is_indication && pend->utid == utid) {
+				 !is_indication && pend->utid == utid) {
 
-			pending_dispatch(pend, msg);
-			pend->notify = NULL;
-
-			g_isi_pending_remove(pend);
+			pending_remove_and_dispatch(pend, msg);
 			break;
 
 		} else if (pend->type == GISI_MESSAGE_TYPE_COMMON &&
 				msgid == COMMON_MESSAGE &&
 				pend->msgid == COMM_ISI_VERSION_GET_REQ) {
 
-			pending_dispatch(pend, msg);
-			pend->notify = NULL;
-
-			g_isi_pending_remove(pend);
-
+			pending_remove_and_dispatch(pend, msg);
 		}
+
 		l = next;
 	}
 }
@@ -634,16 +659,15 @@ static void vtrace(struct sockaddr_pn *dst,
 
 static gboolean resp_timeout(gpointer data)
 {
-	GIsiPending *resp = data;
+	GIsiPending *op = data;
 	GIsiMessage msg = {
 		.error = ETIMEDOUT,
-		.private = resp,
 	};
 
-	pending_dispatch(resp, &msg);
-	resp->notify = NULL;
+	op->timeout = 0;
+
+	pending_remove_and_dispatch(op, &msg);
 
-	g_isi_pending_remove(resp);
 	return FALSE;
 }
 
@@ -755,8 +779,6 @@ void g_isi_pending_remove(GIsiPending *op)
 	if (op == NULL)
 		return;
 
-	op->service->pending = g_slist_remove(op->service->pending, op);
-
 	if (op->type == GISI_MESSAGE_TYPE_IND)
 		service_subs_decr(op->service);
 
@@ -766,12 +788,14 @@ void g_isi_pending_remove(GIsiPending *op)
 	if (op->type == GISI_MESSAGE_TYPE_RESP && op->notify != NULL) {
 		GIsiMessage msg = {
 			.error = ESHUTDOWN,
-			.private = op,
 		};
-		op->notify(&msg, op->data);
-		op->notify = NULL;
+
+		pending_remove_and_dispatch(op, &msg);
+		return;
 	}
 
+	op->service->pending = g_slist_remove(op->service->pending, op);
+
 	pending_destroy(op, NULL);
 }
 
@@ -1045,14 +1069,11 @@ static gboolean reachable_notify(gpointer data)
 	};
 	GIsiMessage msg = {
 		.version = &mux->version,
-		.private = pong,
 		.addr = &addr,
 	};
 
-	pending_dispatch(pong, &msg);
-	pong->notify = NULL;
+	pending_remove_and_dispatch(pong, &msg);
 
-	g_isi_pending_remove(pong);
 	return FALSE;
 }
 
-- 
1.7.1


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

* [gisi-notify-fix PATCH 2/4] gisi: simplify handling of pending
  2011-01-12 19:24 ` [gisi-notify-fix PATCH 1/4] gisi: remove before notify Pekka.Pessi
@ 2011-01-12 19:24   ` Pekka.Pessi
  2011-01-12 19:24     ` [gisi-notify-fix PATCH 3/4] gisi: remove g_isi_pending_from_msg() Pekka.Pessi
  2011-01-18 20:31     ` [gisi-notify-fix PATCH 2/4] gisi: simplify handling of pending Aki Niemi
  2011-01-18 20:30   ` [gisi-notify-fix PATCH 1/4] gisi: remove before notify Aki Niemi
  1 sibling, 2 replies; 9+ messages in thread
From: Pekka.Pessi @ 2011-01-12 19:24 UTC (permalink / raw)
  To: ofono

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

From: Pekka Pessi <Pekka.Pessi@nokia.com>

Client or server mark their pending objects with g_isi_pending_own().

The g_isi_remove_all_my_pending() is used to remove pending objects by
client or server when they get destroyed or reset.
---
 gisi/client.c |  199 ++++++++++-----------------------------------------------
 gisi/modem.c  |   52 +++++++++++++--
 gisi/modem.h  |    4 +-
 gisi/server.c |   73 ++-------------------
 4 files changed, 88 insertions(+), 240 deletions(-)

diff --git a/gisi/client.c b/gisi/client.c
index 85e1fa7..58fe0f3 100644
--- a/gisi/client.c
+++ b/gisi/client.c
@@ -32,58 +32,12 @@
 
 #include "client.h"
 
-struct pending_data {
-	GIsiClient *client;
-	GIsiNotifyFunc notify;
-	void *data;
-	GDestroyNotify destroy;
-};
-
 struct _GIsiClient {
 	GIsiModem *modem;
 	unsigned timeout;
 	uint8_t resource;
-	GSList *pending;
 };
 
-static void pending_destroy(gpointer data)
-{
-	struct pending_data *pd = data;
-
-	if (pd == NULL)
-		return;
-
-	if (pd->destroy != NULL)
-		pd->destroy(pd->data);
-
-	g_free(pd);
-}
-
-static void pending_resp_notify(const GIsiMessage *msg, void *data)
-{
-	struct pending_data *pd = data;
-
-	if (pd == NULL)
-		return;
-
-	pd->client->pending = g_slist_remove(pd->client->pending,
-						g_isi_pending_from_msg(msg));
-
-	if (pd->notify != NULL)
-		pd->notify(msg, pd->data);
-}
-
-static void pending_notify(const GIsiMessage *msg, void *data)
-{
-	struct pending_data *pd = data;
-
-	if (pd == NULL)
-		return;
-
-	if (pd->notify != NULL)
-		pd->notify(msg, pd->data);
-}
-
 uint8_t g_isi_client_resource(GIsiClient *client)
 {
 	return client != NULL ? client->resource : 0;
@@ -112,31 +66,13 @@ GIsiClient *g_isi_client_create(GIsiModem *modem, uint8_t resource)
 	client->timeout = G_ISI_CLIENT_DEFAULT_TIMEOUT;
 	client->resource = resource;
 	client->modem = modem;
-	client->pending = NULL;
 
 	return client;
 }
 
-static void foreach_destroy(gpointer value, gpointer user)
-{
-	GIsiPending *op = value;
-	GIsiClient *client = user;
-
-	if (op == NULL || client == NULL)
-		return;
-
-	client->pending = g_slist_remove(client->pending, op);
-	g_isi_pending_remove(op);
-}
-
 void g_isi_client_reset(GIsiClient *client)
 {
-	if (client == NULL || client->pending == NULL)
-		return;
-
-	g_slist_foreach(client->pending, foreach_destroy, client);
-	g_slist_free(client->pending);
-	client->pending = NULL;
+	g_isi_remove_all_my_pending(client->modem, client->resource, client);
 };
 
 void g_isi_client_destroy(GIsiClient *client)
@@ -156,43 +92,19 @@ void g_isi_client_set_timeout(GIsiClient *client, unsigned timeout)
 	client->timeout = timeout;
 }
 
-static struct pending_data *pending_data_create(GIsiClient *client,
-						GIsiNotifyFunc notify,
-						void *data,
-						GDestroyNotify destroy)
-{
-	struct pending_data *pd;
-
-	if (client == NULL) {
-		errno = EINVAL;
-		return NULL;
-	}
-
-	pd = g_try_new0(struct pending_data, 1);
-	if (pd == NULL) {
-		errno = ENOMEM;
-		return NULL;
-	}
-
-	pd->client = client;
-	pd->notify = notify;
-	pd->data = data;
-	pd->destroy = destroy;
-
-	return pd;
-}
-
 gboolean g_isi_client_send(GIsiClient *client,
 			const void *__restrict msg, size_t len,
 			GIsiNotifyFunc notify, void *data,
 			GDestroyNotify destroy)
 {
-	if (client == NULL)
-		return FALSE;
+	GIsiPending *op;
+
+	op = g_isi_request_send(client->modem, client->resource, msg, len,
+				client->timeout, notify, data, destroy);
 
-	return g_isi_client_send_with_timeout(client, msg, len,
-						client->timeout,
-						notify, data, destroy);
+	g_isi_pending_own(op, client);
+
+	return op != NULL;
 }
 
 gboolean g_isi_client_send_with_timeout(GIsiClient *client,
@@ -201,23 +113,14 @@ gboolean g_isi_client_send_with_timeout(GIsiClient *client,
 				GIsiNotifyFunc notify, void *data,
 				GDestroyNotify destroy)
 {
-	struct pending_data *pd;
 	GIsiPending *op;
 
-	pd = pending_data_create(client, notify, data, destroy);
-	if (pd == NULL)
-		return FALSE;
-
 	op = g_isi_request_send(client->modem, client->resource, buf, len,
-				timeout, pending_resp_notify, pd,
-				pending_destroy);
-	if (op == NULL) {
-		g_free(pd);
-		return FALSE;
-	}
+				timeout, notify, data, destroy);
+
+	g_isi_pending_own(op, client);
 
-	client->pending = g_slist_append(client->pending, op);
-	return TRUE;
+	return op != NULL;
 }
 
 gboolean g_isi_client_vsend(GIsiClient *client,
@@ -225,12 +128,14 @@ gboolean g_isi_client_vsend(GIsiClient *client,
 			GIsiNotifyFunc notify, void *data,
 			GDestroyNotify destroy)
 {
-	if (client == NULL)
-		return FALSE;
+	GIsiPending *op;
+
+	op = g_isi_request_vsend(client->modem, client->resource, iov, iovlen,
+				client->timeout, notify, data, destroy);
+
+	g_isi_pending_own(op, client);
 
-	return g_isi_client_vsend_with_timeout(client, iov, iovlen,
-						client->timeout,
-						notify, data, destroy);
+	return op != NULL;
 }
 
 gboolean g_isi_client_vsend_with_timeout(GIsiClient *client,
@@ -239,85 +144,51 @@ gboolean g_isi_client_vsend_with_timeout(GIsiClient *client,
 				GIsiNotifyFunc notify, void *data,
 				GDestroyNotify destroy)
 {
-	struct pending_data *pd;
 	GIsiPending *op;
 
-	pd = pending_data_create(client, notify, data, destroy);
-	if (pd == NULL)
-		return FALSE;
-
 	op = g_isi_request_vsend(client->modem, client->resource, iov, iovlen,
-					timeout, pending_resp_notify, pd,
-					pending_destroy);
-	if (op == NULL) {
-		g_free(pd);
-		return FALSE;
-	}
+					timeout, notify, data, destroy);
 
-	client->pending = g_slist_append(client->pending, op);
-	return TRUE;
+	g_isi_pending_own(op, client);
+
+	return op != NULL;
 }
 
 gboolean g_isi_client_ind_subscribe(GIsiClient *client, uint8_t type,
 					GIsiNotifyFunc notify, void *data)
 {
-	struct pending_data *pd;
 	GIsiPending *op;
 
-	pd = pending_data_create(client, notify, data, NULL);
-	if (pd == NULL)
-		return FALSE;
-
 	op = g_isi_ind_subscribe(client->modem, client->resource, type,
-					pending_notify, pd, pending_destroy);
-	if (op == NULL) {
-		g_free(pd);
-		return FALSE;
-	}
+					notify, data, NULL);
+
+	g_isi_pending_own(op, client);
 
-	client->pending = g_slist_append(client->pending, op);
-	return TRUE;
+	return op != NULL;
 }
 
 gboolean g_isi_client_ntf_subscribe(GIsiClient *client, uint8_t type,
 					GIsiNotifyFunc notify, void *data)
 {
-	struct pending_data *pd;
 	GIsiPending *op;
 
-	pd = pending_data_create(client, notify, data, NULL);
-	if (pd == NULL)
-		return FALSE;
-
 	op = g_isi_ntf_subscribe(client->modem, client->resource, type,
-					pending_notify, pd, pending_destroy);
-	if (op == NULL) {
-		g_free(pd);
-		return FALSE;
-	}
+					notify, data, NULL);
 
-	client->pending = g_slist_append(client->pending, op);
-	return TRUE;
+	g_isi_pending_own(op, client);
+
+	return op != NULL;
 }
 
 gboolean g_isi_client_verify(GIsiClient *client, GIsiNotifyFunc notify,
 					void *data, GDestroyNotify destroy)
 {
-	struct pending_data *pd;
 	GIsiPending *op;
 
-	pd = pending_data_create(client, notify, data, destroy);
-	if (pd == NULL)
-		return FALSE;
-
 	op = g_isi_resource_ping(client->modem, client->resource,
-					pending_resp_notify, pd,
-					pending_destroy);
-	if (op == NULL) {
-		g_free(pd);
-		return FALSE;
-	}
+					notify, data, destroy);
+
+	g_isi_pending_own(op, client);
 
-	client->pending = g_slist_append(client->pending, op);
-	return TRUE;
+	return op != NULL;
 }
diff --git a/gisi/modem.c b/gisi/modem.c
index 14827d8..ba79a31 100644
--- a/gisi/modem.c
+++ b/gisi/modem.c
@@ -73,6 +73,7 @@ struct _GIsiModem {
 struct _GIsiPending {
 	enum GIsiMessageType type;
 	GIsiServiceMux *service;
+	gpointer owner;
 	guint timeout;
 	GIsiNotifyFunc notify;
 	GDestroyNotify destroy;
@@ -774,11 +775,8 @@ GIsiPending *g_isi_pending_from_msg(const GIsiMessage *msg)
 	return msg != NULL ? msg->private : NULL;
 }
 
-void g_isi_pending_remove(GIsiPending *op)
+static void foreach_destroy(GIsiPending *op)
 {
-	if (op == NULL)
-		return;
-
 	if (op->type == GISI_MESSAGE_TYPE_IND)
 		service_subs_decr(op->service);
 
@@ -790,13 +788,53 @@ void g_isi_pending_remove(GIsiPending *op)
 			.error = ESHUTDOWN,
 		};
 
-		pending_remove_and_dispatch(op, &msg);
+		pending_dispatch(op, &msg);
+	}
+
+	pending_destroy(op, NULL);
+}
+
+void g_isi_pending_own(GIsiPending *op, gpointer owner)
+{
+	if (op == NULL)
 		return;
+
+	op->owner = owner;
+}
+
+void g_isi_remove_all_my_pending(GIsiModem *modem, uint8_t resource,
+					gpointer owner)
+{
+	GIsiServiceMux *mux;
+	GSList *l;
+	GSList *next;
+	GIsiPending *op;
+	GSList *owned = NULL;
+
+	mux = service_get(modem, resource);
+	if (mux == NULL)
+		return;
+
+	for (l = mux->pending; l != NULL; l = next) {
+		next = l->next;
+		op = l->data;
+
+		if (op->owner != owner)
+			continue;
+
+		mux->pending = g_slist_remove_link(mux->pending, l);
+
+		l->next = owned;
+		owned = l;
 	}
 
-	op->service->pending = g_slist_remove(op->service->pending, op);
+	for (l = owned; l != NULL; l = l->next) {
+		op = l->data;
 
-	pending_destroy(op, NULL);
+		foreach_destroy(op);
+	}
+
+	g_slist_free(owned);
 }
 
 GIsiPending *g_isi_ntf_subscribe(GIsiModem *modem, uint8_t resource,
diff --git a/gisi/modem.h b/gisi/modem.h
index fff1338..91fe3d0 100644
--- a/gisi/modem.h
+++ b/gisi/modem.h
@@ -109,7 +109,9 @@ int g_isi_response_vsend(GIsiModem *modem, const GIsiMessage *req,
 
 GIsiPending *g_isi_pending_from_msg(const GIsiMessage *msg);
 
-void g_isi_pending_remove(GIsiPending *operation);
+void g_isi_pending_own(GIsiPending *op, gpointer owner);
+void g_isi_remove_all_my_pending(GIsiModem *modem, uint8_t resource,
+					gpointer owner);
 
 GIsiPending *g_isi_resource_ping(GIsiModem *modem, uint8_t resource,
 					GIsiNotifyFunc notify, void *data,
diff --git a/gisi/server.c b/gisi/server.c
index e6cc9a5..bad5529 100644
--- a/gisi/server.c
+++ b/gisi/server.c
@@ -32,30 +32,12 @@
 
 #include "server.h"
 
-struct pending_data {
-	GIsiServer *server;
-	GIsiNotifyFunc notify;
-	void *data;
-};
-
 struct _GIsiServer {
 	GIsiModem *modem;
 	GIsiVersion version;
 	uint8_t resource;
-	GSList *pending;
 };
 
-static void pending_notify(const GIsiMessage *msg, void *data)
-{
-	struct pending_data *pd = data;
-
-	if (pd == NULL)
-		return;
-
-	if (pd->notify != NULL)
-		pd->notify(msg, pd->data);
-}
-
 uint8_t g_isi_server_resource(GIsiServer *server)
 {
 	return server != NULL ? server->resource : 0;
@@ -87,30 +69,17 @@ GIsiServer *g_isi_server_create(GIsiModem *modem, uint8_t resource,
 
 	server->resource = resource;
 	server->modem = modem;
-	server->pending = NULL;
 
 	return server;
 }
 
-static void foreach_destroy(gpointer value, gpointer user)
-{
-	GIsiPending *op = value;
-	GIsiServer *server = user;
-
-	if (op == NULL || server == NULL)
-		return;
-
-	server->pending = g_slist_remove(server->pending, op);
-	g_isi_pending_remove(op);
-}
-
 void g_isi_server_destroy(GIsiServer *server)
 {
 	if (server == NULL)
 		return;
 
-	g_slist_foreach(server->pending, foreach_destroy, server);
-	g_slist_free(server->pending);
+	g_isi_remove_all_my_pending(server->modem, server->resource, server);
+
 	g_free(server);
 }
 
@@ -132,47 +101,15 @@ int g_isi_server_vsend(GIsiServer *server, const GIsiMessage *req,
 	return g_isi_response_vsend(server->modem, req, iov, iovlen);
 }
 
-static struct pending_data *pending_data_create(GIsiServer *server,
-						GIsiNotifyFunc notify,
-						void *data)
-{
-	struct pending_data *pd;
-
-	if (server == NULL) {
-		errno = EINVAL;
-		return NULL;
-	}
-
-	pd = g_try_new0(struct pending_data, 1);
-	if (pd == NULL) {
-		errno = ENOMEM;
-		return NULL;
-	}
-
-	pd->server = server;
-	pd->notify = notify;
-	pd->data = data;
-
-	return pd;
-}
-
 GIsiPending *g_isi_server_handle(GIsiServer *server, uint8_t type,
 					GIsiNotifyFunc notify, void *data)
 {
-	struct pending_data *pd;
 	GIsiPending *op;
 
-	pd = pending_data_create(server, notify, data);
-	if (pd == NULL)
-		return NULL;
-
 	op = g_isi_service_bind(server->modem, server->resource, type,
-				pending_notify, pd, g_free);
-	if (op == NULL) {
-		g_free(pd);
-		return NULL;
-	}
+				notify, data, NULL);
+
+	g_isi_pending_own(op, server);
 
-	server->pending = g_slist_append(server->pending, op);
 	return op;
 }
-- 
1.7.1


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

* [gisi-notify-fix PATCH 3/4] gisi: remove g_isi_pending_from_msg()
  2011-01-12 19:24   ` [gisi-notify-fix PATCH 2/4] gisi: simplify handling of pending Pekka.Pessi
@ 2011-01-12 19:24     ` Pekka.Pessi
  2011-01-12 19:24       ` [gisi-notify-fix PATCH 4/4] isimodem: fix crash in gprs Pekka.Pessi
  2011-01-18 20:31     ` [gisi-notify-fix PATCH 2/4] gisi: simplify handling of pending Aki Niemi
  1 sibling, 1 reply; 9+ messages in thread
From: Pekka.Pessi @ 2011-01-12 19:24 UTC (permalink / raw)
  To: ofono

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

From: Pekka Pessi <Pekka.Pessi@nokia.com>

---
 gisi/modem.c |    9 ---------
 gisi/modem.h |    2 --
 2 files changed, 0 insertions(+), 11 deletions(-)

diff --git a/gisi/modem.c b/gisi/modem.c
index ba79a31..0d19acd 100644
--- a/gisi/modem.c
+++ b/gisi/modem.c
@@ -156,8 +156,6 @@ static void pending_dispatch(GIsiPending *pend, GIsiMessage *msg)
 		g_isi_msg_resource(msg), g_isi_msg_id(msg),
 		g_isi_msg_utid(msg));
 
-	msg->private = pend;
-
 	pend->notify(msg, pend->data);
 }
 
@@ -177,8 +175,6 @@ static void pending_remove_and_dispatch(GIsiPending *op, GIsiMessage *msg)
 		g_isi_msg_resource(msg), g_isi_msg_id(msg),
 		g_isi_msg_utid(msg));
 
-	msg->private = op;
-
 	op->notify(msg, op->data);
 
 destroy:
@@ -770,11 +766,6 @@ uint8_t g_isi_request_utid(GIsiPending *resp)
 	return resp != NULL ? resp->utid : 0;
 }
 
-GIsiPending *g_isi_pending_from_msg(const GIsiMessage *msg)
-{
-	return msg != NULL ? msg->private : NULL;
-}
-
 static void foreach_destroy(GIsiPending *op)
 {
 	if (op->type == GISI_MESSAGE_TYPE_IND)
diff --git a/gisi/modem.h b/gisi/modem.h
index 91fe3d0..52de7ab 100644
--- a/gisi/modem.h
+++ b/gisi/modem.h
@@ -107,8 +107,6 @@ int g_isi_response_vsend(GIsiModem *modem, const GIsiMessage *req,
 				const struct iovec *__restrict iov,
 				size_t iovlen);
 
-GIsiPending *g_isi_pending_from_msg(const GIsiMessage *msg);
-
 void g_isi_pending_own(GIsiPending *op, gpointer owner);
 void g_isi_remove_all_my_pending(GIsiModem *modem, uint8_t resource,
 					gpointer owner);
-- 
1.7.1


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

* [gisi-notify-fix PATCH 4/4] isimodem: fix crash in gprs
  2011-01-12 19:24     ` [gisi-notify-fix PATCH 3/4] gisi: remove g_isi_pending_from_msg() Pekka.Pessi
@ 2011-01-12 19:24       ` Pekka.Pessi
  2011-01-18 20:31         ` Aki Niemi
  0 siblings, 1 reply; 9+ messages in thread
From: Pekka.Pessi @ 2011-01-12 19:24 UTC (permalink / raw)
  To: ofono

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

From: Pekka Pessi <Pekka.Pessi@nokia.com>

There was a crash if gprs was removed while creating context.
---
 drivers/isimodem/gprs.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/isimodem/gprs.c b/drivers/isimodem/gprs.c
index e614ac9..1550f24 100644
--- a/drivers/isimodem/gprs.c
+++ b/drivers/isimodem/gprs.c
@@ -199,6 +199,9 @@ static void info_pp_read_resp_cb(const GIsiMessage *msg, void *opaque)
 	uint8_t count = GPDS_MAX_CONTEXT_COUNT;
 	GIsiSubBlockIter iter;
 
+	if (g_isi_msg_error(msg) == -ESHUTDOWN)
+		return;
+
 	if (g_isi_msg_error(msg) < 0)
 		goto out;
 
-- 
1.7.1


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

* Re: [gisi-notify-fix PATCH 1/4] gisi: remove before notify
  2011-01-12 19:24 ` [gisi-notify-fix PATCH 1/4] gisi: remove before notify Pekka.Pessi
  2011-01-12 19:24   ` [gisi-notify-fix PATCH 2/4] gisi: simplify handling of pending Pekka.Pessi
@ 2011-01-18 20:30   ` Aki Niemi
  1 sibling, 0 replies; 9+ messages in thread
From: Aki Niemi @ 2011-01-18 20:30 UTC (permalink / raw)
  To: ofono

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

Hi Pekka,

2011/1/12  <Pekka.Pessi@nokia.com>:
> @@ -192,24 +223,18 @@ static void service_dispatch(GIsiServiceMux *mux, GIsiMessage *msg,
>                        pending_dispatch(pend, msg);
>
>                } else if (pend->type == GISI_MESSAGE_TYPE_RESP &&
> -                               !is_indication && pend->utid == utid) {
> +                                !is_indication && pend->utid == utid) {

The rest looked good, so I amended this extra space that had jumped in
here, and pushed. Thanks.

Cheers,
Aki

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

* Re: [gisi-notify-fix PATCH 2/4] gisi: simplify handling of pending
  2011-01-12 19:24   ` [gisi-notify-fix PATCH 2/4] gisi: simplify handling of pending Pekka.Pessi
  2011-01-12 19:24     ` [gisi-notify-fix PATCH 3/4] gisi: remove g_isi_pending_from_msg() Pekka.Pessi
@ 2011-01-18 20:31     ` Aki Niemi
  2011-01-18 20:54       ` Pekka Pessi
  1 sibling, 1 reply; 9+ messages in thread
From: Aki Niemi @ 2011-01-18 20:31 UTC (permalink / raw)
  To: ofono

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

Hi Pekka,

2011/1/12  <Pekka.Pessi@nokia.com>:
> diff --git a/gisi/modem.h b/gisi/modem.h
> index fff1338..91fe3d0 100644
> --- a/gisi/modem.h
> +++ b/gisi/modem.h
> @@ -109,7 +109,9 @@ int g_isi_response_vsend(GIsiModem *modem, const GIsiMessage *req,
>
>  GIsiPending *g_isi_pending_from_msg(const GIsiMessage *msg);
>
> -void g_isi_pending_remove(GIsiPending *operation);
> +void g_isi_pending_own(GIsiPending *op, gpointer owner);
> +void g_isi_remove_all_my_pending(GIsiModem *modem, uint8_t resource,
> +                                       gpointer owner);

Overall, I like the idea.

But how about naming these a bit better? Something like
g_isi_pending_set_owner() and g_isi_pending_remove_by_owner()?

Cheers,
Aki

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

* Re: [gisi-notify-fix PATCH 4/4] isimodem: fix crash in gprs
  2011-01-12 19:24       ` [gisi-notify-fix PATCH 4/4] isimodem: fix crash in gprs Pekka.Pessi
@ 2011-01-18 20:31         ` Aki Niemi
  0 siblings, 0 replies; 9+ messages in thread
From: Aki Niemi @ 2011-01-18 20:31 UTC (permalink / raw)
  To: ofono

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

Hi Pekka,

2011/1/12  <Pekka.Pessi@nokia.com>:
> From: Pekka Pessi <Pekka.Pessi@nokia.com>
>
> There was a crash if gprs was removed while creating context.
> ---
>  drivers/isimodem/gprs.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)

Patch was pushed, thanks.

Cheers,
Aki

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

* Re: [gisi-notify-fix PATCH 2/4] gisi: simplify handling of pending
  2011-01-18 20:31     ` [gisi-notify-fix PATCH 2/4] gisi: simplify handling of pending Aki Niemi
@ 2011-01-18 20:54       ` Pekka Pessi
  0 siblings, 0 replies; 9+ messages in thread
From: Pekka Pessi @ 2011-01-18 20:54 UTC (permalink / raw)
  To: ofono

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

Hi,

2011/1/18 Aki Niemi <aki@protocolpolice.com>:
>> -void g_isi_pending_remove(GIsiPending *operation);
>> +void g_isi_pending_own(GIsiPending *op, gpointer owner);
>> +void g_isi_remove_all_my_pending(GIsiModem *modem, uint8_t resource,
>> +                                       gpointer owner);
>
> Overall, I like the idea.
>
> But how about naming these a bit better? Something like
> g_isi_pending_set_owner() and g_isi_pending_remove_by_owner()?

Sounds better. I'll do that, and I think I also leave the
g_isi_pending_remove() as an added bonus. Just in case.

-- 
Pekka.Pessi mail at nokia.com

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

end of thread, other threads:[~2011-01-18 20:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-12 19:24 [gisi-notify-fix PATCH 0/4] Pekka.Pessi
2011-01-12 19:24 ` [gisi-notify-fix PATCH 1/4] gisi: remove before notify Pekka.Pessi
2011-01-12 19:24   ` [gisi-notify-fix PATCH 2/4] gisi: simplify handling of pending Pekka.Pessi
2011-01-12 19:24     ` [gisi-notify-fix PATCH 3/4] gisi: remove g_isi_pending_from_msg() Pekka.Pessi
2011-01-12 19:24       ` [gisi-notify-fix PATCH 4/4] isimodem: fix crash in gprs Pekka.Pessi
2011-01-18 20:31         ` Aki Niemi
2011-01-18 20:31     ` [gisi-notify-fix PATCH 2/4] gisi: simplify handling of pending Aki Niemi
2011-01-18 20:54       ` Pekka Pessi
2011-01-18 20:30   ` [gisi-notify-fix PATCH 1/4] gisi: remove before notify Aki Niemi

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.