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 3/5] android: Handle multiple init(register) and cleanup(unregister) calls properly
Date: Tue, 19 Nov 2013 14:21:14 +0200 [thread overview]
Message-ID: <1384863676-12358-3-git-send-email-ravikumar.veeramally@linux.intel.com> (raw)
In-Reply-To: <1384863676-12358-1-git-send-email-ravikumar.veeramally@linux.intel.com>
This can be tested with haltest.
---
android/a2dp.c | 6 ++++++
android/bluetooth.c | 6 ++++++
android/hidhost.c | 6 ++++++
android/pan.c | 6 ++++++
4 files changed, 24 insertions(+)
diff --git a/android/a2dp.c b/android/a2dp.c
index 74d0082..28a1250 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -332,6 +332,9 @@ bool bt_a2dp_register(int sk, const bdaddr_t *addr)
DBG("");
+ if (notification_sk > 0)
+ return false;
+
bacpy(&adapter_addr, addr);
server = bt_io_listen(connect_cb, NULL, NULL, NULL, &err,
@@ -365,6 +368,9 @@ void bt_a2dp_unregister(void)
{
DBG("");
+ if (notification_sk < 0)
+ return;
+
notification_sk = -1;
bt_adapter_remove_record(record_id);
diff --git a/android/bluetooth.c b/android/bluetooth.c
index 7dc2ec3..7805d42 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -2275,6 +2275,9 @@ bool bt_bluetooth_register(int sk)
{
DBG("");
+ if (notification_sk > 0)
+ return false;
+
notification_sk = sk;
return true;
@@ -2284,5 +2287,8 @@ void bt_bluetooth_unregister(void)
{
DBG("");
+ if (notification_sk < 0)
+ return;
+
notification_sk = -1;
}
diff --git a/android/hidhost.c b/android/hidhost.c
index 842b8ad..a929a94 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -1190,6 +1190,9 @@ bool bt_hid_register(int sk, const bdaddr_t *addr)
DBG("");
+ if (notification_sk > 0)
+ return false;
+
bacpy(&adapter_addr, addr);
ctrl_io = bt_io_listen(connect_cb, NULL, NULL, NULL, &err,
@@ -1224,6 +1227,9 @@ void bt_hid_unregister(void)
{
DBG("");
+ if (notification_sk < 0)
+ return;
+
notification_sk = -1;
if (ctrl_io) {
diff --git a/android/pan.c b/android/pan.c
index fba86b8..970a8a7 100644
--- a/android/pan.c
+++ b/android/pan.c
@@ -95,6 +95,9 @@ bool bt_pan_register(int sk, const bdaddr_t *addr)
{
DBG("");
+ if (notification_sk > 0)
+ return false;
+
notification_sk = sk;
return true;
@@ -104,5 +107,8 @@ void bt_pan_unregister(void)
{
DBG("");
+ if (notification_sk < 0)
+ return;
+
notification_sk = -1;
}
--
1.8.3.2
next prev parent reply other threads:[~2013-11-19 12:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 12:21 [PATCH 1/5] android/pan: Fix wrong struct parameter in disconnect function call Ravi kumar Veeramally
2013-11-19 12:21 ` [PATCH 2/5] android/hal-pan: Return error in case of unsupported PAN roles Ravi kumar Veeramally
2013-11-19 13:27 ` Johan Hedberg
2013-11-19 13:51 ` Ravi Kumar Veeramally
2013-11-19 12:21 ` Ravi kumar Veeramally [this message]
2013-11-19 13:30 ` [PATCH 3/5] android: Handle multiple init(register) and cleanup(unregister) calls properly Johan Hedberg
2013-11-19 13:52 ` Ravi Kumar Veeramally
2013-11-19 12:21 ` [PATCH 4/5] android/hidhost: Handle error case properly in interrupt_connect_cb Ravi kumar Veeramally
2013-11-19 13:31 ` Johan Hedberg
2013-11-19 13:53 ` Ravi Kumar Veeramally
2013-11-19 12:21 ` [PATCH 5/5] android/hidhost: Free all connected devices in profile cleanup call Ravi kumar Veeramally
2013-11-19 13:35 ` Johan Hedberg
2013-11-19 13:55 ` Ravi Kumar Veeramally
2013-11-19 13:23 ` [PATCH 1/5] android/pan: Fix wrong struct parameter in disconnect function call 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=1384863676-12358-3-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).