isimodem/ussd: use g_isi_send()
authorPekka Pessi <Pekka.Pessi@nokia.com>
Wed, 1 Sep 2010 12:03:43 +0000 (14:03 +0200)
committerAki Niemi <aki.niemi@nokia.com>
Thu, 2 Sep 2010 04:52:11 +0000 (07:52 +0300)
drivers/isimodem/ussd.c

index d164d10..330a141 100644 (file)
@@ -120,18 +120,17 @@ static gboolean ussd_send_resp_cb(GIsiClient *client,
        CALLBACK_WITH_SUCCESS(cb, cbd->data);
 
        ussd_parse(cbd->user, data, len);
-       goto out;
+       return TRUE;
 
 error:
        CALLBACK_WITH_FAILURE(cb, cbd->data);
-
-out:
-       g_free(cbd);
        return TRUE;
+
 }
 
-static GIsiRequest *ussd_send_make(GIsiClient *client, uint8_t *str,
-                                       size_t len, void *data)
+static GIsiRequest *ussd_send(GIsiClient *client,
+                               uint8_t *str, size_t len,
+                               void *data, GDestroyNotify notify)
 {
        const uint8_t msg[] = {
                SS_GSM_USSD_SEND_REQ,
@@ -149,8 +148,8 @@ static GIsiRequest *ussd_send_make(GIsiClient *client, uint8_t *str,
                { str, len }
        };
 
-       return g_isi_request_vmake(client, iov, 2, SS_TIMEOUT,
-                                       ussd_send_resp_cb, data);
+       return g_isi_vsend(client, iov, 2, SS_TIMEOUT,
+                               ussd_send_resp_cb, data, notify);
 }
 
 static void isi_request(struct ofono_ussd *ussd, const char *str,
@@ -179,7 +178,7 @@ static void isi_request(struct ofono_ussd *ussd, const char *str,
        if (written > SS_MAX_USSD_LENGTH)
                goto error;
 
-       if (ussd_send_make(ud->client, packed, num_packed, cbd))
+       if (ussd_send(ud->client, packed, num_packed, cbd, g_free))
                return;
 
 error:
@@ -202,8 +201,8 @@ static void isi_cancel(struct ofono_ussd *ussd,
        if (!cbd)
                goto error;
 
-       if (g_isi_request_make(ud->client, msg, sizeof(msg), SS_TIMEOUT,
-                               ussd_send_resp_cb, cbd))
+       if (g_isi_send(ud->client, msg, sizeof(msg), SS_TIMEOUT,
+                       ussd_send_resp_cb, cbd, g_free))
                return;
 
 error: