aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/bluetooth
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-03-13 05:11:00 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2015-03-13 06:09:25 -0400
commitd7a5a11d7fa80beb43d5f7cb421c86f9b4d21200 (patch)
treefe24ddd4137d73c89f7198d9422544d31568ccf7 /include/net/bluetooth
parentcc91cb042ce5dab66fedeb94260b18f193ed33d9 (diff)
Bluetooth: Introduce hci_dev_test_flag helper macro
Instead of manually coding test_bit on hdev->dev_flags all the time, use hci_dev_test_flag helper macro. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'include/net/bluetooth')
-rw-r--r--include/net/bluetooth/hci_core.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 5cc5a192359d..05e95a75aba5 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -502,6 +502,8 @@ extern struct list_head hci_cb_list;
502extern rwlock_t hci_dev_list_lock; 502extern rwlock_t hci_dev_list_lock;
503extern struct mutex hci_cb_list_lock; 503extern struct mutex hci_cb_list_lock;
504 504
505#define hci_dev_test_flag(hdev, nr) test_bit((nr), &(hdev)->dev_flags)
506
505/* ----- HCI interface to upper protocols ----- */ 507/* ----- HCI interface to upper protocols ----- */
506int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 508int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
507int l2cap_disconn_ind(struct hci_conn *hcon); 509int l2cap_disconn_ind(struct hci_conn *hcon);
@@ -598,14 +600,14 @@ enum {
598static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) 600static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
599{ 601{
600 struct hci_dev *hdev = conn->hdev; 602 struct hci_dev *hdev = conn->hdev;
601 return test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) && 603 return hci_dev_test_flag(hdev, HCI_SSP_ENABLED) &&
602 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags); 604 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags);
603} 605}
604 606
605static inline bool hci_conn_sc_enabled(struct hci_conn *conn) 607static inline bool hci_conn_sc_enabled(struct hci_conn *conn)
606{ 608{
607 struct hci_dev *hdev = conn->hdev; 609 struct hci_dev *hdev = conn->hdev;
608 return test_bit(HCI_SC_ENABLED, &hdev->dev_flags) && 610 return hci_dev_test_flag(hdev, HCI_SC_ENABLED) &&
609 test_bit(HCI_CONN_SC_ENABLED, &conn->flags); 611 test_bit(HCI_CONN_SC_ENABLED, &conn->flags);
610} 612}
611 613
@@ -1025,10 +1027,10 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
1025#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) 1027#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE))
1026#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) 1028#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))
1027 1029
1028#define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \ 1030#define hdev_is_powered(dev) (test_bit(HCI_UP, &(dev)->flags) && \
1029 !test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) 1031 !hci_dev_test_flag(dev, HCI_AUTO_OFF))
1030#define bredr_sc_enabled(dev) (lmp_sc_capable(dev) && \ 1032#define bredr_sc_enabled(dev) (lmp_sc_capable(dev) && \
1031 test_bit(HCI_SC_ENABLED, &(dev)->dev_flags)) 1033 hci_dev_test_flag(dev, HCI_SC_ENABLED))
1032 1034
1033/* ----- HCI protocols ----- */ 1035/* ----- HCI protocols ----- */
1034#define HCI_PROTO_DEFER 0x01 1036#define HCI_PROTO_DEFER 0x01