diff mbox series

[v2,13/23] qmi: call-settings: Drop use of qmi_service_create_shared

Message ID 20240613214134.1056517-13-denkenz@gmail.com (mailing list archive)
State Accepted
Commit c43de054332a1e6555533cd5f6465f000bb9361a
Headers show
Series [v2,01/23] gobi: Remove phonebook and stk atom creation | expand

Commit Message

Denis Kenzior June 13, 2024, 9:41 p.m. UTC
While here, drop 'sups_ind_id' member.  Explicitly unregistering from a
an indication is not required.  All indication registrations will be
automatically dropped when the service handle is freed using
qmi_service_free()
---
 drivers/qmimodem/call-settings.c | 37 ++++++--------------------------
 plugins/gobi.c                   |  3 ++-
 2 files changed, 8 insertions(+), 32 deletions(-)
diff mbox series

Patch

diff --git a/drivers/qmimodem/call-settings.c b/drivers/qmimodem/call-settings.c
index 676b39aaf487..3611c98894a0 100644
--- a/drivers/qmimodem/call-settings.c
+++ b/drivers/qmimodem/call-settings.c
@@ -21,7 +21,6 @@ 
 
 struct call_settings_data {
 	struct qmi_service *voice;
-	uint16_t sups_ind_id;
 };
 
 static void query_status(struct ofono_call_settings *cs, uint16_t message,
@@ -262,41 +261,20 @@  static void sups_ind(struct qmi_result *result, void *user_data)
 					clip->active, clip->provisioned);
 }
 
-static void create_voice_cb(struct qmi_service *service, void *user_data)
-{
-	struct ofono_call_settings *cs = user_data;
-	struct call_settings_data *csd = ofono_call_settings_get_data(cs);
-
-	DBG("");
-
-	if (!service) {
-		ofono_error("Failed to request Voice service");
-		ofono_call_settings_remove(cs);
-		return;
-	}
-
-	csd->voice = service;
-
-	csd->sups_ind_id = qmi_service_register(csd->voice, QMI_VOICE_SUPS_IND,
-						sups_ind, cs, NULL);
-
-	ofono_call_settings_register(cs);
-}
-
 static int qmi_call_settings_probe(struct ofono_call_settings *cs,
 					unsigned int vendor, void *user_data)
 {
-	struct qmi_device *device = user_data;
+	struct qmi_service *voice = user_data;
 	struct call_settings_data *csd;
 
 	DBG("");
 
 	csd = l_new(struct call_settings_data, 1);
+	csd->voice = voice;
 
-	ofono_call_settings_set_data(cs, csd);
+	qmi_service_register(csd->voice, QMI_VOICE_SUPS_IND, sups_ind, cs, NULL);
 
-	qmi_service_create_shared(device, QMI_SERVICE_VOICE,
-					create_voice_cb, cs, NULL);
+	ofono_call_settings_set_data(cs, csd);
 
 	return 0;
 }
@@ -309,15 +287,12 @@  static void qmi_call_settings_remove(struct ofono_call_settings *cs)
 
 	ofono_call_settings_set_data(cs, NULL);
 
-	if (csd->voice) {
-		qmi_service_unregister(csd->voice, csd->sups_ind_id);
-		qmi_service_free(csd->voice);
-	}
-
+	qmi_service_free(csd->voice);
 	l_free(csd);
 }
 
 static const struct ofono_call_settings_driver driver = {
+	.flags			= OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE,
 	.probe			= qmi_call_settings_probe,
 	.remove			= qmi_call_settings_remove,
 	.clip_query		= qmi_clip_query,
diff --git a/plugins/gobi.c b/plugins/gobi.c
index 85ab427e9de5..17160354c273 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -834,7 +834,8 @@  static void gobi_post_online(struct ofono_modem *modem)
 
 	if (data->features & GOBI_VOICE) {
 		ofono_ussd_create(modem, 0, "qmimodem", data->device);
-		ofono_call_settings_create(modem, 0, "qmimodem", data->device);
+		ofono_call_settings_create(modem, 0, "qmimodem",
+						qmi_service_clone(data->voice));
 		ofono_call_barring_create(modem, 0, "qmimodem",
 						qmi_service_clone(data->voice));
 		ofono_call_forwarding_create(modem, 0, "qmimodem",