All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonas Bonn <jonas@southpole.se>
To: ofono@ofono.org
Subject: [RFC PATCH 11/30] qmi: remove unused qmi_service_unregister
Date: Wed, 28 Mar 2018 20:59:57 +0200	[thread overview]
Message-ID: <20180328190016.28509-12-jonas@southpole.se> (raw)
In-Reply-To: <20180328190016.28509-1-jonas@southpole.se>

[-- Attachment #1: Type: text/plain, Size: 3306 bytes --]

Nothing in the codebase saves the notify ID when calling
qmi_service_register.  Nothing, therefore ever calls
qmi_service_unregister, either.
---
 drivers/qmimodem/qmi.c | 43 +++----------------------------------------
 drivers/qmimodem/qmi.h |  3 +--
 2 files changed, 4 insertions(+), 42 deletions(-)

diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index 6cc858be..5ed41e0a 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -85,7 +85,6 @@ struct qmi_service {
 	uint16_t major;
 	uint16_t minor;
 	uint8_t client_id;
-	uint16_t next_notify_id;
 	GList *notify_list;
 };
 
@@ -112,7 +111,6 @@ struct qmi_request {
 };
 
 struct qmi_notify {
-	uint16_t id;
 	uint16_t message;
 	qmi_result_func_t callback;
 	void *user_data;
@@ -266,14 +264,6 @@ static void __notify_free(gpointer data, gpointer user_data)
 	g_free(notify);
 }
 
-static gint __notify_compare(gconstpointer a, gconstpointer b)
-{
-	const struct qmi_notify *notify = a;
-	uint16_t id = GPOINTER_TO_UINT(b);
-
-	return notify->id - id;
-}
-
 static gboolean __service_compare_shared(gpointer key, gpointer value,
 							gpointer user_data)
 {
@@ -2338,23 +2328,19 @@ bool qmi_service_cancel_all(struct qmi_service *service)
 	return true;
 }
 
-uint16_t qmi_service_register(struct qmi_service *service,
+bool qmi_service_register(struct qmi_service *service,
 				uint16_t message, qmi_result_func_t func,
 				void *user_data, qmi_destroy_func_t destroy)
 {
 	struct qmi_notify *notify;
 
 	if (!service || !func)
-		return 0;
+		return false;
 
 	notify = g_try_new0(struct qmi_notify, 1);
 	if (!notify)
-		return 0;
-
-	if (service->next_notify_id < 1)
-		service->next_notify_id = 1;
+		return false;
 
-	notify->id = service->next_notify_id++;
 	notify->message = message;
 	notify->callback = func;
 	notify->user_data = user_data;
@@ -2362,29 +2348,6 @@ uint16_t qmi_service_register(struct qmi_service *service,
 
 	service->notify_list = g_list_append(service->notify_list, notify);
 
-	return notify->id;
-}
-
-bool qmi_service_unregister(struct qmi_service *service, uint16_t id)
-{
-	unsigned int nid = id;
-	struct qmi_notify *notify;
-	GList *list;
-
-	if (!service || !id)
-		return false;
-
-	list = g_list_find_custom(service->notify_list,
-				GUINT_TO_POINTER(nid), __notify_compare);
-	if (!list)
-		return false;
-
-	notify = list->data;
-
-	service->notify_list = g_list_delete_link(service->notify_list, list);
-
-	__notify_free(notify, NULL);
-
 	return true;
 }
 
diff --git a/drivers/qmimodem/qmi.h b/drivers/qmimodem/qmi.h
index bb8eb4a0..2c0d5aff 100644
--- a/drivers/qmimodem/qmi.h
+++ b/drivers/qmimodem/qmi.h
@@ -172,8 +172,7 @@ uint16_t qmi_service_send(struct qmi_service *service,
 				void *user_data, qmi_destroy_func_t destroy);
 bool qmi_service_cancel_all(struct qmi_service *service);
 
-uint16_t qmi_service_register(struct qmi_service *service,
+bool qmi_service_register(struct qmi_service *service,
 				uint16_t message, qmi_result_func_t func,
 				void *user_data, qmi_destroy_func_t destroy);
-bool qmi_service_unregister(struct qmi_service *service, uint16_t id);
 bool qmi_service_unregister_all(struct qmi_service *service);
-- 
2.15.1


  parent reply	other threads:[~2018-03-28 18:59 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 18:59 [RFC PATCH 00/30] QMI rework Jonas Bonn
2018-03-28 18:59 ` [RFC PATCH 01/30] qmi: remove unused fields of service_send_data Jonas Bonn
2018-03-28 19:53   ` Denis Kenzior
2018-03-28 21:09     ` Jonas Bonn
2018-03-28 21:18       ` Denis Kenzior
2018-03-29 10:46     ` Jonas Bonn
2018-03-28 18:59 ` [RFC PATCH 02/30] qmi: remove headroom parameter from req_alloc Jonas Bonn
2018-03-28 18:59 ` [RFC PATCH 03/30] qmi: unify common request header setup Jonas Bonn
2018-03-28 18:59 ` [RFC PATCH 04/30] qmi: request_alloc has no meaningful failure path Jonas Bonn
2018-03-28 19:59   ` Denis Kenzior
2018-03-28 20:51     ` Jonas Bonn
2018-03-28 21:12       ` Denis Kenzior
2018-03-28 18:59 ` [RFC PATCH 05/30] qmi: push request_submit into request_alloc Jonas Bonn
2018-03-28 18:59 ` [RFC PATCH 06/30] qmi: rename request_alloc to request_submit Jonas Bonn
2018-03-28 18:59 ` [RFC PATCH 07/30] qmi: figure out request id without accessing header Jonas Bonn
2018-03-28 18:59 ` [RFC PATCH 08/30] qmi: make qmi_service_send return result Jonas Bonn
2018-03-28 18:59 ` [RFC PATCH 09/30] qmi: drop 'head' pointer from request_submit Jonas Bonn
2018-03-28 18:59 ` [RFC PATCH 10/30] qmi: remove unused qmi_service_cancel Jonas Bonn
2018-03-28 21:07   ` Denis Kenzior
2018-03-28 18:59 ` Jonas Bonn [this message]
2018-03-28 18:59 ` [RFC PATCH 12/30] qmi: replace GQueues for requests Jonas Bonn
2018-03-28 20:16   ` Denis Kenzior
2018-03-28 21:06     ` Jonas Bonn
2018-03-28 21:24       ` Denis Kenzior
2018-03-28 18:59 ` [RFC PATCH 13/30] qmi: assume version_list is up to date Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 14/30] qmi: absorb service_create_discover into service_create Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 15/30] qmi: drop discovery_queue Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 16/30] qmi: make services always shared Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 17/30] qmi: switch service_list to list_head type Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 18/30] qmi: switch notify_list " Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 19/30] qmi: drop unused struct field Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 20/30] qmi: reference version_info from device in services Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 21/30] qmi: make version_list private Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 22/30] qmi: move client_id to qmi_version Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 23/30] qmi: use standard endian macros Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 24/30] qmi: convert version_list to struct list head Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 25/30] qmi: move service device to service_info Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 26/30] qmi: make all services unique instances backed by common description Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 27/30] qmi: drop qmi_service_ref function Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 28/30] qmi: rename qmi_service_create/unref to open/close Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 29/30] qmi: pass service directly to request_submit Jonas Bonn
2018-03-28 19:00 ` [RFC PATCH 30/30] qmi: add requests to service queue Jonas Bonn
2018-03-28 21:51 ` [RFC PATCH 00/30] QMI rework Denis Kenzior
2018-03-29 10:31   ` Jonas Bonn
2018-03-29 15:55     ` Denis Kenzior
2018-03-29 16:43       ` Jonas Bonn
2018-03-29 18:08         ` 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=20180328190016.28509-12-jonas@southpole.se \
    --to=jonas@southpole.se \
    --cc=ofono@ofono.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.