summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2019-06-21 13:48:45 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2020-08-27 18:12:56 +0200
commit6706382a59f37ace006018d0fa421906f99e57b9 (patch)
treed0933636004a107a436ab99f28a1b18cb74bd5d7
parentd35e040065c0c33525e946c8b9d1f759be90e32d (diff)
downloadhardware_replicant_libsamsung-ril-6706382a59f37ace006018d0fa421906f99e57b9.tar.gz
hardware_replicant_libsamsung-ril-6706382a59f37ace006018d0fa421906f99e57b9.tar.bz2
hardware_replicant_libsamsung-ril-6706382a59f37ace006018d0fa421906f99e57b9.zip
ril_radio_state_check: rename it to ril_has_reached_state to improve clarity
The former name of the function doesn't convey what it's supposed to do. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--call.c14
-rw-r--r--data.c10
-rw-r--r--misc.c10
-rw-r--r--network.c32
-rw-r--r--samsung-ril.c8
-rw-r--r--samsung-ril.h2
-rw-r--r--sim.c26
-rw-r--r--sms.c6
-rw-r--r--ss.c4
9 files changed, 58 insertions, 54 deletions
diff --git a/call.c b/call.c
index bd36335..098d163 100644
--- a/call.c
+++ b/call.c
@@ -82,7 +82,7 @@ int ril_request_dial(void *data, size_t size, RIL_Token token)
if (data == NULL || size < sizeof(RIL_Dial))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -139,7 +139,7 @@ int ril_request_hangup(__attribute__((unused)) void *data,
int hangup;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -176,7 +176,7 @@ int ril_request_answer(__attribute__((unused)) void *data,
{
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -240,7 +240,7 @@ int ril_request_last_call_fail_cause(__attribute__((unused)) void *data,
int fail_cause;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -350,7 +350,7 @@ int ril_request_get_current_calls(__attribute__((unused)) void *data,
{
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0) {
ril_request_complete(token, RIL_E_SUCCESS, NULL, 0);
return RIL_REQUEST_COMPLETED;
@@ -486,7 +486,7 @@ int ril_request_dtmf(void *data, size_t size, RIL_Token token)
if (data == NULL || size < sizeof(char))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -571,7 +571,7 @@ int ril_request_dtmf_start(void *data, size_t size, RIL_Token token)
if (data == NULL || size < sizeof(char))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
diff --git a/data.c b/data.c
index 5939f47..11d0b47 100644
--- a/data.c
+++ b/data.c
@@ -464,7 +464,7 @@ int ril_request_setup_data_call(void *data, size_t size, RIL_Token token)
if (data == NULL || size < 6 * sizeof(char *))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_READY);
if (rc < 0) {
ril_request_complete(token, RIL_E_OP_NOT_ALLOWED_BEFORE_REG_TO_NW, NULL, 0);
return RIL_REQUEST_COMPLETED;
@@ -668,7 +668,7 @@ int ril_request_data_call_list(__attribute__((unused)) void *data,
{
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0) {
ril_request_complete(token, RIL_E_SUCCESS, NULL, 0);
return RIL_REQUEST_COMPLETED;
@@ -734,7 +734,7 @@ int ril_request_deactivate_data_call(void *data, size_t size, RIL_Token token)
if (data == NULL || size < 2 * sizeof(char *))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -882,7 +882,7 @@ int ipc_gprs_call_status(struct ipc_message *message)
if (message == NULL || message->data == NULL || message->size < sizeof(struct ipc_gprs_call_status_data))
return -1;
- rc = ril_radio_state_check(RADIO_STATE_SIM_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_READY);
if (rc < 0)
return 0;
@@ -1027,7 +1027,7 @@ int ril_request_last_data_call_fail_cause(__attribute__((unused)) void *data,
int fail_cause;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
diff --git a/misc.c b/misc.c
index d69f5bd..e9ec767 100644
--- a/misc.c
+++ b/misc.c
@@ -55,7 +55,7 @@ int ril_request_baseband_version(__attribute__((unused)) void *data,
struct ril_request *request;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -113,7 +113,7 @@ int ril_request_get_imsi(__attribute__((unused)) void *data,
struct ril_request *request;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -189,7 +189,7 @@ int ril_request_get_imei(__attribute__((unused)) void *data,
struct ril_request *request;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -221,7 +221,7 @@ int ril_request_get_imeisv(__attribute__((unused)) void *data,
struct ril_request *request;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -275,7 +275,7 @@ int ril_request_screen_state(void *data, size_t size, RIL_Token token)
return RIL_REQUEST_COMPLETED;
}
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
diff --git a/network.c b/network.c
index 45e8aed..a5caf7a 100644
--- a/network.c
+++ b/network.c
@@ -422,7 +422,7 @@ int ipc_disp_icon_info(struct ipc_message *message)
if (message == NULL || message->data == NULL || message->size < sizeof(struct ipc_disp_icon_info_response_data))
return -1;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return 0;
@@ -451,7 +451,7 @@ int ril_request_signal_strength(__attribute__((unused)) void *data,
struct ipc_disp_icon_info_request_data request_data;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -480,7 +480,7 @@ int ipc_disp_rssi_info(struct ipc_message *message)
if (message == NULL || message->data == NULL || message->size < sizeof(struct ipc_disp_rssi_info_data))
return -1;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return 0;
@@ -504,7 +504,7 @@ int ipc_net_plmn_sel(struct ipc_message *message)
if (message == NULL || message->data == NULL || message->size < sizeof(struct ipc_net_plmn_sel_response_data))
return -1;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return 0;
@@ -526,7 +526,7 @@ int ril_request_query_network_selection_mode(__attribute__((unused)) void *data,
{
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -572,7 +572,7 @@ int ril_request_set_network_selection_automatic(__attribute__((unused)) void *da
struct ipc_net_plmn_sel_request_data request_data;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -611,7 +611,7 @@ int ril_request_set_network_selection_manual(void *data, size_t size,
return RIL_REQUEST_COMPLETED;
}
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -650,7 +650,7 @@ int ipc_net_serving_network(struct ipc_message *message)
if (message == NULL || message->data == NULL || message->size < sizeof(struct ipc_net_regist_response_data))
return -1;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return 0;
@@ -697,7 +697,7 @@ int ril_request_operator(__attribute__((unused)) void *data,
unsigned int i;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -747,7 +747,7 @@ int ipc_net_plmn_list(struct ipc_message *message)
if (message == NULL || message->data == NULL || message->size < sizeof(struct ipc_net_plmn_list_header))
return -1;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return 0;
@@ -823,7 +823,7 @@ int ril_request_query_available_networks(__attribute__((unused)) void *data,
struct ril_request *request;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -862,7 +862,7 @@ int ipc_net_regist(struct ipc_message *message)
if (client == NULL || client->data == NULL)
return 0;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return 0;
@@ -963,7 +963,7 @@ int ril_request_registration_state(__attribute__((unused)) void *data,
unsigned int i;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -1038,7 +1038,7 @@ int ril_request_gprs_registration_state(__attribute__((unused)) void *data,
unsigned int i;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -1103,7 +1103,7 @@ int ipc_net_mode_sel(struct ipc_message *message)
if (message == NULL || message->data == NULL || message->size < sizeof(struct ipc_net_mode_sel_data))
return -1;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return 0;
@@ -1125,7 +1125,7 @@ int ril_request_get_preferred_network_type(__attribute__((unused)) void *data,
{
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
diff --git a/samsung-ril.c b/samsung-ril.c
index 41f9ff0..64575b3 100644
--- a/samsung-ril.c
+++ b/samsung-ril.c
@@ -915,7 +915,7 @@ void *ril_request_loop(__attribute__((unused)) void *data)
RIL_LOCK();
- rc = ril_radio_state_check(RADIO_STATE_OFF);
+ rc = ril_has_reached_state(RADIO_STATE_OFF);
if (rc < 0) {
RIL_UNLOCK();
continue;
@@ -1196,7 +1196,11 @@ int ril_radio_state_update(RIL_RadioState radio_state)
return 0;
}
-int ril_radio_state_check(RIL_RadioState radio_state)
+/*
+ * Returns 0 if the RIL has reached the given radio_state
+ * Returns -1 otherwise
+ */
+int ril_has_reached_state(RIL_RadioState radio_state)
{
RIL_RadioState radio_states[] = {
RADIO_STATE_UNAVAILABLE,
diff --git a/samsung-ril.h b/samsung-ril.h
index cf6dc15..f86840e 100644
--- a/samsung-ril.h
+++ b/samsung-ril.h
@@ -203,7 +203,7 @@ void *ril_request_data_get(int request);
*/
int ril_radio_state_update(RIL_RadioState radio_state);
-int ril_radio_state_check(RIL_RadioState radio_state);
+int ril_has_reached_state(RIL_RadioState radio_state);
/*
* RIL data
diff --git a/sim.c b/sim.c
index a0f9ee3..f0fb89e 100644
--- a/sim.c
+++ b/sim.c
@@ -212,7 +212,7 @@ int ipc_sec_pin_status(struct ipc_message *message)
if (message == NULL || message->data == NULL || message->size < sizeof(struct ipc_sec_pin_status_response_data))
return -1;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return 0;
@@ -271,7 +271,7 @@ int ril_request_get_sim_status(__attribute__((unused)) void *data,
struct ril_request *request;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -334,7 +334,7 @@ int ril_request_query_facility_lock(void *data, size_t size, RIL_Token token)
if (data == NULL || size < 4 * sizeof(char *))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -533,7 +533,7 @@ int ril_request_set_facility_lock(void *data, size_t size, RIL_Token token)
if (data == NULL || size < 4 * sizeof(char *))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -611,7 +611,7 @@ int ril_request_enter_sim_pin(void *data, size_t size, RIL_Token token)
if (data == NULL || size < 2 * sizeof(char *) || ril_data == NULL)
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -668,7 +668,7 @@ int ril_request_enter_sim_puk(void *data, size_t size, RIL_Token token)
if (data == NULL || size < 2 * sizeof(char *))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -718,7 +718,7 @@ int ril_request_enter_sim_pin2(void *data, size_t size, RIL_Token token)
if (data == NULL || size < 2 * sizeof(char *))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -768,7 +768,7 @@ int ril_request_enter_sim_puk2(void *data, size_t size, RIL_Token token)
if (data == NULL || size < 2 * sizeof(char *))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -822,7 +822,7 @@ int ril_request_change_sim_pin(void *data, size_t size, RIL_Token token)
if (request != NULL)
return RIL_REQUEST_UNHANDLED;
- rc = ril_radio_state_check(RADIO_STATE_SIM_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -872,7 +872,7 @@ int ril_request_change_sim_pin2(void *data, size_t size, RIL_Token token)
if (request != NULL)
return RIL_REQUEST_UNHANDLED;
- rc = ril_radio_state_check(RADIO_STATE_SIM_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -1007,9 +1007,9 @@ int ril_request_sim_io(void *data, size_t size, RIL_Token token)
#endif
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_READY);
if (rc < 0) {
- rc = ril_radio_state_check(RADIO_STATE_SIM_LOCKED_OR_ABSENT);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_LOCKED_OR_ABSENT);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
else
@@ -1174,7 +1174,7 @@ int ipc_sec_lock_infomation(struct ipc_message *message)
if (message == NULL || message->data == NULL || message->size < sizeof(struct ipc_sec_lock_information_response_data))
return -1;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return 0;
diff --git a/sms.c b/sms.c
index 1c5d302..6b77fbe 100644
--- a/sms.c
+++ b/sms.c
@@ -205,7 +205,7 @@ int ril_request_send_sms(void *data, size_t size, RIL_Token token)
if (data == NULL || size < 2 * sizeof(char *))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -345,7 +345,7 @@ int ril_request_write_sms_to_sim(void *data, size_t size, RIL_Token token)
if (data == NULL || size < sizeof(RIL_SMS_WriteArgs))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -528,7 +528,7 @@ int ril_request_sms_acknowledge(void *data, size_t size, RIL_Token token)
if (data == NULL || size < 2 * sizeof(int))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
diff --git a/ss.c b/ss.c
index 59e134f..51aa46d 100644
--- a/ss.c
+++ b/ss.c
@@ -121,7 +121,7 @@ int ril_request_send_ussd(void *data, size_t size, RIL_Token token)
if (data == NULL || size < sizeof(char *))
goto error;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;
@@ -221,7 +221,7 @@ int ril_request_cancel_ussd(__attribute__((unused)) void *data,
struct ipc_ss_ussd_header ussd;
int rc;
- rc = ril_radio_state_check(RADIO_STATE_SIM_NOT_READY);
+ rc = ril_has_reached_state(RADIO_STATE_SIM_NOT_READY);
if (rc < 0)
return RIL_REQUEST_UNHANDLED;