All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix Let data device be optional for mbm driver
@ 2010-04-16  5:33 Zhenhua Zhang
  2010-04-16 14:52 ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Zhenhua Zhang @ 2010-04-16  5:33 UTC (permalink / raw)
  To: ofono

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

Dell 5530 modem has no data device port. So data device should be
optional in mbm drvier.
---
 plugins/mbm.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/plugins/mbm.c b/plugins/mbm.c
index 439d3b9..aeea81d 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -84,7 +84,9 @@ static void mbm_remove(struct ofono_modem *modem)
 
 	ofono_modem_set_data(modem, NULL);
 
-	g_at_chat_unref(data->data_port);
+	if (data->data_port)
+		g_at_chat_unref(data->data_port);
+
 	g_at_chat_unref(data->modem_port);
 	g_free(data);
 }
@@ -212,7 +214,7 @@ static int mbm_enable(struct ofono_modem *modem)
 
 	DBG("%s, %s", modem_dev, data_dev);
 
-	if (modem_dev == NULL || data_dev == NULL)
+	if (modem_dev == NULL)
 		return -EINVAL;
 
 	data->modem_port = create_port(modem_dev);
@@ -223,6 +225,9 @@ static int mbm_enable(struct ofono_modem *modem)
 	if (getenv("OFONO_AT_DEBUG"))
 		g_at_chat_set_debug(data->modem_port, mbm_debug, "Modem:");
 
+	if (!data_dev)
+		goto done;
+
 	data->data_port = create_port(data_dev);
 
 	if (data->data_port == NULL) {
@@ -235,6 +240,7 @@ static int mbm_enable(struct ofono_modem *modem)
 	if (getenv("OFONO_AT_DEBUG"))
 		g_at_chat_set_debug(data->data_port, mbm_debug, "Data:");
 
+done:
 	g_at_chat_register(data->modem_port, "*EMRDY:", emrdy_notifier,
 					FALSE, modem, NULL);
 
@@ -257,9 +263,11 @@ static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data)
 	g_at_chat_unref(data->modem_port);
 	data->modem_port = NULL;
 
-	g_at_chat_shutdown(data->data_port);
-	g_at_chat_unref(data->data_port);
-	data->data_port = NULL;
+	if (data->data_port) {
+		g_at_chat_shutdown(data->data_port);
+		g_at_chat_unref(data->data_port);
+		data->data_port = NULL;
+	}
 
 	if (ok)
 		ofono_modem_set_powered(modem, FALSE);
-- 
1.6.6.1


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

end of thread, other threads:[~2010-04-21 17:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-16  5:33 [PATCH] Fix Let data device be optional for mbm driver Zhenhua Zhang
2010-04-16 14:52 ` Marcel Holtmann
2010-04-19  1:53   ` Zhenhua Zhang
2010-04-21 17:49     ` Denis Kenzior
2010-04-19  7:11   ` Vdovichev Alexander

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.