diff mbox series

[v2,18/23] qmi: netmon: Drop use of qmi_service_create_shared

Message ID 20240613214134.1056517-18-denkenz@gmail.com (mailing list archive)
State Accepted
Commit 75dd974806109c360bb3b450822a4e80928ceef1
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/netmon.c | 26 +++-----------------------
 plugins/gobi.c            |  3 ++-
 2 files changed, 5 insertions(+), 24 deletions(-)
diff mbox series

Patch

diff --git a/drivers/qmimodem/netmon.c b/drivers/qmimodem/netmon.c
index f45a9efd6af8..82e0f2a4c737 100644
--- a/drivers/qmimodem/netmon.c
+++ b/drivers/qmimodem/netmon.c
@@ -195,39 +195,19 @@  static void qmi_netmon_request_update(struct ofono_netmon *netmon,
 	l_free(cbd);
 }
 
-static void create_nas_cb(struct qmi_service *service, void *user_data)
-{
-	struct ofono_netmon *netmon = user_data;
-	struct netmon_data *nmd = ofono_netmon_get_data(netmon);
-
-	DBG("");
-
-	if (!service) {
-		ofono_error("Failed to request NAS service");
-		ofono_netmon_remove(netmon);
-		return;
-	}
-
-	nmd->nas = service;
-
-	ofono_netmon_register(netmon);
-}
-
 static int qmi_netmon_probe(struct ofono_netmon *netmon,
 					unsigned int vendor, void *user_data)
 {
-	struct qmi_device *device = user_data;
+	struct qmi_service *nas = user_data;
 	struct netmon_data *nmd;
 
 	DBG("");
 
 	nmd = l_new(struct netmon_data, 1);
+	nmd->nas = nas;
 
 	ofono_netmon_set_data(netmon, nmd);
 
-	qmi_service_create_shared(device, QMI_SERVICE_NAS,
-					create_nas_cb, netmon, NULL);
-
 	return 0;
 }
 
@@ -240,11 +220,11 @@  static void qmi_netmon_remove(struct ofono_netmon *netmon)
 	ofono_netmon_set_data(netmon, NULL);
 
 	qmi_service_free(nmd->nas);
-
 	l_free(nmd);
 }
 
 static const struct ofono_netmon_driver driver = {
+	.flags			= OFONO_ATOM_DRIVER_FLAG_REGISTER_ON_PROBE,
 	.probe			= qmi_netmon_probe,
 	.remove			= qmi_netmon_remove,
 	.request_update		= qmi_netmon_request_update,
diff --git a/plugins/gobi.c b/plugins/gobi.c
index 34aa363cf82e..8e16e63cd6e2 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -831,7 +831,8 @@  static void gobi_post_online(struct ofono_modem *modem)
 	if (data->features & GOBI_NAS) {
 		ofono_netreg_create(modem, 0, "qmimodem",
 						qmi_service_clone(data->nas));
-		ofono_netmon_create(modem, 0, "qmimodem", data->device);
+		ofono_netmon_create(modem, 0, "qmimodem",
+						qmi_service_clone(data->nas));
 	}
 
 	if (data->features & GOBI_VOICE) {