linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Subject: [PATCH_v2 4/4] android/hidhost: Free all connected devices in profile cleanup call
Date: Tue, 19 Nov 2013 16:56:28 +0200	[thread overview]
Message-ID: <1384872988-19914-4-git-send-email-ravikumar.veeramally@linux.intel.com> (raw)
In-Reply-To: <1384872988-19914-1-git-send-email-ravikumar.veeramally@linux.intel.com>

This can be easily verified with haltest tool.
---
 android/hidhost.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/android/hidhost.c b/android/hidhost.c
index 049dd6d..502b10b 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -1226,6 +1226,14 @@ bool bt_hid_register(int sk, const bdaddr_t *addr)
 	return true;
 }
 
+static void free_hid_devices(gpointer data, gpointer user_data)
+{
+	struct hid_device *dev = data;
+
+	bt_hid_notify_state(dev, HAL_HIDHOST_STATE_DISCONNECTED);
+	hid_device_free(dev);
+}
+
 void bt_hid_unregister(void)
 {
 	DBG("");
@@ -1233,6 +1241,8 @@ void bt_hid_unregister(void)
 	if (notification_sk < 0)
 		return;
 
+	g_slist_foreach(devices, free_hid_devices, NULL);
+	devices = NULL;
 	notification_sk = -1;
 
 	if (ctrl_io) {
-- 
1.8.3.2


  parent reply	other threads:[~2013-11-19 14:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 14:56 [PATCH_v2 1/4] android/hal-pan: Return error in case of unsupported PAN roles Ravi kumar Veeramally
2013-11-19 14:56 ` [PATCH_v2 2/4] android: Handle multiple init(register) and cleanup(unregister) calls properly Ravi kumar Veeramally
2013-11-20  7:02   ` Szymon Janc
2013-11-20  9:09     ` Luiz Augusto von Dentz
2013-11-19 14:56 ` [PATCH_v2 3/4] android/hidhost: Handle error case properly in interrupt_connect_cb Ravi kumar Veeramally
2013-11-19 14:56 ` Ravi kumar Veeramally [this message]
2013-11-19 16:20 ` [PATCH_v2 1/4] android/hal-pan: Return error in case of unsupported PAN roles Johan Hedberg

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=1384872988-19914-4-git-send-email-ravikumar.veeramally@linux.intel.com \
    --to=ravikumar.veeramally@linux.intel.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;
as well as URLs for NNTP newsgroup(s).