Re: [RFC v2 1/2] Bluetooth: Use defines instead of integer literals

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mikel,

On Thu, May 30, 2013, Mikel Astiz wrote:
> Make the code in hci_get_auth_req() more readable by using the
> defined macros instead of inlining magic numbers.
> 
> Signed-off-by: Timo Mueller <timo.mueller@xxxxxxxxxxxx>
> Signed-off-by: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>
> ---
>  net/bluetooth/hci_event.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 0437200..777a040 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -31,6 +31,7 @@
>  #include <net/bluetooth/mgmt.h>
>  #include <net/bluetooth/a2mp.h>
>  #include <net/bluetooth/amp.h>
> +#include <net/bluetooth/smp.h>
>  
>  /* Handle HCI Event packets */
>  
> @@ -3024,17 +3025,18 @@ unlock:
>  static u8 hci_get_auth_req(struct hci_conn *conn)
>  {
>  	/* If remote requests dedicated bonding follow that lead */
> -	if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) {
> +	if ((conn->remote_auth & ~0x01) == HCI_AT_DEDICATED_BONDING) {
>  		/* If both remote and local IO capabilities allow MITM
>  		 * protection then require it, otherwise don't */
> -		if (conn->remote_cap == 0x03 || conn->io_capability == 0x03)
> +		if (conn->remote_cap == SMP_IO_NO_INPUT_OUTPUT ||
> +		    conn->io_capability == SMP_IO_NO_INPUT_OUTPUT)

Why are you using SMP_* defines here and not HCI_*? If the HCI ones are
missing in some header file please feel free to add them.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux