aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-10-24 14:12:01 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-11-01 18:26:57 -0400
commit976eb20e61e33dd3e7840bc26bc5d33ab9ca9c5c (patch)
tree64ed0f7aa5b3064d96bf17ad1639535796aa28c4 /net/bluetooth/mgmt.c
parent761f09e4d6d2bfe4a517d14ca28aec041c8a7415 (diff)
Bluetooth: Make use feature test macros
For better code readability and avoiding simple bugs of checking the wrong byte of the features make use of feature test macros whenever possible. 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>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 11cabe7ef3c..585654bd250 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -565,7 +565,7 @@ static int update_eir(struct hci_dev *hdev)
565 if (!hdev_is_powered(hdev)) 565 if (!hdev_is_powered(hdev))
566 return 0; 566 return 0;
567 567
568 if (!(hdev->features[6] & LMP_EXT_INQ)) 568 if (!lmp_ext_inq_capable(hdev))
569 return 0; 569 return 0;
570 570
571 if (!test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) 571 if (!test_bit(HCI_SSP_ENABLED, &hdev->dev_flags))
@@ -1225,7 +1225,7 @@ static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
1225 } 1225 }
1226 1226
1227 val = !!cp->val; 1227 val = !!cp->val;
1228 enabled = !!(hdev->host_features[0] & LMP_HOST_LE); 1228 enabled = !!lmp_host_le_capable(hdev);
1229 1229
1230 if (!hdev_is_powered(hdev) || val == enabled) { 1230 if (!hdev_is_powered(hdev) || val == enabled) {
1231 bool changed = false; 1231 bool changed = false;
@@ -1261,7 +1261,7 @@ static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
1261 1261
1262 if (val) { 1262 if (val) {
1263 hci_cp.le = val; 1263 hci_cp.le = val;
1264 hci_cp.simul = !!(hdev->features[6] & LMP_SIMUL_LE_BR); 1264 hci_cp.simul = !!lmp_le_br_capable(hdev);
1265 } 1265 }
1266 1266
1267 err = hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(hci_cp), 1267 err = hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(hci_cp),
@@ -2923,7 +2923,7 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
2923 struct hci_cp_write_le_host_supported cp; 2923 struct hci_cp_write_le_host_supported cp;
2924 2924
2925 cp.le = 1; 2925 cp.le = 1;
2926 cp.simul = !!(hdev->features[6] & LMP_SIMUL_LE_BR); 2926 cp.simul = !!lmp_le_br_capable(hdev);
2927 2927
2928 hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, 2928 hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED,
2929 sizeof(cp), &cp); 2929 sizeof(cp), &cp);
@@ -3383,7 +3383,7 @@ static int clear_eir(struct hci_dev *hdev)
3383{ 3383{
3384 struct hci_cp_write_eir cp; 3384 struct hci_cp_write_eir cp;
3385 3385
3386 if (!(hdev->features[6] & LMP_EXT_INQ)) 3386 if (!lmp_ext_inq_capable(hdev))
3387 return 0; 3387 return 0;
3388 3388
3389 memset(hdev->eir, 0, sizeof(hdev->eir)); 3389 memset(hdev->eir, 0, sizeof(hdev->eir));