($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Steve Schrock <steve.schrock@getcruise.com>
To: ofono@lists.linux.dev
Cc: Steve Schrock <steve.schrock@getcruise.com>
Subject: [PATCH v2 3/4] qmi: Allow for 16-bit service types in the type hash
Date: Thu, 29 Feb 2024 09:31:40 -0600	[thread overview]
Message-ID: <20240229153151.36410-3-steve.schrock@getcruise.com> (raw)
In-Reply-To: <20240229153151.36410-1-steve.schrock@getcruise.com>

Only QMUX has client ids and they fit into 8 bits.
---
 drivers/qmimodem/qmi.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index d2f28bec..acb10d6b 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -734,6 +734,11 @@ static void service_notify(const void *key, void *value, void *user_data)
 				result);
 }
 
+static unsigned int service_list_create_hash(uint16_t service_type, uint8_t client_id)
+{
+	return (service_type | (client_id << 16));
+}
+
 static void handle_indication(struct qmi_device *device,
 			uint8_t service_type, uint8_t client_id,
 			uint16_t message, uint16_t length, const void *data)
@@ -757,8 +762,7 @@ static void handle_indication(struct qmi_device *device,
 		return;
 	}
 
-	hash_id = service_type | (client_id << 8);
-
+	hash_id = service_list_create_hash(service_type, client_id);
 	service = l_hashmap_lookup(device->service_list,
 					L_UINT_TO_PTR(hash_id));
 
@@ -1696,8 +1700,8 @@ static void qmux_client_create_callback(uint16_t message, uint16_t length,
 					service->client_id,
 					service->info.service_type);
 
-	hash_id = service->info.service_type | (service->client_id << 8);
-
+	hash_id = service_list_create_hash(service->info.service_type,
+							service->client_id);
 	l_hashmap_replace(device->service_list, L_UINT_TO_PTR(hash_id),
 				service, (void **) &old_service);
 
@@ -2525,8 +2529,8 @@ void qmi_service_unref(struct qmi_service *service)
 	qmi_service_cancel_all(service);
 	qmi_service_unregister_all(service);
 
-	hash_id = service->info.service_type | (service->client_id << 8);
-
+	hash_id = service_list_create_hash(service->info.service_type,
+							service->client_id);
 	l_hashmap_remove(device->service_list, L_UINT_TO_PTR(hash_id));
 
 	if (device->ops->client_release)
-- 
2.43.2


-- 


*Confidentiality Note:* We care about protecting our proprietary 
information, confidential material, and trade secrets. This message may 
contain some or all of those things. Cruise will suffer material harm if 
anyone other than the intended recipient disseminates or takes any action 
based on this message. If you have received this message (including any 
attachments) in error, please delete it immediately and notify the sender 
promptly.

  parent reply	other threads:[~2024-02-29 15:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 15:31 [PATCH v2 1/4] qmi: Create a method to find a service by type Steve Schrock
2024-02-29 15:31 ` [PATCH v2 2/4] qmi: Add more service info to qmi_service Steve Schrock
2024-02-29 15:31 ` Steve Schrock [this message]
2024-02-29 15:31 ` [PATCH v2 4/4] qmi: Enable basic client creation if it is not subclassed Steve Schrock
2024-02-29 16:40 ` [PATCH v2 1/4] qmi: Create a method to find a service by type 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=20240229153151.36410-3-steve.schrock@getcruise.com \
    --to=steve.schrock@getcruise.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).