public inbox for ofono@lists.linux.dev
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH v2 04/33] qmi: Add qmi_qrtr_node_get_service
Date: Tue, 18 Jun 2024 15:01:46 -0500	[thread overview]
Message-ID: <20240618200231.1129282-4-denkenz@gmail.com> (raw)
In-Reply-To: <20240618200231.1129282-1-denkenz@gmail.com>

Introduce a new method that will return a qmi_service object handle
immediately, if possible.  This allows the lightweight service handles
to be obtained without requiring the caller to provide a callback
function and waiting for the event loop to invoke it.  On QRTR, the
underlying socket can access all services directly without needing to
exchange any messages to allocate a client for that service first, as
done by QMUX using QMI_CTL_GET_CLIENT_ID.
---
 drivers/qmimodem/qmi.c | 26 ++++++++++++++++++++++++++
 drivers/qmimodem/qmi.h |  7 ++++---
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index c5a4a37b917d..c3b1f7fef64f 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -2332,6 +2332,32 @@ struct qmi_device *qmi_device_new_qrtr(void)
 	return &qrtr->super;
 }
 
+struct qmi_service *qmi_qrtr_node_get_service(struct qmi_device *device,
+						uint32_t type)
+{
+	struct service_family *family;
+	const struct qmi_service_info *info;
+
+	if (!device)
+		return NULL;
+
+	if (type == QMI_SERVICE_CONTROL)
+		return NULL;
+
+	family = l_hashmap_lookup(device->family_list, L_UINT_TO_PTR(type));
+	if (family)
+		goto done;
+
+	info = __find_service_info_by_type(device, type);
+	if (!info)
+		return NULL;
+
+	family = service_family_create(device, info, 0);
+	l_hashmap_insert(device->family_list, L_UINT_TO_PTR(type), family);
+done:
+	return service_create(family);
+}
+
 struct qmi_param *qmi_param_new(void)
 {
 	return l_new(struct qmi_param, 1);
diff --git a/drivers/qmimodem/qmi.h b/drivers/qmimodem/qmi.h
index 3e532ec25abd..604e4e7e8659 100644
--- a/drivers/qmimodem/qmi.h
+++ b/drivers/qmimodem/qmi.h
@@ -58,9 +58,9 @@ enum qmi_data_endpoint_type {
 
 typedef void (*qmi_destroy_func_t)(void *user_data);
 
-
 struct qmi_device;
 struct qmi_result;
+struct qmi_service;
 
 typedef void (*qmi_debug_func_t)(const char *str, void *user_data);
 typedef void (*qmi_shutdown_func_t)(void *user_data);
@@ -90,6 +90,9 @@ bool qmi_device_set_expected_data_format(struct qmi_device *device,
 struct qmi_device *qmi_device_new_qmux(const char *device);
 struct qmi_device *qmi_device_new_qrtr(void);
 
+struct qmi_service *qmi_qrtr_node_get_service(struct qmi_device *device,
+						uint32_t type);
+
 struct qmi_param;
 
 struct qmi_param *qmi_param_new(void);
@@ -128,8 +131,6 @@ void qmi_result_print_tlvs(struct qmi_result *result);
 
 int qmi_error_to_ofono_cme(int qmi_error);
 
-struct qmi_service;
-
 typedef void (*qmi_create_func_t)(struct qmi_service *service, void *user_data);
 
 bool qmi_service_create_shared(struct qmi_device *device,
-- 
2.45.0


  parent reply	other threads:[~2024-06-18 20:02 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18 20:01 [PATCH v2 01/33] qmi: Remove qmi_free() Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 02/33] qmi: Rename qmi_result_func_t Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 03/33] qmi: Drop unused major/minor information Denis Kenzior
2024-06-18 20:01 ` Denis Kenzior [this message]
2024-06-18 20:01 ` [PATCH v2 05/33] plugins: Add new qrtrqmi modem driver Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 06/33] gobi: Use correct attribute name in docs Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 07/33] udevng: Use new qrtrqmi driver for MHI and SoC modems Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 08/33] gobi: Remove qrtr support Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 09/33] udevng: Do not set DeviceProtocol Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 10/33] unit: Rename device to node Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 11/33] qmi: Rename qmi_device_new_qrtr to qmi_qrtr_node_new Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 12/33] qmi: Rename qmi_device_new_qmux to qmi_qmux_device_new Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 13/33] unit: Drop use of qmi_service_create_shared Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 14/33] qmi: qmux: Make shared service creation generic Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 15/33] qmi: Rename qmi_device_get_service_version Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 16/33] qmi: sms: Require at WMS version 1.2+ Denis Kenzior
2024-06-18 20:01 ` [PATCH v2 17/33] qmi: Rework qmi_service_get_version Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 18/33] qmi: break up qmi_device_free into qrtr & qmux variants Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 19/33] qmi: Convert DBG statements to __debug_device Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 20/33] qmi: introduce qmi_qrtr_node_lookup Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 21/33] qmi: split qmi_device_has_service into QRTR and QMUX version Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 22/33] qmi: split qmi_device_set_debug into QRTR and QMUX versions Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 23/33] qmi: Make qmi_qrtr_node methods take struct qmi_qrtr_node Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 24/33] qmi: Move expected data format handling into gobi Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 25/33] qmi: Rename and refactor qmi_device_discover Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 26/33] qmi: Rename qmi_device_shutdown Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 27/33] qmi: Rename qmi_device_qmux to qmi_qmux_device Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 28/33] qmi: Make qmux methods operate on 'qmi_qmux_device' Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 29/33] qmi: combine service_send_data into qmi_request Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 30/33] qmi: combine qmux_client_create_data " Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 31/33] gprs: Fix memory leak Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 32/33] qmi:gprs: Don't fail on unsupported INDICATION_REGISTER Denis Kenzior
2024-06-18 20:02 ` [PATCH v2 33/33] qmi: non-premultiplexed MHI devices Denis Kenzior

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=20240618200231.1129282-4-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