diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-10-24 14:12:01 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-11-01 18:26:57 -0400 |
commit | 976eb20e61e33dd3e7840bc26bc5d33ab9ca9c5c (patch) | |
tree | 64ed0f7aa5b3064d96bf17ad1639535796aa28c4 /net/bluetooth/hci_event.c | |
parent | 761f09e4d6d2bfe4a517d14ca28aec041c8a7415 (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/hci_event.c')
-rw-r--r-- | net/bluetooth/hci_event.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index aa325eec40db..aae80531f8ce 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -460,10 +460,10 @@ static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) | |||
460 | 460 | ||
461 | static u8 hci_get_inquiry_mode(struct hci_dev *hdev) | 461 | static u8 hci_get_inquiry_mode(struct hci_dev *hdev) |
462 | { | 462 | { |
463 | if (hdev->features[6] & LMP_EXT_INQ) | 463 | if (lmp_ext_inq_capable(hdev)) |
464 | return 2; | 464 | return 2; |
465 | 465 | ||
466 | if (hdev->features[3] & LMP_RSSI_INQ) | 466 | if (lmp_inq_rssi_capable(hdev)) |
467 | return 1; | 467 | return 1; |
468 | 468 | ||
469 | if (hdev->manufacturer == 11 && hdev->hci_rev == 0x00 && | 469 | if (hdev->manufacturer == 11 && hdev->hci_rev == 0x00 && |
@@ -515,22 +515,22 @@ static void hci_setup_event_mask(struct hci_dev *hdev) | |||
515 | events[5] |= 0x10; /* Synchronous Connection Changed */ | 515 | events[5] |= 0x10; /* Synchronous Connection Changed */ |
516 | } | 516 | } |
517 | 517 | ||
518 | if (hdev->features[3] & LMP_RSSI_INQ) | 518 | if (lmp_inq_rssi_capable(hdev)) |
519 | events[4] |= 0x02; /* Inquiry Result with RSSI */ | 519 | events[4] |= 0x02; /* Inquiry Result with RSSI */ |
520 | 520 | ||
521 | if (lmp_sniffsubr_capable(hdev)) | 521 | if (lmp_sniffsubr_capable(hdev)) |
522 | events[5] |= 0x20; /* Sniff Subrating */ | 522 | events[5] |= 0x20; /* Sniff Subrating */ |
523 | 523 | ||
524 | if (hdev->features[5] & LMP_PAUSE_ENC) | 524 | if (lmp_pause_enc_capable(hdev)) |
525 | events[5] |= 0x80; /* Encryption Key Refresh Complete */ | 525 | events[5] |= 0x80; /* Encryption Key Refresh Complete */ |
526 | 526 | ||
527 | if (hdev->features[6] & LMP_EXT_INQ) | 527 | if (lmp_ext_inq_capable(hdev)) |
528 | events[5] |= 0x40; /* Extended Inquiry Result */ | 528 | events[5] |= 0x40; /* Extended Inquiry Result */ |
529 | 529 | ||
530 | if (lmp_no_flush_capable(hdev)) | 530 | if (lmp_no_flush_capable(hdev)) |
531 | events[7] |= 0x01; /* Enhanced Flush Complete */ | 531 | events[7] |= 0x01; /* Enhanced Flush Complete */ |
532 | 532 | ||
533 | if (hdev->features[7] & LMP_LSTO) | 533 | if (lmp_lsto_capable(hdev)) |
534 | events[6] |= 0x80; /* Link Supervision Timeout Changed */ | 534 | events[6] |= 0x80; /* Link Supervision Timeout Changed */ |
535 | 535 | ||
536 | if (lmp_ssp_capable(hdev)) { | 536 | if (lmp_ssp_capable(hdev)) { |
@@ -633,13 +633,13 @@ static void hci_setup(struct hci_dev *hdev) | |||
633 | } | 633 | } |
634 | } | 634 | } |
635 | 635 | ||
636 | if (hdev->features[3] & LMP_RSSI_INQ) | 636 | if (lmp_inq_rssi_capable(hdev)) |
637 | hci_setup_inquiry_mode(hdev); | 637 | hci_setup_inquiry_mode(hdev); |
638 | 638 | ||
639 | if (hdev->features[7] & LMP_INQ_TX_PWR) | 639 | if (lmp_inq_tx_pwr_capable(hdev)) |
640 | hci_send_cmd(hdev, HCI_OP_READ_INQ_RSP_TX_POWER, 0, NULL); | 640 | hci_send_cmd(hdev, HCI_OP_READ_INQ_RSP_TX_POWER, 0, NULL); |
641 | 641 | ||
642 | if (hdev->features[7] & LMP_EXTFEATURES) { | 642 | if (lmp_ext_feat_capable(hdev)) { |
643 | struct hci_cp_read_local_ext_features cp; | 643 | struct hci_cp_read_local_ext_features cp; |
644 | 644 | ||
645 | cp.page = 0x01; | 645 | cp.page = 0x01; |
@@ -686,11 +686,11 @@ static void hci_setup_link_policy(struct hci_dev *hdev) | |||
686 | 686 | ||
687 | if (lmp_rswitch_capable(hdev)) | 687 | if (lmp_rswitch_capable(hdev)) |
688 | link_policy |= HCI_LP_RSWITCH; | 688 | link_policy |= HCI_LP_RSWITCH; |
689 | if (hdev->features[0] & LMP_HOLD) | 689 | if (lmp_hold_capable(hdev)) |
690 | link_policy |= HCI_LP_HOLD; | 690 | link_policy |= HCI_LP_HOLD; |
691 | if (lmp_sniff_capable(hdev)) | 691 | if (lmp_sniff_capable(hdev)) |
692 | link_policy |= HCI_LP_SNIFF; | 692 | link_policy |= HCI_LP_SNIFF; |
693 | if (hdev->features[1] & LMP_PARK) | 693 | if (lmp_park_capable(hdev)) |
694 | link_policy |= HCI_LP_PARK; | 694 | link_policy |= HCI_LP_PARK; |
695 | 695 | ||
696 | cp.policy = cpu_to_le16(link_policy); | 696 | cp.policy = cpu_to_le16(link_policy); |
@@ -780,10 +780,10 @@ static void hci_set_le_support(struct hci_dev *hdev) | |||
780 | 780 | ||
781 | if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) { | 781 | if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) { |
782 | cp.le = 1; | 782 | cp.le = 1; |
783 | cp.simul = !!(hdev->features[6] & LMP_SIMUL_LE_BR); | 783 | cp.simul = !!lmp_le_br_capable(hdev); |
784 | } | 784 | } |
785 | 785 | ||
786 | if (cp.le != !!(hdev->host_features[0] & LMP_HOST_LE)) | 786 | if (cp.le != !!lmp_host_le_capable(hdev)) |
787 | hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(cp), | 787 | hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(cp), |
788 | &cp); | 788 | &cp); |
789 | } | 789 | } |