linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] android/gatt: Remove unneeded label from unregister_client
@ 2014-04-10 18:40 Marcin Kraglak
  2014-04-10 18:40 ` [PATCH 2/4] android/gatt: Simplify removing device from list Marcin Kraglak
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Marcin Kraglak @ 2014-04-10 18:40 UTC (permalink / raw)
  To: linux-bluetooth

---
 android/gatt.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index a7a7204..4a720cc 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -506,13 +506,11 @@ static void handle_client_unregister(const void *buf, uint16_t len)
 	if (!cl) {
 		error("gatt: client_if=%d not found", cmd->client_if);
 		status = HAL_STATUS_FAILED;
-		goto failed;
+	} else {
+		destroy_gatt_client(cl);
+		status = HAL_STATUS_SUCCESS;
 	}
 
-	destroy_gatt_client(cl);
-	status = HAL_STATUS_SUCCESS;
-
-failed:
 	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
 					HAL_OP_GATT_CLIENT_UNREGISTER, status);
 }
-- 
1.8.3.1


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

* [PATCH 2/4] android/gatt: Simplify removing device from list
  2014-04-10 18:40 [PATCH 1/4] android/gatt: Remove unneeded label from unregister_client Marcin Kraglak
@ 2014-04-10 18:40 ` Marcin Kraglak
  2014-04-10 18:40 ` [PATCH 3/4] android/gatt: Format string with address properly Marcin Kraglak
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Marcin Kraglak @ 2014-04-10 18:40 UTC (permalink / raw)
  To: linux-bluetooth

---
 android/gatt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/android/gatt.c b/android/gatt.c
index 4a720cc..857ffe0 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -1194,7 +1194,7 @@ reply:
 
 	/* If this is last client do more cleaning */
 	connection_cleanup(dev);
-	dev = queue_remove_if(conn_list, match_dev_by_bdaddr, &dev->bdaddr);
+	queue_remove(conn_list, dev);
 	put_device_on_disc_list(dev);
 }
 
-- 
1.8.3.1


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

* [PATCH 3/4] android/gatt: Format string with address properly
  2014-04-10 18:40 [PATCH 1/4] android/gatt: Remove unneeded label from unregister_client Marcin Kraglak
  2014-04-10 18:40 ` [PATCH 2/4] android/gatt: Simplify removing device from list Marcin Kraglak
@ 2014-04-10 18:40 ` Marcin Kraglak
  2014-04-11 13:56   ` Szymon Janc
  2014-04-10 18:40 ` [PATCH 4/4] android/gatt: Remove double variable check Marcin Kraglak
  2014-04-11 13:54 ` [PATCH 1/4] android/gatt: Remove unneeded label from unregister_client Szymon Janc
  3 siblings, 1 reply; 6+ messages in thread
From: Marcin Kraglak @ 2014-04-10 18:40 UTC (permalink / raw)
  To: linux-bluetooth

---
 android/gatt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/android/gatt.c b/android/gatt.c
index 857ffe0..b246137 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -1150,12 +1150,14 @@ static void handle_client_disconnect(const void *buf, uint16_t len)
 {
 	const struct hal_cmd_gatt_client_disconnect *cmd = buf;
 	struct gatt_device *dev;
+	bdaddr_t bdaddr;
 	uint8_t status;
 	char addr[18];
 
 	DBG("");
 
-	ba2str((bdaddr_t *)&cmd->bdaddr, addr);
+	android2bdaddr(cmd->bdaddr, &bdaddr);
+	ba2str(&bdaddr, addr);
 
 	dev = find_device_by_conn_id(cmd->conn_id);
 	if (!dev) {
-- 
1.8.3.1


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

* [PATCH 4/4] android/gatt: Remove double variable check
  2014-04-10 18:40 [PATCH 1/4] android/gatt: Remove unneeded label from unregister_client Marcin Kraglak
  2014-04-10 18:40 ` [PATCH 2/4] android/gatt: Simplify removing device from list Marcin Kraglak
  2014-04-10 18:40 ` [PATCH 3/4] android/gatt: Format string with address properly Marcin Kraglak
@ 2014-04-10 18:40 ` Marcin Kraglak
  2014-04-11 13:54 ` [PATCH 1/4] android/gatt: Remove unneeded label from unregister_client Szymon Janc
  3 siblings, 0 replies; 6+ messages in thread
From: Marcin Kraglak @ 2014-04-10 18:40 UTC (permalink / raw)
  To: linux-bluetooth

---
 android/gatt.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index b246137..d9dff4f 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -580,13 +580,12 @@ static struct service *create_service(uint8_t id, bool primary, char *uuid,
 
 	/* Put primary service to our local list */
 	s->primary = primary;
-	if (s->primary)
+	if (s->primary) {
 		memcpy(&s->prim, data, sizeof(s->prim));
-	else
+	} else {
 		memcpy(&s->incl, data, sizeof(s->incl));
-
-	if (!s->primary)
 		return s;
+	}
 
 	/* For primary service allocate queue for included services */
 	s->included = queue_new();
-- 
1.8.3.1


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

* Re: [PATCH 1/4] android/gatt: Remove unneeded label from unregister_client
  2014-04-10 18:40 [PATCH 1/4] android/gatt: Remove unneeded label from unregister_client Marcin Kraglak
                   ` (2 preceding siblings ...)
  2014-04-10 18:40 ` [PATCH 4/4] android/gatt: Remove double variable check Marcin Kraglak
@ 2014-04-11 13:54 ` Szymon Janc
  3 siblings, 0 replies; 6+ messages in thread
From: Szymon Janc @ 2014-04-11 13:54 UTC (permalink / raw)
  To: Marcin Kraglak; +Cc: linux-bluetooth

Hi Marcin,

On Thursday 10 of April 2014 20:40:35 Marcin Kraglak wrote:
> ---
>  android/gatt.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/android/gatt.c b/android/gatt.c
> index a7a7204..4a720cc 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -506,13 +506,11 @@ static void handle_client_unregister(const void *buf, uint16_t len)
>  	if (!cl) {
>  		error("gatt: client_if=%d not found", cmd->client_if);
>  		status = HAL_STATUS_FAILED;
> -		goto failed;
> +	} else {
> +		destroy_gatt_client(cl);
> +		status = HAL_STATUS_SUCCESS;
>  	}
>  
> -	destroy_gatt_client(cl);
> -	status = HAL_STATUS_SUCCESS;
> -
> -failed:
>  	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
>  					HAL_OP_GATT_CLIENT_UNREGISTER, status);
>  }
> 

All patches applied. Thanks.

-- 
Best regards, 
Szymon Janc

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

* Re: [PATCH 3/4] android/gatt: Format string with address properly
  2014-04-10 18:40 ` [PATCH 3/4] android/gatt: Format string with address properly Marcin Kraglak
@ 2014-04-11 13:56   ` Szymon Janc
  0 siblings, 0 replies; 6+ messages in thread
From: Szymon Janc @ 2014-04-11 13:56 UTC (permalink / raw)
  To: Marcin Kraglak; +Cc: linux-bluetooth

Hi Marcin,

On Thursday 10 of April 2014 20:40:37 Marcin Kraglak wrote:
> ---
>  android/gatt.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/android/gatt.c b/android/gatt.c
> index 857ffe0..b246137 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -1150,12 +1150,14 @@ static void handle_client_disconnect(const void *buf, uint16_t len)
>  {
>  	const struct hal_cmd_gatt_client_disconnect *cmd = buf;
>  	struct gatt_device *dev;
> +	bdaddr_t bdaddr;
>  	uint8_t status;
>  	char addr[18];
>  
>  	DBG("");
>  
> -	ba2str((bdaddr_t *)&cmd->bdaddr, addr);
> +	android2bdaddr(cmd->bdaddr, &bdaddr);
> +	ba2str(&bdaddr, addr);
>  
>  	dev = find_device_by_conn_id(cmd->conn_id);
>  	if (!dev) {
> 

I've pushed this patch but should we do at least sanity check on passed
device address in this command ie. check if connection id and address match?

-- 
Best regards, 
Szymon Janc

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

end of thread, other threads:[~2014-04-11 13:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-10 18:40 [PATCH 1/4] android/gatt: Remove unneeded label from unregister_client Marcin Kraglak
2014-04-10 18:40 ` [PATCH 2/4] android/gatt: Simplify removing device from list Marcin Kraglak
2014-04-10 18:40 ` [PATCH 3/4] android/gatt: Format string with address properly Marcin Kraglak
2014-04-11 13:56   ` Szymon Janc
2014-04-10 18:40 ` [PATCH 4/4] android/gatt: Remove double variable check Marcin Kraglak
2014-04-11 13:54 ` [PATCH 1/4] android/gatt: Remove unneeded label from unregister_client Szymon Janc

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