summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAki Niemi <aki.niemi@nokia.com>2010-11-18 14:11:30 +0200
committerAki Niemi <aki.niemi@nokia.com>2010-12-22 17:13:47 +0200
commitd365237a65befb2b6df22b171ae76f88c9fdcdab (patch)
treec04eea9b2c21a63156ac3c3b2442d29c5bf99f08
parent3942066eaec75abbbd1898321d24b3437a0854b4 (diff)
downloadofono-d365237a65befb2b6df22b171ae76f88c9fdcdab.tar.bz2
isimodem: Adapt and refactor ssn driver
-rw-r--r--drivers/isimodem/ssn.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/isimodem/ssn.c b/drivers/isimodem/ssn.c
index 402a48a5..747a8946 100644
--- a/drivers/isimodem/ssn.c
+++ b/drivers/isimodem/ssn.c
@@ -38,8 +38,7 @@
#include <ofono/ssn.h>
#include "isimodem.h"
-
-#define PN_SS 0x06
+#include "ss.h"
struct ssn_data {
GIsiClient *client;
@@ -48,17 +47,20 @@ struct ssn_data {
static int isi_ssn_probe(struct ofono_ssn *ssn, unsigned int vendor,
void *user)
{
- GIsiModem *idx = user;
- struct ssn_data *data = g_try_new0(struct ssn_data, 1);
+ GIsiModem *modem = user;
+ struct ssn_data *sd;
- if (data == NULL)
+ sd = g_try_new0(struct ssn_data, 1);
+ if (sd == NULL)
return -ENOMEM;
- data->client = g_isi_client_create(idx, PN_SS);
- if (data->client == NULL)
+ sd->client = g_isi_client_create(modem, PN_SS);
+ if (sd->client == NULL) {
+ g_free(sd);
return -ENOMEM;
+ }
- ofono_ssn_set_data(ssn, data);
+ ofono_ssn_set_data(ssn, sd);
return 0;
}
@@ -67,10 +69,11 @@ static void isi_ssn_remove(struct ofono_ssn *ssn)
{
struct ssn_data *data = ofono_ssn_get_data(ssn);
+ ofono_ssn_set_data(ssn, NULL);
+
if (data == NULL)
return;
- ofono_ssn_set_data(ssn, NULL);
g_isi_client_destroy(data->client);
g_free(data);
}