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 v2 10/23] qmi: voicecall: Drop use of qmi_service_create_shared
Date: Thu, 13 Jun 2024 16:41:19 -0500	[thread overview]
Message-ID: <20240613214134.1056517-10-denkenz@gmail.com> (raw)
In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com>

---
 drivers/qmimodem/voicecall.c | 40 ++++++++----------------------------
 plugins/gobi.c               |  3 ++-
 2 files changed, 10 insertions(+), 33 deletions(-)

diff --git a/drivers/qmimodem/voicecall.c b/drivers/qmimodem/voicecall.c
index 6af85caa840a..c7a5230f9680 100644
--- a/drivers/qmimodem/voicecall.c
+++ b/drivers/qmimodem/voicecall.c
@@ -709,48 +709,24 @@ static void send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
 	send_one_dtmf(vc, *dtmf, send_one_dtmf_cb, vd);
 }
 
-static void create_voice_cb(struct qmi_service *service, void *user_data)
-{
-	struct ofono_voicecall *vc = user_data;
-	struct voicecall_data *data = ofono_voicecall_get_data(vc);
-
-	DBG("");
-
-	if (!service) {
-		ofono_error("Failed to request Voice service");
-		ofono_voicecall_remove(vc);
-		return;
-	}
-
-	if (!qmi_service_get_version(service, &data->major, &data->minor)) {
-		ofono_error("Failed to get Voice service version");
-		ofono_voicecall_remove(vc);
-		return;
-	}
-
-	data->voice = service;
-
-	qmi_service_register(data->voice, QMI_VOICE_ALL_CALL_STATUS_IND,
-				all_call_status_ind, vc, NULL);
-
-	ofono_voicecall_register(vc);
-}
-
 static int qmi_voicecall_probe(struct ofono_voicecall *vc,
 					unsigned int vendor, void *user_data)
 {
-	struct qmi_device *device = user_data;
+	struct qmi_service *voice = user_data;
 	struct voicecall_data *data;
 
 	DBG("");
 
 	data = l_new(struct voicecall_data, 1);
+	data->voice = voice;
 	data->call_list = l_queue_new();
 
-	ofono_voicecall_set_data(vc, data);
+	qmi_service_get_version(data->voice, &data->major, &data->minor);
+
+	qmi_service_register(data->voice, QMI_VOICE_ALL_CALL_STATUS_IND,
+				all_call_status_ind, vc, NULL);
 
-	qmi_service_create_shared(device, QMI_SERVICE_VOICE,
-					create_voice_cb, vc, NULL);
+	ofono_voicecall_set_data(vc, data);
 
 	return 0;
 }
@@ -764,13 +740,13 @@ static void qmi_voicecall_remove(struct ofono_voicecall *vc)
 	ofono_voicecall_set_data(vc, NULL);
 
 	qmi_service_free(data->voice);
-
 	l_queue_destroy(data->call_list, l_free);
 	l_free(data->full_dtmf);
 	l_free(data);
 }
 
 static const struct ofono_voicecall_driver driver = {
+	.flags		= OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE,
 	.probe		= qmi_voicecall_probe,
 	.remove		= qmi_voicecall_remove,
 	.dial		= dial,
diff --git a/plugins/gobi.c b/plugins/gobi.c
index deeccb7879f2..0494959dc838 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -722,7 +722,8 @@ static void gobi_pre_sim(struct ofono_modem *modem)
 						qmi_service_clone(data->dms));
 
 	if (data->features & GOBI_VOICE)
-		ofono_voicecall_create(modem, 0, "qmimodem", data->device);
+		ofono_voicecall_create(modem, 0, "qmimodem",
+					qmi_service_clone(data->voice));
 
 	if (data->features & GOBI_PDS)
 		ofono_location_reporting_create(modem, 0, "qmimodem",
-- 
2.45.0


  parent reply	other threads:[~2024-06-13 21:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 21:41 [PATCH v2 01/23] gobi: Remove phonebook and stk atom creation Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 02/23] qmi: lookup shared family directly by type Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 03/23] core: allow multiple args in atom constructors Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 04/23] unit: Update unit tests to the new API Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 05/23] core: Support register on probe flag Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 06/23] qmi: introduce qmi_service_clone Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 07/23] gobi: request needed services at .enable() Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 08/23] qmi: devinfo: Drop use of qmi_service_create_shared Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 09/23] qmi: sim-legacy: " Denis Kenzior
2024-06-13 21:41 ` Denis Kenzior [this message]
2024-06-13 21:41 ` [PATCH v2 11/23] qmi: call-barring: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 12/23] qmi: call-forwarding: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 13/23] qmi: call-settings: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 14/23] qmi: ussd: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 15/23] qmi: location-reporting: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 16/23] qmi: sms: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 17/23] qmi: netreg: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 18/23] qmi: netmon: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 19/23] qmi: lte: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 20/23] qmi: gprs-context: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 21/23] qmi: sim: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 22/23] qmi: gprs: " Denis Kenzior
2024-06-13 21:41 ` [PATCH v2 23/23] qmi: radio-settings: " Denis Kenzior
2024-06-14 15:10 ` [PATCH v2 01/23] gobi: Remove phonebook and stk atom creation 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=20240613214134.1056517-10-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