Skip to contentSkip to conversation

Add Palm Pre plugin

PATCH In review Andrzej Zaborowski 3 participants 3 messages Nov 10, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 Add Palm Pre plugin

---
 Makefile.am         |    3 +
 plugins/modemconf.c |    3 +-
 plugins/palmpre.c   |  219 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 224 insertions(+), 1 deletions(-)
 create mode 100644 plugins/palmpre.c
Makefile.am +3 -0
index c3e06b4..0e08349 100644
@@ -168,6 +168,9 @@ builtin_sources += plugins/novatel.c
 
 builtin_modules += hfp
 builtin_sources += plugins/hfp.c
+
+builtin_modules += palmpre
+builtin_sources += plugins/palmpre.c
 endif
 
 if MAINTAINER_MODE
plugins/modemconf.c +2 -1
index 4b66590..39a62b8 100644
@@ -127,7 +127,8 @@ static struct ofono_modem *create_modem(GKeyFile *keyfile, const char *group)
 
 	if (!g_strcmp0(driver, "atgen") || !g_strcmp0(driver, "g1") ||
 						!g_strcmp0(driver, "calypso") ||
-						!g_strcmp0(driver, "hfp"))
+						!g_strcmp0(driver, "hfp") ||
+						!g_strcmp0(driver, "palmpre"))
 		set_device(modem, keyfile, group);
 
 	g_free(driver);
plugins/palmpre.c new file +219 -0

219 lines not on this page · raw message

Signature · 1 line
1.6.1
#1 lore raw

Hi Andrzej,

plugins/palmpre.c line 75

Quoted 9 lines
plugins/palmpre.c new file +9 -0
+static void palmpre_remove(struct ofono_modem *modem)
+{
+	struct palmpre_data *data = ofono_modem_get_data(modem);
+
+	DBG("%p", modem);
+
+	g_free(data);
+	ofono_modem_set_data(modem, NULL);
+}

Never ever do it this way. The set_data(..., NULL) must come before freeing the data. Otherwise it potentially opens a can of race conditions.

Regards

Marcel