[Replicant] [libsamsung-ipc] [PATCH 20/26] tools: ipc-modem: get rid of out_call global variable
Denis 'GNUtoo' Carikli
GNUtoo at cyberdimension.org
Mon Mar 28 20:20:34 UTC 2022
Since we now have a private struct for all the data we need, we don't
need to use global variables anymore.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
tools/ipc-modem.c | 20 ++++++++++----------
tools/ipc-modem.h | 1 +
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/tools/ipc-modem.c b/tools/ipc-modem.c
index 8099972..85473d7 100644
--- a/tools/ipc-modem.c
+++ b/tools/ipc-modem.c
@@ -45,7 +45,6 @@ enum log_target log_target;
int state = MODEM_STATE_LPM;
int seq;
-int out_call;
int seq_get(void)
{
@@ -91,11 +90,11 @@ void modem_snd_audio_path_ctrl(struct ipc_client *client)
-void modem_exec_call_out(struct ipc_client *client, char *num)
+void modem_exec_call_out(struct ipc_modem_data *data, char *num)
{
struct ipc_call_outgoing_data call_out;
- modem_snd_no_mic_mute(client);
+ modem_snd_no_mic_mute(data->client);
memset(&call_out, 0, sizeof(struct ipc_call_outgoing_data));
@@ -107,15 +106,16 @@ void modem_exec_call_out(struct ipc_client *client, char *num)
call_out.prefix = IPC_CALL_PREFIX_NONE; //0x21;//IPC_CALL_PREFIX_NONE;
memcpy(call_out.number, num, call_out.number_length);
- ipc_client_send(client, seq_get(), IPC_CALL_OUTGOING, IPC_TYPE_EXEC,
+ ipc_client_send(data->client,
+ seq_get(), IPC_CALL_OUTGOING, IPC_TYPE_EXEC,
(void *) &call_out,
sizeof(struct ipc_call_outgoing_data));
- out_call = 1;
+ data->out_call = 1;
- modem_snd_no_mic_mute(client);
- modem_snd_spkr_volume_ctrl(client);
- modem_snd_audio_path_ctrl(client);
+ modem_snd_no_mic_mute(data->client);
+ modem_snd_spkr_volume_ctrl(data->client);
+ modem_snd_audio_path_ctrl(data->client);
}
void modem_exec_call_answer(struct ipc_client *client)
@@ -271,7 +271,7 @@ void modem_response_call(struct ipc_modem_data *data, struct ipc_message *resp)
/*
* if (data->in_call)
* modem_exec_call_answer(data->client);
- * if (out_call)
+ * if (data->out_call)
* modem_snd_no_mic_mute(data->client);
*/
break;
@@ -384,7 +384,7 @@ void modem_response_net(struct ipc_modem_data *data,
MODEM_LOG_INFO,
"Requesting outgoing call to %s!\n",
data->call_number);
- modem_exec_call_out(data->client, data->call_number);
+ modem_exec_call_out(data, data->call_number);
}
data->call_done = 1;
break;
diff --git a/tools/ipc-modem.h b/tools/ipc-modem.h
index 8a24d6f..09c021d 100644
--- a/tools/ipc-modem.h
+++ b/tools/ipc-modem.h
@@ -52,6 +52,7 @@ struct ipc_modem_data {
/* State */
bool call_done;
bool in_call;
+ bool out_call;
};
void ipc_modem_log(struct ipc_client *client,
--
2.35.1
More information about the Replicant
mailing list