Bluetooth: Use BT_CMD_TEST macro for testing supported commands
Make code easier to read and more consistent. Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This commit is contained in:
parent
9c5c2f8baf
commit
a7bf9de0ee
3 changed files with 9 additions and 9 deletions
|
@ -67,7 +67,7 @@ int prng_init(void)
|
|||
int ret;
|
||||
|
||||
/* Check first that HCI_LE_Rand is supported */
|
||||
if (!(bt_dev.supported_commands[27] & BIT(7))) {
|
||||
if (!BT_CMD_TEST(bt_dev.supported_commands, 27, 7)) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ static void report_completed_packet(struct net_buf *buf)
|
|||
net_buf_destroy(buf);
|
||||
|
||||
/* Do nothing if controller to host flow control is not supported */
|
||||
if (!(bt_dev.supported_commands[10] & 0x20)) {
|
||||
if (!BT_CMD_TEST(bt_dev.supported_commands, 10, 5)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1314,7 +1314,7 @@ static int set_flow_control(void)
|
|||
int err;
|
||||
|
||||
/* Check if host flow control is actually supported */
|
||||
if (!(bt_dev.supported_commands[10] & 0x20)) {
|
||||
if (!BT_CMD_TEST(bt_dev.supported_commands, 10, 5)) {
|
||||
BT_WARN("Controller to host flow control not supported");
|
||||
return 0;
|
||||
}
|
||||
|
@ -3802,8 +3802,8 @@ static int le_set_event_mask(void)
|
|||
* If "LE Read Local P-256 Public Key" and "LE Generate DH Key" are
|
||||
* supported we need to enable events generated by those commands.
|
||||
*/
|
||||
if ((bt_dev.supported_commands[34] & 0x02) &&
|
||||
(bt_dev.supported_commands[34] & 0x04)) {
|
||||
if ((BT_CMD_TEST(bt_dev.supported_commands, 34, 1)) &&
|
||||
(BT_CMD_TEST(bt_dev.supported_commands, 34, 2))) {
|
||||
mask |= BT_EVT_MASK_LE_P256_PUBLIC_KEY_COMPLETE;
|
||||
mask |= BT_EVT_MASK_LE_GENERATE_DHKEY_COMPLETE;
|
||||
}
|
||||
|
@ -5698,8 +5698,8 @@ int bt_pub_key_gen(struct bt_pub_key_cb *new_cb)
|
|||
* ECC support. If "LE Generate DH Key" is not supported then there
|
||||
* is no point in reading local public key.
|
||||
*/
|
||||
if (!(bt_dev.supported_commands[34] & 0x02) ||
|
||||
!(bt_dev.supported_commands[34] & 0x04)) {
|
||||
if (!BT_CMD_TEST(bt_dev.supported_commands, 34, 1) ||
|
||||
!BT_CMD_TEST(bt_dev.supported_commands, 34, 2)) {
|
||||
BT_WARN("ECC HCI commands not available");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
|
@ -4563,8 +4563,8 @@ static bool le_sc_supported(void)
|
|||
* "LE Read Local P-256 Public Key" and "LE Generate DH Key" commands.
|
||||
* Otherwise LE SC are not supported.
|
||||
*/
|
||||
return (bt_dev.supported_commands[34] & 0x02) &&
|
||||
(bt_dev.supported_commands[34] & 0x04);
|
||||
return BT_CMD_TEST(bt_dev.supported_commands, 34, 1) &&
|
||||
BT_CMD_TEST(bt_dev.supported_commands, 34, 2);
|
||||
}
|
||||
|
||||
int bt_smp_init(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue