public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Andre Guedes <aguedespe@gmail.com>
Cc: linux-bluetooth@vger.kernel.org, andre.guedes@openbossa.org
Subject: Re: [RFC 2/4] Bluetooth: Add HCI_PINQUIRY to dev_flags
Date: Tue, 20 Mar 2012 08:53:42 -0700	[thread overview]
Message-ID: <1332258822.1870.17.camel@aeonflux> (raw)
In-Reply-To: <1332210772-13806-3-git-send-email-aguedespe@gmail.com>

Hi Andre,

> This patch adds the HCI_PINQUIRY flag to dev_flags. This flag tracks
> if periodic inquiry is enabled or not.
> 
> Signed-off-by: Andre Guedes <aguedespe@gmail.com>
> ---
>  include/net/bluetooth/hci.h |    1 +
>  net/bluetooth/hci_event.c   |   10 +++++++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index d74645e..b3e89bf 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -102,6 +102,7 @@ enum {
>  	HCI_DISCOVERABLE,
>  	HCI_LINK_SECURITY,
>  	HCI_PENDING_CLASS,
> +	HCI_PINQUIRY,

call this HCI_PERIODIC_INQ. Since PINQUIRY is horrible to distinguish
from INQUIRY.

>  };
>  
>  /* HCI ioctl defines */
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index af0c5a2..4d13843 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -75,6 +75,11 @@ static void hci_cc_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb)
>  	__u8 status = *((__u8 *) skb->data);
>  
>  	BT_DBG("%s status 0x%x", hdev->name, status);
> +
> +	if (status)
> +		return;
> +
> +	set_bit(HCI_PINQUIRY, &hdev->dev_flags);
>  }
>  
>  static void hci_cc_exit_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb)
> @@ -86,6 +91,8 @@ static void hci_cc_exit_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb)
>  	if (status)
>  		return;
>  
> +	clear_bit(HCI_PINQUIRY, &hdev->dev_flags);
> +
>  	hci_conn_check_pending(hdev);
>  }
>  
> @@ -200,7 +207,8 @@ static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb)
>  	hci_req_complete(hdev, HCI_OP_RESET, status);
>  
>  	/* Reset all non-persistent flags */
> -	hdev->dev_flags &= ~(BIT(HCI_LE_SCAN) | BIT(HCI_PENDING_CLASS));
> +	hdev->dev_flags &= ~(BIT(HCI_LE_SCAN) | BIT(HCI_PENDING_CLASS) |
> +							BIT(HCI_PINQUIRY));

And as homework for another patch, we should have a simple mask define
for persistent or non-persistent flags that is defined right next to the
enum. This will otherwise get out of control.

>  
>  	hdev->discovery.state = DISCOVERY_STOPPED;
>  }

Other than the flag name change, this looks fine.

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel



  reply	other threads:[~2012-03-20 15:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-20  2:32 [RFC 0/4] Periodic Inquiry Handling Andre Guedes
2012-03-20  2:32 ` [RFC 1/4] Bluetooth: Add Periodic Inquiry command complete handler Andre Guedes
2012-03-20 15:50   ` Marcel Holtmann
2012-03-20  2:32 ` [RFC 2/4] Bluetooth: Add HCI_PINQUIRY to dev_flags Andre Guedes
2012-03-20 15:53   ` Marcel Holtmann [this message]
2012-03-21  2:21     ` Andre Guedes
2012-03-20  2:32 ` [RFC 3/4] Bluetooth: Check HCI_PINQUIRY in start_discovery Andre Guedes
2012-03-20 15:54   ` Marcel Holtmann
2012-03-20  2:32 ` [RFC 4/4] Bluetooth: Ignore inquiry results from periodic inquiry Andre Guedes
2012-03-20 15:55   ` Marcel Holtmann

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=1332258822.1870.17.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=aguedespe@gmail.com \
    --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