diff mbox series

[11/23] qmi: call-barring: Drop use of qmi_service_create_shared

Message ID 20240607224746.903769-11-denkenz@gmail.com (mailing list archive)
State Superseded
Headers show
Series [01/23] gobi: Remove phonebook and stk atom creation | expand

Commit Message

Denis Kenzior June 7, 2024, 10:47 p.m. UTC
---
 drivers/qmimodem/call-barring.c | 29 ++++-------------------------
 plugins/gobi.c                  |  3 ++-
 2 files changed, 6 insertions(+), 26 deletions(-)
diff mbox series

Patch

diff --git a/drivers/qmimodem/call-barring.c b/drivers/qmimodem/call-barring.c
index 2209b4049c13..8da805cfe6ca 100644
--- a/drivers/qmimodem/call-barring.c
+++ b/drivers/qmimodem/call-barring.c
@@ -190,39 +190,19 @@  error:
 	CALLBACK_WITH_FAILURE(cb, data);
 }
 
-static void create_voice_cb(struct qmi_service *service, void *user_data)
-{
-	struct ofono_call_barring *barr = user_data;
-	struct call_barring_data *bd = ofono_call_barring_get_data(barr);
-
-	DBG("");
-
-	if (!service) {
-		ofono_error("Failed to request Voice service");
-		ofono_call_barring_remove(barr);
-		return;
-	}
-
-	bd->voice = service;
-
-	ofono_call_barring_register(barr);
-}
-
 static int qmi_call_barring_probe(struct ofono_call_barring *barr,
 					unsigned int vendor, void *user_data)
 {
-	struct qmi_device *device = user_data;
+	struct qmi_service *voice = user_data;
 	struct call_barring_data *bd;
 
 	DBG("");
 
 	bd = l_new(struct call_barring_data, 1);
+	bd->voice = voice;
 
 	ofono_call_barring_set_data(barr, bd);
 
-	qmi_service_create_shared(device, QMI_SERVICE_VOICE,
-					create_voice_cb, barr, NULL);
-
 	return 0;
 }
 
@@ -234,13 +214,12 @@  static void qmi_call_barring_remove(struct ofono_call_barring *barr)
 
 	ofono_call_barring_set_data(barr, NULL);
 
-	if (bd->voice)
-		qmi_service_free(bd->voice);
-
+	qmi_service_free(bd->voice);
 	l_free(bd);
 }
 
 static const struct ofono_call_barring_driver driver = {
+	.flags			= OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE,
 	.probe			= qmi_call_barring_probe,
 	.remove			= qmi_call_barring_remove,
 	.set			= qmi_set,
diff --git a/plugins/gobi.c b/plugins/gobi.c
index f81fb8243bf8..1688d5478d59 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -847,7 +847,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_barring_create(modem, 0, "qmimodem", data->device);
+		ofono_call_barring_create(modem, 0, "qmimodem",
+						qmi_service_clone(data->voice));
 		ofono_call_forwarding_create(modem, 0, "qmimodem",
 						data->device);
 	}