All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Remove needless HCI_MGMT flag check
@ 2012-02-10 13:49 Andre Guedes
  2012-02-10 16:21 ` Gustavo Padovan
  2012-02-14 12:24 ` Johan Hedberg
  0 siblings, 2 replies; 4+ messages in thread
From: Andre Guedes @ 2012-02-10 13:49 UTC (permalink / raw)
  To: linux-bluetooth

This patch removes HCI_MGMT flag check in hci_cs_inquiry. There is
no need to check this flag before calling mgmt_start_discovery_failed
since if the hdev is not managed by mgmt interface this function does
nothing.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
---
 net/bluetooth/hci_event.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index b0784ee..5f93fdd 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1143,8 +1143,7 @@ static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
 		hci_req_complete(hdev, HCI_OP_INQUIRY, status);
 		hci_conn_check_pending(hdev);
 		hci_dev_lock(hdev);
-		if (test_bit(HCI_MGMT, &hdev->dev_flags))
-			mgmt_start_discovery_failed(hdev, status);
+		mgmt_start_discovery_failed(hdev, status);
 		hci_dev_unlock(hdev);
 		return;
 	}
-- 
1.7.9


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

* Re: [PATCH] Bluetooth: Remove needless HCI_MGMT flag check
  2012-02-10 13:49 [PATCH] Bluetooth: Remove needless HCI_MGMT flag check Andre Guedes
@ 2012-02-10 16:21 ` Gustavo Padovan
  2012-02-14 12:24 ` Johan Hedberg
  1 sibling, 0 replies; 4+ messages in thread
From: Gustavo Padovan @ 2012-02-10 16:21 UTC (permalink / raw)
  To: Andre Guedes; +Cc: linux-bluetooth

Hi Andre,

* Andre Guedes <andre.guedes@openbossa.org> [2012-02-10 10:49:38 -0300]:

> This patch removes HCI_MGMT flag check in hci_cs_inquiry. There is
> no need to check this flag before calling mgmt_start_discovery_failed
> since if the hdev is not managed by mgmt interface this function does
> nothing.
> 
> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> ---
>  net/bluetooth/hci_event.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index b0784ee..5f93fdd 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -1143,8 +1143,7 @@ static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
>  		hci_req_complete(hdev, HCI_OP_INQUIRY, status);
>  		hci_conn_check_pending(hdev);
>  		hci_dev_lock(hdev);
> -		if (test_bit(HCI_MGMT, &hdev->dev_flags))
> -			mgmt_start_discovery_failed(hdev, status);
> +		mgmt_start_discovery_failed(hdev, status);
>  		hci_dev_unlock(hdev);
>  		return;
>  	}

Acked-by: Gustavo F. Padovan <padovan@profusion.mobi>

	Gustavo

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

* Re: [PATCH] Bluetooth: Remove needless HCI_MGMT flag check
  2012-02-10 13:49 [PATCH] Bluetooth: Remove needless HCI_MGMT flag check Andre Guedes
  2012-02-10 16:21 ` Gustavo Padovan
@ 2012-02-14 12:24 ` Johan Hedberg
  2012-02-14 14:09   ` Andre Guedes
  1 sibling, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2012-02-14 12:24 UTC (permalink / raw)
  To: Andre Guedes; +Cc: linux-bluetooth

Hi Andre,

On Fri, Feb 10, 2012, Andre Guedes wrote:
> This patch removes HCI_MGMT flag check in hci_cs_inquiry. There is
> no need to check this flag before calling mgmt_start_discovery_failed
> since if the hdev is not managed by mgmt interface this function does
> nothing.
> 
> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> ---
>  net/bluetooth/hci_event.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index b0784ee..5f93fdd 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -1143,8 +1143,7 @@ static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
>  		hci_req_complete(hdev, HCI_OP_INQUIRY, status);
>  		hci_conn_check_pending(hdev);
>  		hci_dev_lock(hdev);
> -		if (test_bit(HCI_MGMT, &hdev->dev_flags))
> -			mgmt_start_discovery_failed(hdev, status);
> +		mgmt_start_discovery_failed(hdev, status);
>  		hci_dev_unlock(hdev);
>  		return;
>  	}

There are lots of checks like this in hci_event.c. If there's going to
be a patch for them I'd remove all of them in one go instead of
addressing individual ones like this.

There is some benefit of keeping them though: the code doesn't need to
check for pending mgmt commands, encode event messages and iterate
through all HCI sockets just to figure out that that that nothing needs
to be done.

Johan

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

* Re: [PATCH] Bluetooth: Remove needless HCI_MGMT flag check
  2012-02-14 12:24 ` Johan Hedberg
@ 2012-02-14 14:09   ` Andre Guedes
  0 siblings, 0 replies; 4+ messages in thread
From: Andre Guedes @ 2012-02-14 14:09 UTC (permalink / raw)
  To: johan.hedberg, linux-bluetooth

Hi Johan,

On Tue, Feb 14, 2012 at 9:24 AM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> Hi Andre,
>
> On Fri, Feb 10, 2012, Andre Guedes wrote:
>> This patch removes HCI_MGMT flag check in hci_cs_inquiry. There is
>> no need to check this flag before calling mgmt_start_discovery_failed
>> since if the hdev is not managed by mgmt interface this function does
>> nothing.
>>
>> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
>> ---
>>  net/bluetooth/hci_event.c |    3 +--
>>  1 files changed, 1 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
>> index b0784ee..5f93fdd 100644
>> --- a/net/bluetooth/hci_event.c
>> +++ b/net/bluetooth/hci_event.c
>> @@ -1143,8 +1143,7 @@ static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
>>               hci_req_complete(hdev, HCI_OP_INQUIRY, status);
>>               hci_conn_check_pending(hdev);
>>               hci_dev_lock(hdev);
>> -             if (test_bit(HCI_MGMT, &hdev->dev_flags))
>> -                     mgmt_start_discovery_failed(hdev, status);
>> +             mgmt_start_discovery_failed(hdev, status);
>>               hci_dev_unlock(hdev);
>>               return;
>>       }
>
> There are lots of checks like this in hci_event.c. If there's going to
> be a patch for them I'd remove all of them in one go instead of
> addressing individual ones like this.
>
> There is some benefit of keeping them though: the code doesn't need to
> check for pending mgmt commands, encode event messages and iterate
> through all HCI sockets just to figure out that that that nothing needs
> to be done.

Year, I see the benefit. However, in the long run this benefit will
be very small since mgmt interface will be used by default.

Anyway, if we wanna keep this check, perhaps it would be a good idea
we move it inside mgmt functions.

So, what you guys think, should we simply remove this check?

BR,

Andre

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

end of thread, other threads:[~2012-02-14 14:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-10 13:49 [PATCH] Bluetooth: Remove needless HCI_MGMT flag check Andre Guedes
2012-02-10 16:21 ` Gustavo Padovan
2012-02-14 12:24 ` Johan Hedberg
2012-02-14 14:09   ` Andre Guedes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.