pmaports-a71/temp/ofono/0002-common-atmodem-move-at_util_call_compare_by_status-t.patch
2019-12-28 21:13:29 +05:30

313 lines
11 KiB
Diff

From 4f8a3991c6f90fc5af980eff3aa296552638e73f Mon Sep 17 00:00:00 2001
From: Alexander Couzens <lynxis@fe80.eu>
Date: Tue, 25 Jul 2017 15:35:51 +0200
Subject: [PATCH 2/5] common,atmodem: move at_util_call_compare_by_status to
drivers/common
at_util_call_compare_by_status is used by several modem drivers.
---
drivers/atmodem/atutil.c | 11 -----------
drivers/atmodem/atutil.h | 1 -
drivers/atmodem/voicecall.c | 16 ++++++++--------
drivers/common/call_list.c | 10 ++++++++++
drivers/common/call_list.h | 1 +
drivers/hfpmodem/voicecall.c | 20 ++++++++++----------
drivers/huaweimodem/voicecall.c | 4 ++--
drivers/ifxmodem/voicecall.c | 10 +++++-----
8 files changed, 36 insertions(+), 37 deletions(-)
diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index 3ab930ad..df42e60e 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -73,17 +73,6 @@ void decode_at_error(struct ofono_error *error, const char *final)
}
}
-gint at_util_call_compare_by_status(gconstpointer a, gconstpointer b)
-{
- const struct ofono_call *call = a;
- int status = GPOINTER_TO_INT(b);
-
- if (status != call->status)
- return 1;
-
- return 0;
-}
-
gint at_util_call_compare_by_phone_number(gconstpointer a, gconstpointer b)
{
const struct ofono_call *call = a;
diff --git a/drivers/atmodem/atutil.h b/drivers/atmodem/atutil.h
index 4a8e26cb..c26adcbd 100644
--- a/drivers/atmodem/atutil.h
+++ b/drivers/atmodem/atutil.h
@@ -56,7 +56,6 @@ enum at_util_charset {
typedef void (*at_util_sim_inserted_cb_t)(gboolean present, void *userdata);
void decode_at_error(struct ofono_error *error, const char *final);
-gint at_util_call_compare_by_status(gconstpointer a, gconstpointer b);
gint at_util_call_compare_by_phone_number(gconstpointer a, gconstpointer b);
gint at_util_call_compare_by_id(gconstpointer a, gconstpointer b);
GSList *at_util_parse_clcc(GAtResult *result, unsigned int *mpty_ids);
diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index 5f5b9e45..4c495ce2 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -662,13 +662,13 @@ static void ring_notify(GAtResult *result, gpointer user_data)
/* See comment in CRING */
if (g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_WAITING),
- at_util_call_compare_by_status))
+ ofono_call_compare_by_status))
return;
/* RING can repeat, ignore if we already have an incoming call */
if (g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status))
+ ofono_call_compare_by_status))
return;
/* Generate an incoming call of unknown type */
@@ -700,13 +700,13 @@ static void cring_notify(GAtResult *result, gpointer user_data)
*/
if (g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_WAITING),
- at_util_call_compare_by_status))
+ ofono_call_compare_by_status))
return;
/* CRING can repeat, ignore if we already have an incoming call */
if (g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status))
+ ofono_call_compare_by_status))
return;
g_at_result_iter_init(&iter, result);
@@ -750,7 +750,7 @@ static void clip_notify(GAtResult *result, gpointer user_data)
l = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
if (l == NULL) {
ofono_error("CLIP for unknown call");
return;
@@ -812,7 +812,7 @@ static void cdip_notify(GAtResult *result, gpointer user_data)
l = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
if (l == NULL) {
ofono_error("CDIP for unknown call");
return;
@@ -861,7 +861,7 @@ static void cnap_notify(GAtResult *result, gpointer user_data)
l = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
if (l == NULL) {
ofono_error("CNAP for unknown call");
return;
@@ -915,7 +915,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
/* Some modems resend CCWA, ignore it the second time around */
if (g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_WAITING),
- at_util_call_compare_by_status))
+ ofono_call_compare_by_status))
return;
g_at_result_iter_init(&iter, result);
diff --git a/drivers/common/call_list.c b/drivers/common/call_list.c
index 487b85e4..14fd9258 100644
--- a/drivers/common/call_list.c
+++ b/drivers/common/call_list.c
@@ -41,3 +41,13 @@ gint ofono_call_compare(gconstpointer a, gconstpointer b)
return 0;
}
+gint ofono_call_compare_by_status(gconstpointer a, gconstpointer b)
+{
+ const struct ofono_call *call = a;
+ int status = GPOINTER_TO_INT(b);
+
+ if (status != call->status)
+ return 1;
+
+ return 0;
+}
diff --git a/drivers/common/call_list.h b/drivers/common/call_list.h
index 2cca87b2..ffa9dce5 100644
--- a/drivers/common/call_list.h
+++ b/drivers/common/call_list.h
@@ -25,5 +25,6 @@
#include <glib.h>
gint ofono_call_compare(gconstpointer a, gconstpointer b);
+gint ofono_call_compare_by_status(gconstpointer a, gconstpointer b);
#endif /* __OFONO_DRIVER_COMMON_CALL_LIST */
diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index faa25c7f..b463876b 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -86,12 +86,12 @@ static GSList *find_dialing(GSList *calls)
GSList *c;
c = g_slist_find_custom(calls, GINT_TO_POINTER(CALL_STATUS_DIALING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
if (c == NULL)
c = g_slist_find_custom(calls,
GINT_TO_POINTER(CALL_STATUS_ALERTING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
return c;
}
@@ -761,7 +761,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
/* CCWA can repeat, ignore if we already have an waiting call */
if (g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_WAITING),
- at_util_call_compare_by_status))
+ ofono_call_compare_by_status))
return;
/* some phones may send extra CCWA after active call is ended
@@ -770,7 +770,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
*/
if (g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status))
+ ofono_call_compare_by_status))
return;
@@ -813,7 +813,7 @@ static gboolean clip_timeout(gpointer user_data)
l = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
if (l == NULL)
return FALSE;
@@ -842,12 +842,12 @@ static void ring_notify(GAtResult *result, gpointer user_data)
/* RING can repeat, ignore if we already have an incoming call */
if (g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status))
+ ofono_call_compare_by_status))
return;
waiting = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_WAITING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
/* If we started receiving RINGS but have a waiting call, most
* likely all other calls were dropped and we just didn't get
@@ -892,7 +892,7 @@ static void clip_notify(GAtResult *result, gpointer user_data)
l = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
if (l == NULL) {
ofono_error("CLIP for unknown call");
@@ -1008,7 +1008,7 @@ static void ciev_callsetup_notify(struct ofono_voicecall *vc,
waiting = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_WAITING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
/* This is a truly bizarre case not covered at all by the specification
* (yes, they are complete idiots). Here we assume the other side is
@@ -1087,7 +1087,7 @@ static void ciev_callsetup_notify(struct ofono_voicecall *vc,
{
GSList *o = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_DIALING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
if (o) {
struct ofono_call *call = o->data;
diff --git a/drivers/huaweimodem/voicecall.c b/drivers/huaweimodem/voicecall.c
index b0dfdbc7..1043c84d 100644
--- a/drivers/huaweimodem/voicecall.c
+++ b/drivers/huaweimodem/voicecall.c
@@ -180,7 +180,7 @@ static void cring_notify(GAtResult *result, gpointer user_data)
/* CRING can repeat, ignore if we already have an incoming call */
if (g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status))
+ ofono_call_compare_by_status))
return;
g_at_result_iter_init(&iter, result);
@@ -219,7 +219,7 @@ static void clip_notify(GAtResult *result, gpointer user_data)
l = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
if (l == NULL) {
ofono_error("CLIP for unknown call");
return;
diff --git a/drivers/ifxmodem/voicecall.c b/drivers/ifxmodem/voicecall.c
index b5db5d3e..42c1a82c 100644
--- a/drivers/ifxmodem/voicecall.c
+++ b/drivers/ifxmodem/voicecall.c
@@ -546,12 +546,12 @@ static void cring_notify(GAtResult *result, gpointer user_data)
*/
if (g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_WAITING),
- at_util_call_compare_by_status))
+ ofono_call_compare_by_status))
return;
l = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
if (l == NULL) {
ofono_error("CRING received before XCALLSTAT!!!");
return;
@@ -590,7 +590,7 @@ static void clip_notify(GAtResult *result, gpointer user_data)
l = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
if (l == NULL) {
ofono_error("CLIP for unknown call");
return;
@@ -650,7 +650,7 @@ static void cnap_notify(GAtResult *result, gpointer user_data)
*/
l = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_INCOMING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
if (l == NULL) {
ofono_error("CNAP for unknown call");
return;
@@ -696,7 +696,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
l = g_slist_find_custom(vd->calls,
GINT_TO_POINTER(CALL_STATUS_WAITING),
- at_util_call_compare_by_status);
+ ofono_call_compare_by_status);
if (l == NULL) {
ofono_error("CCWA received before XCALLSTAT!!!");
return;
--
2.24.1