diff mbox series

[v2,12/23] qmi: call-forwarding: Drop use of qmi_service_create_shared

Message ID 20240613214134.1056517-12-denkenz@gmail.com (mailing list archive)
State Accepted
Commit bb9f9390831b2b9c93029355746799c941095f29
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
---
 drivers/qmimodem/call-forwarding.c | 29 ++++-------------------------
 plugins/gobi.c                     |  2 +-
 2 files changed, 5 insertions(+), 26 deletions(-)
diff mbox series

Patch

diff --git a/drivers/qmimodem/call-forwarding.c b/drivers/qmimodem/call-forwarding.c
index 191f3db75645..e7ae35153b09 100644
--- a/drivers/qmimodem/call-forwarding.c
+++ b/drivers/qmimodem/call-forwarding.c
@@ -276,39 +276,19 @@  static void qmi_erase(struct ofono_call_forwarding *cf, int type, int cls,
 	qmi_set(cf, type, cls, QMI_VOICE_SS_ACTION_ERASE, cb, data);
 }
 
-static void create_voice_cb(struct qmi_service *service, void *user_data)
-{
-	struct ofono_call_forwarding *cf = user_data;
-	struct call_forwarding_data *cfd = ofono_call_forwarding_get_data(cf);
-
-	DBG("");
-
-	if (!service) {
-		ofono_error("Failed to request Voice service");
-		ofono_call_forwarding_remove(cf);
-		return;
-	}
-
-	cfd->voice = service;
-
-	ofono_call_forwarding_register(cf);
-}
-
 static int qmi_call_forwarding_probe(struct ofono_call_forwarding *cf,
 					unsigned int vendor, void *user_data)
 {
-	struct qmi_device *device = user_data;
+	struct qmi_service *voice = user_data;
 	struct call_forwarding_data *cfd;
 
 	DBG("");
 
 	cfd = l_new(struct call_forwarding_data, 1);
+	cfd->voice = voice;
 
 	ofono_call_forwarding_set_data(cf, cfd);
 
-	qmi_service_create_shared(device, QMI_SERVICE_VOICE,
-					create_voice_cb, cf, NULL);
-
 	return 0;
 }
 
@@ -320,13 +300,12 @@  static void qmi_call_forwarding_remove(struct ofono_call_forwarding *cf)
 
 	ofono_call_forwarding_set_data(cf, NULL);
 
-	if (cfd->voice)
-		qmi_service_free(cfd->voice);
-
+	qmi_service_free(cfd->voice);
 	l_free(cfd);
 }
 
 static const struct ofono_call_forwarding_driver driver = {
+	.flags			= OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE,
 	.probe			= qmi_call_forwarding_probe,
 	.remove			= qmi_call_forwarding_remove,
 	.registration		= qmi_register,
diff --git a/plugins/gobi.c b/plugins/gobi.c
index 7c6885b79c7c..85ab427e9de5 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -838,7 +838,7 @@  static void gobi_post_online(struct ofono_modem *modem)
 		ofono_call_barring_create(modem, 0, "qmimodem",
 						qmi_service_clone(data->voice));
 		ofono_call_forwarding_create(modem, 0, "qmimodem",
-						data->device);
+						qmi_service_clone(data->voice));
 	}
 }