[PATCH 4/5] ofono_sim_context api header changes.

2011-01-29 Thread Andrzej Zaborowski
This patch introduces sim FS contexts which are used to queue file
read and write operations.  When a context is freed all pending
operations in that context are cancelled preventing callbacks from
being called causing segfaults.  This patch breaks the build without
patch 5/5.

ofono_sim_read/_write function names are not changed because they
seem better names than ofono_sim_context_read/_write.
---
 include/sim.h |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/sim.h b/include/sim.h
index 5e3ba5b..137e825 100644
--- a/include/sim.h
+++ b/include/sim.h
@@ -29,6 +29,7 @@ extern C {
 #include ofono/types.h
 
 struct ofono_sim;
+struct ofono_sim_context;
 
 /* 51.011 Section 9.3 */
 enum ofono_sim_file_structure {
@@ -195,6 +196,9 @@ enum ofono_sim_state ofono_sim_get_state(struct ofono_sim 
*sim);
 
 void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted);
 
+struct ofono_sim_context *ofono_sim_context_create(struct ofono_sim *sim);
+void ofono_sim_context_free(struct ofono_sim_context *context);
+
 /* This will queue an operation to read all available records with id from the
  * SIM.  Callback cb will be called every time a record has been read, or once
  * if an error has occurred.  For transparent files, the callback will only
@@ -202,16 +206,16 @@ void ofono_sim_inserted_notify(struct ofono_sim *sim, 
ofono_bool_t inserted);
  *
  * Returns 0 if the request could be queued, -1 otherwise.
  */
-int ofono_sim_read(struct ofono_sim *sim, int id,
+int ofono_sim_read(struct ofono_sim_context *context, int id,
enum ofono_sim_file_structure expected,
ofono_sim_file_read_cb_t cb, void *data);
 
-int ofono_sim_write(struct ofono_sim *sim, int id,
+int ofono_sim_write(struct ofono_sim_context *context, int id,
ofono_sim_file_write_cb_t cb,
enum ofono_sim_file_structure structure, int record,
const unsigned char *data, int length, void *userdata);
 
-int ofono_sim_read_bytes(struct ofono_sim *sim, int id,
+int ofono_sim_read_bytes(struct ofono_sim_context *context, int id,
unsigned short offset, unsigned short num_bytes,
ofono_sim_file_read_cb_t cb, void *data);
 #ifdef __cplusplus
-- 
1.7.1.86.g0e460.dirty

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 5/5] Implement ofono_sim_context api.

2011-01-29 Thread Andrzej Zaborowski
---
 src/call-forwarding.c |   20 +++--
 src/cbs.c |   14 +-
 src/message-waiting.c |   37 --
 src/network.c |   18 +++--
 src/sim.c |   82 ++-
 src/simfs.c   |  102 ++---
 src/simfs.h   |9 +++-
 src/voicecall.c   |   13 +-
 8 files changed, 225 insertions(+), 70 deletions(-)

diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index 512f223..0a7ae73 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -61,6 +61,7 @@ struct ofono_call_forwarding {
int query_end;
struct cf_ss_request *ss_req;
struct ofono_sim *sim;
+   struct ofono_sim_context *sim_context;
unsigned char cfis_record_id;
struct ofono_ussd *ussd;
unsigned int ussd_watch;
@@ -276,7 +277,7 @@ static void sim_set_cf_indicator(struct 
ofono_call_forwarding *cf)
data[3] = 128;
}
 
-   ofono_sim_write(cf-sim, SIM_EFCFIS_FILEID,
+   ofono_sim_write(cf-sim_context, SIM_EFCFIS_FILEID,
sim_cfis_update_cb,
OFONO_SIM_FILE_STRUCTURE_FIXED,
cf-cfis_record_id, data,
@@ -287,7 +288,7 @@ static void sim_set_cf_indicator(struct 
ofono_call_forwarding *cf)
if (cf-flags  CALL_FORWARDING_FLAG_CPHS_CFF) {
unsigned char cff_voice = cfu_voice ? 0x0A : 0x05;
 
-   ofono_sim_write(cf-sim, SIM_EF_CPHS_CFF_FILEID,
+   ofono_sim_write(cf-sim_context, SIM_EF_CPHS_CFF_FILEID,
sim_cphs_cff_update_cb,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
0, cff_voice, sizeof(cff_voice), cf);
@@ -1363,11 +1364,11 @@ static void sim_read_cf_indicator(struct 
ofono_call_forwarding *cf)
if (__ofono_sim_service_available(cf-sim,
SIM_UST_SERVICE_CFIS,
SIM_SST_SERVICE_CFIS) == TRUE)
-   ofono_sim_read(cf-sim, SIM_EFCFIS_FILEID,
+   ofono_sim_read(cf-sim_context, SIM_EFCFIS_FILEID,
OFONO_SIM_FILE_STRUCTURE_FIXED,
sim_cfis_read_cb, cf);
else
-   ofono_sim_read(cf-sim, SIM_EF_CPHS_CFF_FILEID,
+   ofono_sim_read(cf-sim_context, SIM_EF_CPHS_CFF_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_cphs_cff_read_cb, cf);
 }
@@ -1402,11 +1403,18 @@ static void call_forwarding_unregister(struct 
ofono_atom *atom)
g_dbus_unregister_interface(conn, path,
OFONO_CALL_FORWARDING_INTERFACE);
 
+   if (cf-sim_context) {
+   ofono_sim_context_free(cf-sim_context);
+   cf-sim_context = NULL;
+   }
+
if (cf-ussd)
cf_unregister_ss_controls(cf);
 
-   if (cf-ussd_watch)
+   if (cf-ussd_watch) {
__ofono_modem_remove_atom_watch(modem, cf-ussd_watch);
+   cf-ussd_watch = 0;
+   }
 }
 
 static void call_forwarding_remove(struct ofono_atom *atom)
@@ -1500,6 +1508,8 @@ void ofono_call_forwarding_register(struct 
ofono_call_forwarding *cf)
if (sim_atom) {
cf-sim = __ofono_atom_get_data(sim_atom);
 
+   cf-sim_context = ofono_sim_context_create(cf-sim);
+
sim_read_cf_indicator(cf);
}
 
diff --git a/src/cbs.c b/src/cbs.c
index 8e4afc1..8238043 100644
--- a/src/cbs.c
+++ b/src/cbs.c
@@ -57,6 +57,7 @@ struct ofono_cbs {
GSList *topics;
GSList *new_topics;
struct ofono_sim *sim;
+   struct ofono_sim_context *sim_context;
struct ofono_stk *stk;
struct ofono_netreg *netreg;
unsigned int netreg_watch;
@@ -605,6 +606,11 @@ static void cbs_unregister(struct ofono_atom *atom)
cbs-efcbmid_contents = NULL;
}
 
+   if (cbs-sim_context) {
+   ofono_sim_context_free(cbs-sim_context);
+   cbs-sim_context = NULL;
+   }
+
cbs-sim = NULL;
cbs-stk = NULL;
 
@@ -908,10 +914,10 @@ static void cbs_got_imsi(struct ofono_cbs *cbs)
 */
if (topics_str == NULL ||
(cbs-topics == NULL  topics_str[0] != '\0')) {
-   ofono_sim_read(cbs-sim, SIM_EFCBMI_FILEID,
+   ofono_sim_read(cbs-sim_context, SIM_EFCBMI_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
sim_cbmi_read_cb, cbs);
-   ofono_sim_read(cbs-sim, SIM_EFCBMIR_FILEID,
+   ofono_sim_read(cbs-sim_context, SIM_EFCBMIR_FILEID,
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
 

[PATCH 01/11] atutil: use g_new0 for callback data memory

2011-01-29 Thread Jeevaka Badrappan
---
 drivers/atmodem/atutil.h |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/atmodem/atutil.h b/drivers/atmodem/atutil.h
index 3d13b84..a27de86 100644
--- a/drivers/atmodem/atutil.h
+++ b/drivers/atmodem/atutil.h
@@ -84,10 +84,7 @@ static inline struct cb_data *cb_data_new(void *cb, void 
*data)
 {
struct cb_data *ret;
 
-   ret = g_try_new0(struct cb_data, 1);
-   if (ret == NULL)
-   return ret;
-
+   ret = g_new0(struct cb_data, 1);
ret-cb = cb;
ret-data = data;
 
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 00/11] Remove NULL check for call back data

2011-01-29 Thread Jeevaka Badrappan
Hi,

Memory allocation function for callback data change from g_try_new0 to
g_new0. Due to this, NULL check done for callback data is removed.

Regards,
Jeevaka

Jeevaka Badrappan (11):
  atutil: use g_new0 for callback data memory
  atmodem: remove NULL check
  calypsomodem: remove NULL check
  hfpmodem: remove NULL check
  hsomodem: remove NULL check
  huaweimodem: remove NULL check
  ifxmodem: remove NULL check
  mbmmodem: remove NULL check
  stemodem: remove NULL check
  cdmamodem: remove NULL check
  plugins: remove NULL check

 drivers/atmodem/atutil.h|5 +---
 drivers/atmodem/call-barring.c  |6 ++--
 drivers/atmodem/call-forwarding.c   |8 -
 drivers/atmodem/call-meter.c|   28 ---
 drivers/atmodem/call-settings.c |   36 
 drivers/atmodem/call-volume.c   |8 -
 drivers/atmodem/cbs.c   |8 -
 drivers/atmodem/devinfo.c   |   16 ---
 drivers/atmodem/gprs.c  |8 -
 drivers/atmodem/network-registration.c  |   24 
 drivers/atmodem/phonebook.c |4 ---
 drivers/atmodem/sim-auth.c  |2 +-
 drivers/atmodem/sim.c   |   46 ++-
 drivers/atmodem/sms.c   |   20 -
 drivers/atmodem/stk.c   |4 +-
 drivers/atmodem/ussd.c  |7 -
 drivers/atmodem/voicecall.c |7 -
 drivers/calypsomodem/stk.c  |4 +-
 drivers/calypsomodem/voicecall.c|4 ---
 drivers/cdmamodem/devinfo.c |   16 ---
 drivers/cdmamodem/voicecall.c   |4 ---
 drivers/hfpmodem/call-volume.c  |8 -
 drivers/hfpmodem/network-registration.c |   12 
 drivers/hfpmodem/voicecall.c|4 ---
 drivers/hsomodem/gprs-context.c |7 -
 drivers/huaweimodem/gprs-context.c  |8 -
 drivers/huaweimodem/voicecall.c |4 ---
 drivers/ifxmodem/ctm.c  |8 -
 drivers/ifxmodem/stk.c  |4 +-
 drivers/ifxmodem/voicecall.c|7 -
 drivers/mbmmodem/gprs-context.c |7 -
 drivers/mbmmodem/stk.c  |4 +-
 drivers/stemodem/gprs-context.c |6 
 drivers/stemodem/voicecall.c|7 -
 plugins/gobi.c  |2 +-
 plugins/hso.c   |4 ---
 plugins/ifx.c   |4 ---
 plugins/mbm.c   |4 ---
 plugins/novatel.c   |2 +-
 plugins/phonesim.c  |   12 
 plugins/sierra.c|2 +-
 plugins/ste.c   |4 ---
 plugins/tc65.c  |4 ---
 plugins/zte.c   |2 +-
 44 files changed, 20 insertions(+), 371 deletions(-)

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 02/11] atmodem: remove NULL check

2011-01-29 Thread Jeevaka Badrappan
---
 drivers/atmodem/call-barring.c |6 ++--
 drivers/atmodem/call-forwarding.c  |8 -
 drivers/atmodem/call-meter.c   |   28 ---
 drivers/atmodem/call-settings.c|   36 -
 drivers/atmodem/call-volume.c  |8 -
 drivers/atmodem/cbs.c  |8 -
 drivers/atmodem/devinfo.c  |   16 ---
 drivers/atmodem/gprs.c |8 -
 drivers/atmodem/network-registration.c |   24 
 drivers/atmodem/phonebook.c|4 ---
 drivers/atmodem/sim-auth.c |2 +-
 drivers/atmodem/sim.c  |   46 ++-
 drivers/atmodem/sms.c  |   20 --
 drivers/atmodem/stk.c  |4 +-
 drivers/atmodem/ussd.c |7 -
 drivers/atmodem/voicecall.c|7 -
 16 files changed, 9 insertions(+), 223 deletions(-)

diff --git a/drivers/atmodem/call-barring.c b/drivers/atmodem/call-barring.c
index 516b470..73820d2 100644
--- a/drivers/atmodem/call-barring.c
+++ b/drivers/atmodem/call-barring.c
@@ -86,7 +86,7 @@ static void at_call_barring_query(struct ofono_call_barring 
*cb,
struct cb_data *cbd = cb_data_new(callback, data);
char buf[64];
 
-   if (cbd == NULL || strlen(lock) != 2)
+   if (strlen(lock) != 2)
goto error;
 
snprintf(buf, sizeof(buf), AT+CLCK=\%s\,2, lock);
@@ -121,7 +121,7 @@ static void at_call_barring_set(struct ofono_call_barring 
*cb, const char *lock,
char buf[64];
int len;
 
-   if (cbd == NULL || strlen(lock) != 2 || (cls  passwd == NULL))
+   if (strlen(lock) != 2 || (cls  passwd == NULL))
goto error;
 
len = snprintf(buf, sizeof(buf), AT+CLCK=\%s\,%i, lock, enable);
@@ -164,7 +164,7 @@ static void at_call_barring_set_passwd(struct 
ofono_call_barring *cb,
struct cb_data *cbd = cb_data_new(callback, data);
char buf[64];
 
-   if (cbd == NULL || strlen(lock) != 2)
+   if (strlen(lock) != 2)
goto error;
 
snprintf(buf, sizeof(buf), AT+CPWD=\%s\,\%s\,\%s\,
diff --git a/drivers/atmodem/call-forwarding.c 
b/drivers/atmodem/call-forwarding.c
index f11a68e..a5cbd59 100644
--- a/drivers/atmodem/call-forwarding.c
+++ b/drivers/atmodem/call-forwarding.c
@@ -128,9 +128,6 @@ static void at_ccfc_query(struct ofono_call_forwarding *cf, 
int type, int cls,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = GINT_TO_POINTER(cls);
 
if (cls == 7)
@@ -142,7 +139,6 @@ static void at_ccfc_query(struct ofono_call_forwarding *cf, 
int type, int cls,
ccfc_query_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, 0, NULL, data);
@@ -165,14 +161,10 @@ static void at_ccfc_set(struct ofono_call_forwarding *cf, 
const char *buf,
GAtChat *chat = ofono_call_forwarding_get_data(cf);
struct cb_data *cbd = cb_data_new(cb, data);
 
-   if (cbd == NULL)
-   goto error;
-
if (g_at_chat_send(chat, buf, none_prefix,
ccfc_set_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
diff --git a/drivers/atmodem/call-meter.c b/drivers/atmodem/call-meter.c
index 3ab4706..2b91848 100644
--- a/drivers/atmodem/call-meter.c
+++ b/drivers/atmodem/call-meter.c
@@ -116,15 +116,11 @@ static void at_caoc_query(struct ofono_call_meter *cm,
GAtChat *chat = ofono_call_meter_get_data(cm);
struct cb_data *cbd = cb_data_new(cb, data);
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = +CAOC:;
if (g_at_chat_send(chat, AT+CAOC=0, caoc_prefix,
caoc_cacm_camm_query_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, -1, data);
@@ -137,15 +133,11 @@ static void at_cacm_query(struct ofono_call_meter *cm,
GAtChat *chat = ofono_call_meter_get_data(cm);
struct cb_data *cbd = cb_data_new(cb, data);
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = +CACM:;
if (g_at_chat_send(chat, AT+CACM?, cacm_prefix,
caoc_cacm_camm_query_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, -1, data);
@@ -169,16 +161,12 @@ static void at_cacm_set(struct ofono_call_meter *cm, 
const char *passwd,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
 
-   if (cbd == NULL)
-   goto error;
-
snprintf(buf, sizeof(buf), AT+CACM=\%s\, passwd);
 
if (g_at_chat_send(chat, buf, none_prefix,

[PATCH 06/11] huaweimodem: remove NULL check

2011-01-29 Thread Jeevaka Badrappan
---
 drivers/huaweimodem/gprs-context.c |8 
 drivers/huaweimodem/voicecall.c|4 
 2 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/drivers/huaweimodem/gprs-context.c 
b/drivers/huaweimodem/gprs-context.c
index 30f423b..bbc9c96 100644
--- a/drivers/huaweimodem/gprs-context.c
+++ b/drivers/huaweimodem/gprs-context.c
@@ -311,9 +311,6 @@ static void huawei_gprs_activate_primary(struct 
ofono_gprs_context *gc,
 
DBG(cid %u, ctx-cid);
 
-   if (cbd == NULL)
-   goto error;
-
gcd-active_context = ctx-cid;
 
cbd-user = gc;
@@ -328,7 +325,6 @@ static void huawei_gprs_activate_primary(struct 
ofono_gprs_context *gc,
at_cgdcont_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL, NULL, NULL, data);
@@ -344,9 +340,6 @@ static void huawei_gprs_deactivate_primary(struct 
ofono_gprs_context *gc,
 
DBG(cid %u, cid);
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = gc;
 
snprintf(buf, sizeof(buf), AT^NDISDUP=%u,0, cid);
@@ -355,7 +348,6 @@ static void huawei_gprs_deactivate_primary(struct 
ofono_gprs_context *gc,
at_ndisdup_down_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
diff --git a/drivers/huaweimodem/voicecall.c b/drivers/huaweimodem/voicecall.c
index aef2a11..a30513a 100644
--- a/drivers/huaweimodem/voicecall.c
+++ b/drivers/huaweimodem/voicecall.c
@@ -99,14 +99,10 @@ static void huawei_template(struct ofono_voicecall *vc, 
const char *cmd,
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
struct cb_data *cbd = cb_data_new(cb, data);
 
-   if (cbd == NULL)
-   goto error;
-
if (g_at_chat_send(vd-chat, cmd, none_prefix,
huawei_generic_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 07/11] ifxmodem: remove NULL check

2011-01-29 Thread Jeevaka Badrappan
---
 drivers/ifxmodem/ctm.c   |8 
 drivers/ifxmodem/stk.c   |4 ++--
 drivers/ifxmodem/voicecall.c |7 ---
 3 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/ifxmodem/ctm.c b/drivers/ifxmodem/ctm.c
index b70fe09..7b23a9b 100644
--- a/drivers/ifxmodem/ctm.c
+++ b/drivers/ifxmodem/ctm.c
@@ -88,14 +88,10 @@ static void ifx_query_tty(struct ofono_ctm *ctm, 
ofono_ctm_query_cb_t cb,
struct ctm_data *ctmd = ofono_ctm_get_data(ctm);
struct cb_data *cbd = cb_data_new(cb, data);
 
-   if (cbd == NULL)
-   goto error;
-
if (g_at_chat_send(ctmd-chat, AT+XCTMS?, xctms_prefix,
xctms_query_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, -1, data);
@@ -121,9 +117,6 @@ static void ifx_set_tty(struct ofono_ctm *ctm, ofono_bool_t 
enable,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[20];
 
-   if (cbd == NULL)
-   goto error;
-
/* Only FULL TTY mode enabled/disabled */
snprintf(buf, sizeof(buf), AT+XCTMS=%i, enable ? 1 : 0);
 
@@ -131,7 +124,6 @@ static void ifx_set_tty(struct ofono_ctm *ctm, ofono_bool_t 
enable,
xctms_modify_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
diff --git a/drivers/ifxmodem/stk.c b/drivers/ifxmodem/stk.c
index 5951149..f08cf47 100644
--- a/drivers/ifxmodem/stk.c
+++ b/drivers/ifxmodem/stk.c
@@ -104,7 +104,7 @@ static void ifx_stk_envelope(struct ofono_stk *stk, int 
length,
 
DBG();
 
-   if (cbd == NULL || buf == NULL)
+   if (buf == NULL)
goto error;
 
len = sprintf(buf, AT+SATE=\);
@@ -150,7 +150,7 @@ static void ifx_stk_terminal_response(struct ofono_stk 
*stk, int length,
 
DBG();
 
-   if (cbd == NULL || buf == NULL)
+   if (buf == NULL)
goto error;
 
len = sprintf(buf, AT+SATR=\);
diff --git a/drivers/ifxmodem/voicecall.c b/drivers/ifxmodem/voicecall.c
index fcd0c7e..716652c 100644
--- a/drivers/ifxmodem/voicecall.c
+++ b/drivers/ifxmodem/voicecall.c
@@ -305,9 +305,6 @@ static void ifx_dial(struct ofono_voicecall *vc,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[256];
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = vc;
 
if (ph-type == 145)
@@ -332,7 +329,6 @@ static void ifx_dial(struct ofono_voicecall *vc,
atd_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
@@ -504,9 +500,6 @@ static void ifx_send_dtmf(struct ofono_voicecall *vc, const 
char *dtmf,
int i;
char *buf;
 
-   if (cbd == NULL)
-   goto error;
-
/* strlen(+VTS=T\;) = 7 + initial AT + null */
buf = g_try_new(char, len * 7 + 3);
if (buf == NULL)
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 04/11] hfpmodem: remove NULL check

2011-01-29 Thread Jeevaka Badrappan
---
 drivers/hfpmodem/call-volume.c  |8 
 drivers/hfpmodem/network-registration.c |   12 
 drivers/hfpmodem/voicecall.c|4 
 3 files changed, 0 insertions(+), 24 deletions(-)

diff --git a/drivers/hfpmodem/call-volume.c b/drivers/hfpmodem/call-volume.c
index 19f57c4..ee4e352 100644
--- a/drivers/hfpmodem/call-volume.c
+++ b/drivers/hfpmodem/call-volume.c
@@ -73,9 +73,6 @@ static void hfp_speaker_volume(struct ofono_call_volume *cv,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
 
-   if (cbd == NULL)
-   goto error;
-
vd-sp_volume = percent;
 
snprintf(buf, sizeof(buf), AT+VGS=%d,
@@ -85,7 +82,6 @@ static void hfp_speaker_volume(struct ofono_call_volume *cv,
cv_generic_set_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
@@ -100,9 +96,6 @@ static void hfp_microphone_volume(struct ofono_call_volume 
*cv,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
 
-   if (cbd == NULL)
-   goto error;
-
vd-mic_volume = percent;
 
snprintf(buf, sizeof(buf), AT+VGM=%d,
@@ -112,7 +105,6 @@ static void hfp_microphone_volume(struct ofono_call_volume 
*cv,
cv_generic_set_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
diff --git a/drivers/hfpmodem/network-registration.c 
b/drivers/hfpmodem/network-registration.c
index 273490e..23852e7 100644
--- a/drivers/hfpmodem/network-registration.c
+++ b/drivers/hfpmodem/network-registration.c
@@ -236,9 +236,6 @@ static void hfp_registration_status(struct ofono_netreg 
*netreg,
struct cb_data *cbd = cb_data_new(cb, data);
gboolean ok;
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = netreg;
 
ok = g_at_chat_send(nd-chat, AT+CIND?, cind_prefix,
@@ -246,7 +243,6 @@ static void hfp_registration_status(struct ofono_netreg 
*netreg,
if (ok)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, -1, -1, -1, -1, data);
@@ -259,9 +255,6 @@ static void hfp_current_operator(struct ofono_netreg 
*netreg,
struct cb_data *cbd = cb_data_new(cb, data);
gboolean ok;
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = netreg;
 
ok = g_at_chat_send(nd-chat, AT+COPS=3,0, NULL,
@@ -274,7 +267,6 @@ static void hfp_current_operator(struct ofono_netreg 
*netreg,
if (ok)
return;
 
-error:
CALLBACK_WITH_FAILURE(cb, NULL, data);
 }
 
@@ -284,16 +276,12 @@ static void hfp_signal_strength(struct ofono_netreg 
*netreg,
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = netreg;
 
if (g_at_chat_send(nd-chat, AT+CIND?, cind_prefix,
signal_strength_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, -1, data);
diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index d12a5ef..b9bee62 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -362,9 +362,6 @@ static void hfp_dial(struct ofono_voicecall *vc,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[256];
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = vc;
if (ph-type == 145)
snprintf(buf, sizeof(buf), ATD+%s, ph-number);
@@ -377,7 +374,6 @@ static void hfp_dial(struct ofono_voicecall *vc,
atd_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 05/11] hsomodem: remove NULL check

2011-01-29 Thread Jeevaka Badrappan
---
 drivers/hsomodem/gprs-context.c |7 ---
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/hsomodem/gprs-context.c b/drivers/hsomodem/gprs-context.c
index d140d2e..c132846 100644
--- a/drivers/hsomodem/gprs-context.c
+++ b/drivers/hsomodem/gprs-context.c
@@ -156,9 +156,6 @@ static void hso_gprs_activate_primary(struct 
ofono_gprs_context *gc,
char buf[AUTH_BUF_LENGTH];
int len;
 
-   if (cbd == NULL)
-   goto error;
-
gcd-active_context = ctx-cid;
 
cbd-user = gc;
@@ -200,9 +197,6 @@ static void hso_gprs_deactivate_primary(struct 
ofono_gprs_context *gc,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[128];
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = gc;
 
snprintf(buf, sizeof(buf), AT_OWANCALL=%u,0,1, cid);
@@ -211,7 +205,6 @@ static void hso_gprs_deactivate_primary(struct 
ofono_gprs_context *gc,
at_owancall_down_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 09/11] stemodem: remove NULL check

2011-01-29 Thread Jeevaka Badrappan
---
 drivers/stemodem/gprs-context.c |6 --
 drivers/stemodem/voicecall.c|7 ---
 2 files changed, 0 insertions(+), 13 deletions(-)

diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
index 0be4238..e247f35 100644
--- a/drivers/stemodem/gprs-context.c
+++ b/drivers/stemodem/gprs-context.c
@@ -383,9 +383,6 @@ static void ste_gprs_activate_primary(struct 
ofono_gprs_context *gc,
GSList *l;
struct conn_info *conn;
 
-   if (cbd == NULL)
-   goto error_no_device;
-
gcd-active_context = ctx-cid;
cbd-user = gc;
 
@@ -448,9 +445,6 @@ static void ste_gprs_deactivate_primary(struct 
ofono_gprs_context *gc,
char buf[64];
GSList *l;
 
-   if (cbd == NULL)
-   goto error;
-
gcd-active_context = id;
cbd-user = gc;
 
diff --git a/drivers/stemodem/voicecall.c b/drivers/stemodem/voicecall.c
index 5210483..1c7c0bd 100644
--- a/drivers/stemodem/voicecall.c
+++ b/drivers/stemodem/voicecall.c
@@ -187,9 +187,6 @@ static void ste_dial(struct ofono_voicecall *vc,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[256];
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = vc;
 
if (ph-type == 145)
@@ -214,7 +211,6 @@ static void ste_dial(struct ofono_voicecall *vc,
atd_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
@@ -370,9 +366,6 @@ static void ste_send_dtmf(struct ofono_voicecall *vc, const 
char *dtmf,
int s;
char *buf;
 
-   if (cbd == NULL)
-   goto error;
-
/* strlen(AT+VTS=) = 7 + NULL */
buf = g_try_new(char, strlen(dtmf) + 8);
if (buf == NULL)
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 11/11] plugins: remove NULL check

2011-01-29 Thread Jeevaka Badrappan
---
 plugins/gobi.c |2 +-
 plugins/hso.c  |4 
 plugins/ifx.c  |4 
 plugins/mbm.c  |4 
 plugins/novatel.c  |2 +-
 plugins/phonesim.c |   12 
 plugins/sierra.c   |2 +-
 plugins/ste.c  |4 
 plugins/tc65.c |4 
 plugins/zte.c  |2 +-
 10 files changed, 4 insertions(+), 36 deletions(-)

diff --git a/plugins/gobi.c b/plugins/gobi.c
index 1a5830d..e2f988d 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -251,7 +251,7 @@ static void gobi_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
 
DBG(modem %p %s, modem, online ? online : offline);
 
-   if (cbd == NULL || data-chat == NULL)
+   if (data-chat == NULL)
goto error;
 
if (g_at_chat_send(data-chat, command, NULL,
diff --git a/plugins/hso.c b/plugins/hso.c
index 990be6d..4594c52 100644
--- a/plugins/hso.c
+++ b/plugins/hso.c
@@ -346,13 +346,9 @@ static void hso_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
 
DBG(modem %p %s, modem, online ? online : offline);
 
-   if (cbd == NULL)
-   goto error;
-
if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, cbd-data);
diff --git a/plugins/ifx.c b/plugins/ifx.c
index 79cd150..411c012 100644
--- a/plugins/ifx.c
+++ b/plugins/ifx.c
@@ -661,14 +661,10 @@ static void ifx_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
 
DBG(%p %s, modem, online ? online : offline);
 
-   if (cbd == NULL)
-   goto error;
-
if (g_at_chat_send(data-dlcs[AUX_DLC], command, NULL,
set_online_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, cbd-data);
diff --git a/plugins/mbm.c b/plugins/mbm.c
index e826240..600b358 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -470,13 +470,9 @@ static void mbm_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
 
DBG(modem %p %s, modem, online ? online : offline);
 
-   if (cbd == NULL)
-   goto error;
-
if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, cbd-data);
diff --git a/plugins/novatel.c b/plugins/novatel.c
index fbd1216..1948c49 100644
--- a/plugins/novatel.c
+++ b/plugins/novatel.c
@@ -309,7 +309,7 @@ static void novatel_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
 
DBG(modem %p %s, modem, online ? online : offline);
 
-   if (cbd == NULL || chat == NULL)
+   if (chat == NULL)
goto error;
 
if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
diff --git a/plugins/phonesim.c b/plugins/phonesim.c
index 28306b5..2b36fe0 100644
--- a/plugins/phonesim.c
+++ b/plugins/phonesim.c
@@ -143,9 +143,6 @@ static void phonesim_deactivate_primary(struct 
ofono_gprs_context *gc,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[128];
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = gc;
 
snprintf(buf, sizeof(buf), AT+CGACT=0,%u, id);
@@ -154,7 +151,6 @@ static void phonesim_deactivate_primary(struct 
ofono_gprs_context *gc,
at_cgact_down_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
@@ -273,14 +269,10 @@ static void phonesim_ctm_query(struct ofono_ctm *ctm,
 
DBG();
 
-   if (!cbd)
-   goto error;
-
if (g_at_chat_send(chat, AT+PTTY?, ptty_prefix,
ctm_query_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, 0, data);
@@ -305,16 +297,12 @@ static void phonesim_ctm_set(struct ofono_ctm *ctm, 
ofono_bool_t enable,
 
DBG();
 
-   if (!cbd)
-   goto error;
-
snprintf(buf, sizeof(buf), AT+PTTY=%d, enable);
 
if (g_at_chat_send(chat, buf, none_prefix,
ctm_set_cb, cbd, g_free)  0)
return;
 
-error:
CALLBACK_WITH_FAILURE(cb, data);
g_free(cbd);
 }
diff --git a/plugins/sierra.c b/plugins/sierra.c
index b3edcf4..f387b98 100644
--- a/plugins/sierra.c
+++ b/plugins/sierra.c
@@ -195,7 +195,7 @@ static void sierra_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
 
DBG(modem %p %s, modem, online ? online : offline);
 
-   if (cbd == NULL || data-chat == NULL)
+   if (data-chat == NULL)
goto error;
 
if (g_at_chat_send(data-chat, command, NULL,
diff --git a/plugins/ste.c b/plugins/ste.c
index 6b44780..0b02a0d 100644
--- a/plugins/ste.c
+++ b/plugins/ste.c
@@ -320,13 +320,9 @@ static void ste_set_online(struct ofono_modem *modem, 
ofono_bool_t 

[PATCH 08/11] mbmmodem: remove NULL check

2011-01-29 Thread Jeevaka Badrappan
---
 drivers/mbmmodem/gprs-context.c |7 ---
 drivers/mbmmodem/stk.c  |4 ++--
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/mbmmodem/gprs-context.c b/drivers/mbmmodem/gprs-context.c
index b9b4574..322f96d 100644
--- a/drivers/mbmmodem/gprs-context.c
+++ b/drivers/mbmmodem/gprs-context.c
@@ -364,9 +364,6 @@ static void mbm_gprs_activate_primary(struct 
ofono_gprs_context *gc,
 
DBG(cid %u, ctx-cid);
 
-   if (cbd == NULL)
-   goto error;
-
gcd-active_context = ctx-cid;
 
cbd-user = gc;
@@ -408,16 +405,12 @@ static void mbm_gprs_deactivate_primary(struct 
ofono_gprs_context *gc,
 
DBG(cid %u, cid);
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = gc;
 
if (g_at_chat_send(gcd-chat, AT*ENAP=0, none_prefix,
at_enap_down_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
diff --git a/drivers/mbmmodem/stk.c b/drivers/mbmmodem/stk.c
index d0a9f3b..99c08c2 100644
--- a/drivers/mbmmodem/stk.c
+++ b/drivers/mbmmodem/stk.c
@@ -88,7 +88,7 @@ static void mbm_stk_envelope(struct ofono_stk *stk, int 
length,
 
DBG();
 
-   if (cbd == NULL || buf == NULL)
+   if (buf == NULL)
goto error;
 
len = sprintf(buf, AT*STKE=\);
@@ -134,7 +134,7 @@ static void mbm_stk_terminal_response(struct ofono_stk 
*stk, int length,
 
DBG();
 
-   if (cbd == NULL || buf == NULL)
+   if (buf == NULL)
goto error;
 
len = sprintf(buf, AT*STKR=\);
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 10/11] cdmamodem: remove NULL check

2011-01-29 Thread Jeevaka Badrappan
---
 drivers/cdmamodem/devinfo.c   |   16 
 drivers/cdmamodem/voicecall.c |4 
 2 files changed, 0 insertions(+), 20 deletions(-)

diff --git a/drivers/cdmamodem/devinfo.c b/drivers/cdmamodem/devinfo.c
index dfc7fd5..9603e05 100644
--- a/drivers/cdmamodem/devinfo.c
+++ b/drivers/cdmamodem/devinfo.c
@@ -65,15 +65,11 @@ static void cdma_query_manufacturer(struct ofono_devinfo 
*info,
struct cb_data *cbd = cb_data_new(cb, data);
GAtChat *chat = ofono_devinfo_get_data(info);
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = AT+GMI;
 
if (g_at_chat_send(chat, AT+GMI, NULL, attr_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, NULL, data);
@@ -85,15 +81,11 @@ static void cdma_query_model(struct ofono_devinfo *info,
struct cb_data *cbd = cb_data_new(cb, data);
GAtChat *chat = ofono_devinfo_get_data(info);
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = AT+GMM;
 
if (g_at_chat_send(chat, AT+GMM, NULL, attr_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, NULL, data);
@@ -105,15 +97,11 @@ static void cdma_query_revision(struct ofono_devinfo *info,
struct cb_data *cbd = cb_data_new(cb, data);
GAtChat *chat = ofono_devinfo_get_data(info);
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = AT+GMR;
 
if (g_at_chat_send(chat, AT+GMR, NULL, attr_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, NULL, data);
@@ -125,15 +113,11 @@ static void cdma_query_serial(struct ofono_devinfo *info,
struct cb_data *cbd = cb_data_new(cb, data);
GAtChat *chat = ofono_devinfo_get_data(info);
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = AT+GSN;
 
if (g_at_chat_send(chat, AT+GSN, NULL, attr_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, NULL, data);
diff --git a/drivers/cdmamodem/voicecall.c b/drivers/cdmamodem/voicecall.c
index 94ec74b..cabed6a 100644
--- a/drivers/cdmamodem/voicecall.c
+++ b/drivers/cdmamodem/voicecall.c
@@ -54,16 +54,12 @@ static void cdma_template(const char *cmd, struct 
ofono_cdma_voicecall *vc,
struct voicecall_data *vd = ofono_cdma_voicecall_get_data(vc);
struct cb_data *cbd = cb_data_new(cb, data);
 
-   if (cbd == NULL)
-   goto error;
-
cbd-user = vc;
 
if (g_at_chat_send(vd-chat, cmd, none_prefix,
result_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 03/11] calypsomodem: remove NULL check

2011-01-29 Thread Jeevaka Badrappan
---
 drivers/calypsomodem/stk.c   |4 ++--
 drivers/calypsomodem/voicecall.c |4 
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/calypsomodem/stk.c b/drivers/calypsomodem/stk.c
index 196b9e3..83287f9 100644
--- a/drivers/calypsomodem/stk.c
+++ b/drivers/calypsomodem/stk.c
@@ -101,7 +101,7 @@ static void calypso_stk_envelope(struct ofono_stk *stk, int 
length,
 
DBG();
 
-   if (cbd == NULL || buf == NULL)
+   if (buf == NULL)
goto error;
 
len = sprintf(buf, AT%%SATE=\);
@@ -148,7 +148,7 @@ static void calypso_stk_terminal_response(struct ofono_stk 
*stk, int length,
 
DBG();
 
-   if (cbd == NULL || buf == NULL)
+   if (buf == NULL)
goto error;
 
len = sprintf(buf, AT%%SATR=\);
diff --git a/drivers/calypsomodem/voicecall.c b/drivers/calypsomodem/voicecall.c
index 204ed14..01be990 100644
--- a/drivers/calypsomodem/voicecall.c
+++ b/drivers/calypsomodem/voicecall.c
@@ -64,14 +64,10 @@ static void calypso_template(struct ofono_voicecall *vc, 
const char *cmd,
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
struct cb_data *cbd = cb_data_new(cb, data);
 
-   if (cbd == NULL)
-   goto error;
-
if (g_at_chat_send(vd-chat, cmd, none_prefix,
calypso_generic_cb, cbd, g_free)  0)
return;
 
-error:
g_free(cbd);
 
CALLBACK_WITH_FAILURE(cb, data);
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 2/5] simfs: Return from sim_fs_op_check_cached on error.

2011-01-29 Thread Denis Kenzior
Hi Andrew,

On 01/28/2011 06:29 PM, Andrzej Zaborowski wrote:
 ---
  src/simfs.c |4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)
 

Patch has been applied, thanks.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH 00/11] Remove NULL check for call back data

2011-01-29 Thread Denis Kenzior
Hi Jeevaka,

On 01/29/2011 07:34 AM, Jeevaka Badrappan wrote:
 Hi,
 
 Memory allocation function for callback data change from g_try_new0 to
 g_new0. Due to this, NULL check done for callback data is removed.
 
 Regards,
 Jeevaka
 

All 11 patches have been applied, thanks.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] atmodem: fix memory leak

2011-01-29 Thread Jeevaka Badrappan
---
 drivers/atmodem/sim.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index 819864f..0938998 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -157,6 +157,8 @@ static void at_sim_read_info(struct ofono_sim *sim, int 
fileid,
at_crsm_info_cb, cbd, g_free)  0)
return;
 
+   g_free(cbd);
+
CALLBACK_WITH_FAILURE(cb, -1, -1, -1, NULL,
EF_STATUS_INVALIDATED, data);
 }
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] atmodem: fix memory leak

2011-01-29 Thread Denis Kenzior
Hi Jeevaka,

On 01/29/2011 12:21 PM, Jeevaka Badrappan wrote:
 ---
  drivers/atmodem/sim.c |2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 

Patch has been applied, thanks.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


Re: [PATCH] hfpmodem: fix memory leak

2011-01-29 Thread Denis Kenzior
Hi Jeevaka,

On 01/29/2011 12:24 PM, Jeevaka Badrappan wrote:
 ---
  drivers/hfpmodem/network-registration.c |2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 

Patch has been applied, thanks.

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH] stemodem: fix issue with gatchat usage

2011-01-29 Thread Jeevaka Badrappan
---
 drivers/stemodem/radio-settings.c |   15 +--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/stemodem/radio-settings.c 
b/drivers/stemodem/radio-settings.c
index 5b50126..d6ed2e1 100644
--- a/drivers/stemodem/radio-settings.c
+++ b/drivers/stemodem/radio-settings.c
@@ -187,6 +187,15 @@ static void ste_set_rat_mode(struct ofono_radio_settings 
*rs,
}
 }
 
+static gboolean ste_radio_settings_register(gpointer user)
+{
+   struct ofono_radio_settings *rs = user;
+
+   ofono_radio_settings_register(rs);
+
+   return FALSE;
+}
+
 static int ste_radio_settings_probe(struct ofono_radio_settings *rs,
unsigned int vendor, void *data)
 {
@@ -197,10 +206,10 @@ static int ste_radio_settings_probe(struct 
ofono_radio_settings *rs,
if (rsd == NULL)
return -ENOMEM;
 
-   rsd-chat = chat;
+   rsd-chat = g_at_chat_clone(chat);
 
ofono_radio_settings_set_data(rs, rsd);
-   ofono_radio_settings_register(rs);
+   g_idle_add(ste_radio_settings_register, rs);
 
return 0;
 }
@@ -209,6 +218,8 @@ static void ste_radio_settings_remove(struct 
ofono_radio_settings *rs)
 {
struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
ofono_radio_settings_set_data(rs, NULL);
+
+   g_at_chat_unref(rsd-chat);
g_free(rsd);
 }
 
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCHv2] doc: Assisted Satellite Navigation API and Agent API

2011-01-29 Thread Sjur Brændeland
From: Simon Lethbridge simon.lethbri...@stericsson.com

This patch introduces support for Global Satellite Navigation System (GNSS),
using the AT commands AT+CPOS and +CPOSR as specified 3GPP 27.007.
---

Changes from v1 (28 Jan):
s/SendPositioningControl/SendPositioningElement/

Thanks Rémi, for spotting this one,


Changes from RFCv2 (Nov 22):
Hi Denis,

2010/11/30 Denis Kenzior denk...@gmail.com:
 +AssistedSatelliteNavigation hierarchy
What do you think of naming this AssistedNavigation?  I think the
current name might be a bit too long.

See mail previous mail on this topic, I think we'd like to keep
it as is for now.

 +Methods  void SendPositioningControl(string xml_element)
What do you think of SendPositioningElement?

Fixed,

 +Methods  void PositioningRequest(string xml_element)
I think that 'Request' will be sufficient.  Positioning is already part
of the agent name.

Fixed,

 + void AssistanceDataReset()
I suggest ResetAssistanceData here.
Fixed,

The only other change I'd make is to mark the entire interface
'experimental', but I can take care of that as well.

Fixed,

Otherwise the proposal looks good to me.

Sorry for taking so long before responding on this.
Let us know if you have any issues with this patch.

Regards,
Sjur and Simon.

 doc/assisted-sattelite-navigation.txt |   56 +
 1 files changed, 56 insertions(+), 0 deletions(-)
 create mode 100644 doc/assisted-sattelite-navigation.txt

diff --git a/doc/assisted-sattelite-navigation.txt 
b/doc/assisted-sattelite-navigation.txt
new file mode 100644
index 000..c5a8c10
--- /dev/null
+++ b/doc/assisted-sattelite-navigation.txt
@@ -0,0 +1,56 @@
+Assisted Satellite Navigation hierarchy [experimental]
+==
+
+Serviceorg.ofono
+Interface  org.ofono.AssistedSatelliteNavigation
+Object path[variable prefix]/{modem0,modem1,...}
+
+Methodsvoid SendPositioningElement(string xml_element)
+
+   Send an XML element conforming to the XML DTD for pos
+   as defined in 3GPP 27.007 Table 8.55-2. This xml is
+   used for transferring data associated with positioning
+   requests received via control plane from the network.
+   This includes assistance data requests and the results
+   of positioning procedures. This method maps directly to
+   the 3GPP 27.007 AT+CPOS command.
+
+   void RegisterPositioningRequestAgent(object path)
+
+   Registers an agent which will be called whenever a
+   CPOSR AT response is received. The Agent must respond
+   to requests using SendPositioningElement.
+
+   void UnregisterPositioningRequestAgent(object path)
+
+   Un-registers the agent.
+
+PositioningRequestAgent hierarchy
+==
+
+Serviceunique name
+Interface  org.ofono.PositioningRequestAgent
+Object pathfreely definable
+
+Methodsvoid Request(string xml_element)
+
+   Receive an XML element conforming to the XML DTD for
+   pos in 3GPP 27.007. This xml is used for transferring
+   data associated with positioning requests received, via
+   control plane, from the network. This includes
+   measurement requests and assistance data. This method
+   maps directly to the 3GPP defined +CPOSR unsolicited
+   result code.
+
+   void ResetAssistanceData()
+
+   A request has been received from the network that all
+   assistance data should be reset.  This is used for 3gpp
+   performance tests.
+
+   void Release()
+
+   Agent is being released, possibly because of oFono
+   terminating, AssistedSatelliteNavigation interface
+   is being torn down or modem off.
+   No UnregisterPositioningRequestAgent call is needed.
-- 
1.7.0.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono