Linux bluetooth development
 help / color / mirror / Atom feed
From: Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
To: linux-bluetooth@vger.kernel.org
Cc: Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
Subject: [PATCH 2/4] android/gatt: Fix sending device to (dis)connect callback
Date: Thu, 10 Apr 2014 16:34:52 +0200	[thread overview]
Message-ID: <1397140494-4023-2-git-send-email-jakub.tyszkowski@tieto.com> (raw)
In-Reply-To: <1397140494-4023-1-git-send-email-jakub.tyszkowski@tieto.com>

This fixes casting void* at wrong structure. We pass device, not bdaddr
as user data.
---
 android/gatt.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index ff19767..525ad41 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -760,12 +760,11 @@ static void put_device_on_disc_list(struct gatt_device *dev)
 static gboolean disconnected_cb(GIOChannel *io, GIOCondition cond,
 							gpointer user_data)
 {
-	bdaddr_t *addr = user_data;
-	struct gatt_device *dev;
+	struct gatt_device *dev = user_data;
 	int sock, err = 0;
 	socklen_t len;
 
-	dev = queue_remove_if(conn_list, match_dev_by_bdaddr, addr);
+	queue_remove(conn_list, dev);
 
 	sock = g_io_channel_unix_get_fd(io);
 	len = sizeof(err);
@@ -811,16 +810,14 @@ static void send_client_connect_notify(void *data, void *user_data)
 
 static void connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 {
-	bdaddr_t *addr = user_data;
-	struct gatt_device *dev;
+	struct gatt_device *dev = user_data;
 	struct hal_ev_gatt_client_connect ev;
 	GAttrib *attrib;
 	static uint32_t conn_id = 0;
 	int32_t status;
 
 	/* Take device from conn waiting queue */
-	dev = queue_remove_if(conn_wait_queue, match_dev_by_bdaddr, addr);
-	if (!dev) {
+	if (!queue_remove(conn_wait_queue, dev)) {
 		error("gatt: Device not on the connect wait queue!?");
 		g_io_channel_shutdown(io, TRUE, NULL);
 		return;
-- 
1.9.1


  reply	other threads:[~2014-04-10 14:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-10 14:34 [PATCH 1/4] android/gatt: Trivial whitespace fixes Jakub Tyszkowski
2014-04-10 14:34 ` Jakub Tyszkowski [this message]
2014-04-10 14:34 ` [PATCH 3/4] android/gatt: Add Client's refresh function call Jakub Tyszkowski
2014-04-10 14:34 ` [PATCH 4/4] android/gatt: Add cache check in Clients caching callbacks Jakub Tyszkowski
2014-04-11 13:43 ` [PATCH 1/4] android/gatt: Trivial whitespace fixes Szymon Janc

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=1397140494-4023-2-git-send-email-jakub.tyszkowski@tieto.com \
    --to=jakub.tyszkowski@tieto.com \
    --cc=linux-bluetooth@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox