From: Denis Kenzior <denkenz@gmail.com>
To: ofono@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH v2 15/23] qmi: location-reporting: Drop use of qmi_service_create_shared
Date: Thu, 13 Jun 2024 16:41:24 -0500 [thread overview]
Message-ID: <20240613214134.1056517-15-denkenz@gmail.com> (raw)
In-Reply-To: <20240613214134.1056517-1-denkenz@gmail.com>
---
drivers/qmimodem/location-reporting.c | 50 ++++++++-------------------
plugins/gobi.c | 4 +--
2 files changed, 16 insertions(+), 38 deletions(-)
diff --git a/drivers/qmimodem/location-reporting.c b/drivers/qmimodem/location-reporting.c
index 669e9e6fdd41..1c9b9c9c3663 100644
--- a/drivers/qmimodem/location-reporting.c
+++ b/drivers/qmimodem/location-reporting.c
@@ -172,67 +172,46 @@ static void qmi_location_reporting_disable(struct ofono_location_reporting *lr,
}
static void set_event_cb(struct qmi_result *result, void *user_data)
-{
- struct ofono_location_reporting *lr = user_data;
-
- DBG("");
-
- ofono_location_reporting_register(lr);
-}
-
-static void create_pds_cb(struct qmi_service *service, void *user_data)
{
struct ofono_location_reporting *lr = user_data;
struct location_data *data = ofono_location_reporting_get_data(lr);
- struct qmi_param *param;
DBG("");
- if (!service) {
- ofono_error("Failed to request PDS service");
- ofono_location_reporting_remove(lr);
- return;
- }
-
- data->pds = service;
-
qmi_service_register(data->pds, QMI_PDS_EVENT,
event_notify, lr, NULL);
-
qmi_service_register(data->pds, QMI_PDS_STATE_IND,
state_notify, lr, NULL);
- param = qmi_param_new();
-
- qmi_param_append_uint8(param, QMI_PDS_PARAM_REPORT_NMEA, 0x01);
- qmi_param_append_uint8(param, QMI_PDS_PARAM_REPORT_NMEA_DEBUG, 0x00);
-
- if (qmi_service_send(data->pds, QMI_PDS_SET_EVENT, param,
- set_event_cb, lr, NULL) > 0)
- return;
-
- qmi_param_free(param);
-
ofono_location_reporting_register(lr);
}
static int qmi_location_reporting_probe(struct ofono_location_reporting *lr,
unsigned int vendor, void *user_data)
{
- struct qmi_device *device = user_data;
+ struct qmi_service *pds = user_data;
struct location_data *data;
+ struct qmi_param *param;
DBG("");
- data = l_new(struct location_data, 1);
+ param = qmi_param_new();
+ qmi_param_append_uint8(param, QMI_PDS_PARAM_REPORT_NMEA, 0x01);
+ qmi_param_append_uint8(param, QMI_PDS_PARAM_REPORT_NMEA_DEBUG, 0x00);
+
+ if (!qmi_service_send(pds, QMI_PDS_SET_EVENT, param,
+ set_event_cb, lr, NULL)) {
+ qmi_param_free(param);
+ qmi_service_free(pds);
+ return -EIO;
+ }
+ data = l_new(struct location_data, 1);
+ data->pds = pds;
data->fd = -1;
ofono_location_reporting_set_data(lr, data);
- qmi_service_create_shared(device, QMI_SERVICE_PDS, create_pds_cb, lr,
- NULL);
-
return 0;
}
@@ -245,7 +224,6 @@ static void qmi_location_reporting_remove(struct ofono_location_reporting *lr)
ofono_location_reporting_set_data(lr, NULL);
qmi_service_free(data->pds);
-
l_free(data);
}
diff --git a/plugins/gobi.c b/plugins/gobi.c
index 456a5d2363eb..a0f2fac3dede 100644
--- a/plugins/gobi.c
+++ b/plugins/gobi.c
@@ -725,9 +725,9 @@ static void gobi_pre_sim(struct ofono_modem *modem)
ofono_voicecall_create(modem, 0, "qmimodem",
qmi_service_clone(data->voice));
- if (data->features & GOBI_PDS)
+ if (data->features & GOBI_PDS) /* exclusive use, no need to clone */
ofono_location_reporting_create(modem, 0, "qmimodem",
- data->device);
+ l_steal_ptr(data->pds));
}
static void gobi_setup_gprs(struct ofono_modem *modem)
--
2.45.0
next prev 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 ` [PATCH v2 10/23] qmi: voicecall: " Denis Kenzior
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 ` Denis Kenzior [this message]
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-15-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