Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: Use macros for connectionless slave broadcast features

Add the LMP feature constants for connectionless slave broadcast
and use them for capability testing.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>

authored by

Marcel Holtmann and committed by
Johan Hedberg
53b834d2 c6d16490

+15 -3
+6
include/net/bluetooth/hci.h
··· 275 275 #define LMP_EXTFEATURES 0x80 276 276 277 277 /* Extended LMP features */ 278 + #define LMP_CSB_MASTER 0x01 279 + #define LMP_CSB_SLAVE 0x02 280 + #define LMP_SYNC_TRAIN 0x04 281 + #define LMP_SYNC_SCAN 0x08 282 + 283 + /* Host features */ 278 284 #define LMP_HOST_SSP 0x01 279 285 #define LMP_HOST_LE 0x02 280 286 #define LMP_HOST_LE_BREDR 0x04
+6
include/net/bluetooth/hci_core.h
··· 798 798 #define lmp_transp_capable(dev) ((dev)->features[0][2] & LMP_TRANSPARENT) 799 799 800 800 /* ----- Extended LMP capabilities ----- */ 801 + #define lmp_csb_master_capable(dev) ((dev)->features[2][0] & LMP_CSB_MASTER) 802 + #define lmp_csb_slave_capable(dev) ((dev)->features[2][0] & LMP_CSB_SLAVE) 803 + #define lmp_sync_train_capable(dev) ((dev)->features[2][0] & LMP_SYNC_TRAIN) 804 + #define lmp_sync_scan_capable(dev) ((dev)->features[2][0] & LMP_SYNC_SCAN) 805 + 806 + /* ----- Host capabilities ----- */ 801 807 #define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP) 802 808 #define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) 803 809 #define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))
+3 -3
net/bluetooth/hci_core.c
··· 1228 1228 /* If Connectionless Slave Broadcast master role is supported 1229 1229 * enable all necessary events for it. 1230 1230 */ 1231 - if (hdev->features[2][0] & 0x01) { 1231 + if (lmp_csb_master_capable(hdev)) { 1232 1232 events[1] |= 0x40; /* Triggered Clock Capture */ 1233 1233 events[1] |= 0x80; /* Synchronization Train Complete */ 1234 1234 events[2] |= 0x10; /* Slave Page Response Timeout */ ··· 1238 1238 /* If Connectionless Slave Broadcast slave role is supported 1239 1239 * enable all necessary events for it. 1240 1240 */ 1241 - if (hdev->features[2][0] & 0x02) { 1241 + if (lmp_csb_slave_capable(hdev)) { 1242 1242 events[2] |= 0x01; /* Synchronization Train Received */ 1243 1243 events[2] |= 0x02; /* CSB Receive */ 1244 1244 events[2] |= 0x04; /* CSB Timeout */ ··· 1309 1309 hci_set_event_mask_page_2(req); 1310 1310 1311 1311 /* Check for Synchronization Train support */ 1312 - if (hdev->features[2][0] & 0x04) 1312 + if (lmp_sync_train_capable(hdev)) 1313 1313 hci_req_add(req, HCI_OP_READ_SYNC_TRAIN_PARAMS, 0, NULL); 1314 1314 } 1315 1315