public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Andre Guedes <andre.guedes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: Remove MGMT_ADDR_INVALID macro
Date: Sat, 31 Mar 2012 06:39:13 +0200	[thread overview]
Message-ID: <1333168753.1870.261.camel@aeonflux> (raw)
In-Reply-To: <1333148706-11008-1-git-send-email-andre.guedes@openbossa.org>

Hi Andre,

> This patch removes the MGMT_ADDR_INVALID macro. If the address type
> isn't LE, we consider it is BR/EDR type.
> 
> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> ---
>  include/net/bluetooth/hci_core.h |    1 -
>  net/bluetooth/mgmt.c             |   19 +++++--------------
>  2 files changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index c8d5beb..c0b232c 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -967,7 +967,6 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
>  #define MGMT_ADDR_BREDR			0x00
>  #define MGMT_ADDR_LE_PUBLIC		0x01
>  #define MGMT_ADDR_LE_RANDOM		0x02
> -#define MGMT_ADDR_INVALID		0xff
>  
>  #define DISCOV_TYPE_BREDR		(BIT(MGMT_ADDR_BREDR))
>  #define DISCOV_TYPE_LE			(BIT(MGMT_ADDR_LE_PUBLIC) | \
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index b4f7e32..c13ea5f 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -1635,20 +1635,13 @@ failed:
>  
>  static u8 link_to_mgmt(u8 link_type, u8 addr_type)
>  {
> -	switch (link_type) {
> -	case LE_LINK:
> -		switch (addr_type) {
> -		case ADDR_LE_DEV_PUBLIC:
> -			return MGMT_ADDR_LE_PUBLIC;
> -		case ADDR_LE_DEV_RANDOM:
> +	if (link_type == LE_LINK) {
> +		if (addr_type == ADDR_LE_DEV_RANDOM)
>  			return MGMT_ADDR_LE_RANDOM;
> -		default:
> -			return MGMT_ADDR_INVALID;
> -		}
> -	case ACL_LINK:
> +		else
> +			return MGMT_ADDR_LE_PUBLIC;
> +	} else {
>  		return MGMT_ADDR_BREDR;
> -	default:
> -		return MGMT_ADDR_INVALID;
>  	}
>  }
>  

and what is the reason to remove the nice switch statement here? I
prefer a default label with a nice comment that we fallback to BR/EDR.

Regards

Marcel



  reply	other threads:[~2012-03-31  4:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-30 23:05 [PATCH] Bluetooth: Remove MGMT_ADDR_INVALID macro Andre Guedes
2012-03-31  4:39 ` Marcel Holtmann [this message]
2012-04-02 13:14   ` Andre Guedes
2012-04-02 17:40     ` Andre Guedes
2012-04-02 18:51       ` Johan Hedberg
2012-04-03 11:43         ` Andre Guedes
2012-04-03 11:46           ` Andre Guedes
2012-04-05  8:52             ` 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=1333168753.1870.261.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=andre.guedes@openbossa.org \
    --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