Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH 3/4] qmi: voicecall: Remove ternary conditional use
Date: Mon, 22 Apr 2024 16:40:45 -0500	[thread overview]
Message-ID: <20240422214058.3411417-3-denkenz@gmail.com> (raw)
In-Reply-To: <20240422214058.3411417-1-denkenz@gmail.com>

Simplify the code a bit by removing the use of ternary conditional
operation and replace it with a 'remote_number_tlv' variable.  This also
removed a slight coding violation where a mix of spaces and tabs was
used for indentation.
---
 drivers/qmimodem/voicecall.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/qmimodem/voicecall.c b/drivers/qmimodem/voicecall.c
index 5afa3a057a71..dcb91c642c0c 100644
--- a/drivers/qmimodem/voicecall.c
+++ b/drivers/qmimodem/voicecall.c
@@ -263,7 +263,6 @@ static void all_call_status_ind(struct qmi_result *result, void *user_data)
 	int i;
 	int offset;
 	uint16_t len;
-	bool status = true;
 	int instance_size;
 	const struct qmi_voice_call_information *call_information;
 	const struct qmi_voice_remote_party_number *remote_party_number;
@@ -275,6 +274,8 @@ static void all_call_status_ind(struct qmi_result *result, void *user_data)
 	static const uint8_t RESULT_CALL_INFO_CALL_INFORMATION = 0x10;
 	static const uint8_t RESULT_CALL_INFO_REMOTE_NUMBER = 0x11;
 
+	uint8_t remote_number_tlv = RESULT_CALL_STATUS_REMOTE_NUMBER;
+
 	DBG("");
 
 	/* mandatory */
@@ -285,7 +286,7 @@ static void all_call_status_ind(struct qmi_result *result, void *user_data)
 		call_information = qmi_result_get(
 			result, RESULT_CALL_INFO_CALL_INFORMATION,
 			&len);
-		status = false;
+		remote_number_tlv = RESULT_CALL_INFO_REMOTE_NUMBER;
 	}
 
 	if (!call_information || len < sizeof(call_information->size)) {
@@ -306,11 +307,7 @@ static void all_call_status_ind(struct qmi_result *result, void *user_data)
 	}
 
 	/* mandatory */
-	remote_party_number = qmi_result_get(
-		result,
-		status ? RESULT_CALL_STATUS_REMOTE_NUMBER :
-			 RESULT_CALL_INFO_REMOTE_NUMBER,
-		&len);
+	remote_party_number = qmi_result_get(result, remote_number_tlv, &len);
 
 	if (!remote_party_number) {
 		DBG("Unable to retrieve remote numbers");
-- 
2.44.0


  parent reply	other threads:[~2024-04-22 21:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22 21:40 [PATCH 1/4] qmi: Remove redundant NULL check in qmi_param_new Denis Kenzior
2024-04-22 21:40 ` [PATCH 2/4] qmi: voicecall: Fix up code style violations Denis Kenzior
2024-04-22 21:40 ` Denis Kenzior [this message]
2024-04-22 21:40 ` [PATCH 4/4] qmi: voicecall: Remove redundant initialization to NULL Denis Kenzior
2024-04-22 22:30 ` [PATCH 1/4] qmi: Remove redundant NULL check in qmi_param_new patchwork-bot+ofono

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240422214058.3411417-3-denkenz@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox