linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] android/hal: Merge bluetooth and sock register/unregister
@ 2013-11-15 10:13 Andrei Emeltchenko
  2013-11-15 10:13 ` [PATCH 2/3] android/hal: Remove unneeded code Andrei Emeltchenko
  2013-11-15 10:13 ` [PATCH 3/3] android/hal: Unregister Bluetooth on cleanup Andrei Emeltchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Andrei Emeltchenko @ 2013-11-15 10:13 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Bluetooth and Socket HAL are registered and unregistered at the
same time.
---
 android/main.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/android/main.c b/android/main.c
index a4f5e84..f72004c 100644
--- a/android/main.c
+++ b/android/main.c
@@ -87,10 +87,11 @@ static void service_register(void *buf, uint16_t len)
 		if (!bt_bluetooth_register(sk))
 			goto failed;
 
-		break;
-	case HAL_SERVICE_ID_SOCK:
-		if (!bt_socket_register(sk, &adapter_bdaddr))
+		if (!bt_socket_register(sk, &adapter_bdaddr)) {
+			bt_bluetooth_unregister();
 			goto failed;
+		}
+		services[HAL_SERVICE_ID_SOCK] = true;
 
 		break;
 	case HAL_SERVICE_ID_HIDHOST:
@@ -135,8 +136,6 @@ static void service_unregister(void *buf, uint16_t len)
 	switch (m->service_id) {
 	case HAL_SERVICE_ID_BLUETOOTH:
 		bt_bluetooth_unregister();
-		break;
-	case HAL_SERVICE_ID_SOCK:
 		bt_socket_unregister();
 		break;
 	case HAL_SERVICE_ID_HIDHOST:
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] android/hal: Remove unneeded code
  2013-11-15 10:13 [PATCH 1/3] android/hal: Merge bluetooth and sock register/unregister Andrei Emeltchenko
@ 2013-11-15 10:13 ` Andrei Emeltchenko
  2013-11-15 10:13 ` [PATCH 3/3] android/hal: Unregister Bluetooth on cleanup Andrei Emeltchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Andrei Emeltchenko @ 2013-11-15 10:13 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Socket HAL always registers with Bluetooth HAL and there is no sense
to send 2 commands over IPC.
---
 android/hal-bluetooth.c |    9 ---------
 1 file changed, 9 deletions(-)

diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index 078d537..8cd4327 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -347,15 +347,6 @@ static int init(bt_callbacks_t *callbacks)
 		goto fail;
 	}
 
-	cmd.service_id = HAL_SERVICE_ID_SOCK;
-
-	status = hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
-					sizeof(cmd), &cmd, NULL, NULL, NULL);
-	if (status != BT_STATUS_SUCCESS) {
-		error("Failed to register 'socket' service");
-		goto fail;
-	}
-
 	return status;
 
 fail:
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] android/hal: Unregister Bluetooth on cleanup
  2013-11-15 10:13 [PATCH 1/3] android/hal: Merge bluetooth and sock register/unregister Andrei Emeltchenko
  2013-11-15 10:13 ` [PATCH 2/3] android/hal: Remove unneeded code Andrei Emeltchenko
@ 2013-11-15 10:13 ` Andrei Emeltchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Andrei Emeltchenko @ 2013-11-15 10:13 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

---
 This is more like RFC. Shall we send this event or this will be cleaned up itself.

 android/hal-bluetooth.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index 8cd4327..4bf1183 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -379,11 +379,18 @@ static int disable(void)
 
 static void cleanup(void)
 {
+	struct hal_cmd_register_module cmd;
+
 	DBG("");
 
 	if (!interface_ready())
 		return;
 
+	cmd.service_id = HAL_SERVICE_ID_BLUETOOTH;
+
+	hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
+
 	hal_ipc_cleanup();
 
 	bt_hal_cbacks = NULL;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-15 10:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-15 10:13 [PATCH 1/3] android/hal: Merge bluetooth and sock register/unregister Andrei Emeltchenko
2013-11-15 10:13 ` [PATCH 2/3] android/hal: Remove unneeded code Andrei Emeltchenko
2013-11-15 10:13 ` [PATCH 3/3] android/hal: Unregister Bluetooth on cleanup Andrei Emeltchenko

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).