Bluetooth: Add a define for the HCI persistent flags mask
authorJohan Hedberg <johan.hedberg@intel.com>
Fri, 15 Mar 2013 22:06:57 +0000 (17:06 -0500)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Mon, 18 Mar 2013 17:02:02 +0000 (14:02 -0300)
We'll need to use this mask also when powering off the HCI device
so it's better to have this in a single and visible place.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
include/net/bluetooth/hci.h
net/bluetooth/hci_event.c

index 1e723c76a8f60755e0a3f00c3364c11b7c59de32..1e40222e9dd05fbf26579163a1b4f28e6f0cbec6 100644 (file)
@@ -122,6 +122,11 @@ enum {
        HCI_PERIODIC_INQ,
 };
 
+/* A mask for the flags that are supposed to remain when a reset happens
+ * or the HCI device is closed.
+ */
+#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ))
+
 /* HCI ioctl defines */
 #define HCIDEVUP       _IOW('H', 201, int)
 #define HCIDEVDOWN     _IOW('H', 202, int)
index 5f2d008f33524f3452328c9cb6a593e7eeb0eee0..ed4ecd930a715394f8bd4565e735ff3ccc1dbe9c 100644 (file)
@@ -194,7 +194,7 @@ static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb)
        clear_bit(HCI_RESET, &hdev->flags);
 
        /* Reset all non-persistent flags */
-       hdev->dev_flags &= ~(BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ));
+       hdev->dev_flags &= ~HCI_PERSISTENT_MASK;
 
        hdev->discovery.state = DISCOVERY_STOPPED;
        hdev->inq_tx_power = HCI_TX_POWER_INVALID;