mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-05-02 05:13:57 +00:00
Bluetooth: mgmt: improve get_adv_instance_flags() readability
Switch if and else conditions to replace a negative statement by a positive one which makes the condition more readable. Signed-off-by: Florian Grandel <fgrandel@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
411b4121e3
commit
bea28e6599
1 changed files with 16 additions and 14 deletions
|
@ -962,7 +962,21 @@ static u32 get_adv_instance_flags(struct hci_dev *hdev, u8 instance)
|
||||||
u32 flags;
|
u32 flags;
|
||||||
struct adv_info *adv_instance;
|
struct adv_info *adv_instance;
|
||||||
|
|
||||||
if (instance != 0x00) {
|
if (instance == 0x00) {
|
||||||
|
/* Instance 0 always manages the "Tx Power" and "Flags"
|
||||||
|
* fields
|
||||||
|
*/
|
||||||
|
flags = MGMT_ADV_FLAG_TX_POWER | MGMT_ADV_FLAG_MANAGED_FLAGS;
|
||||||
|
|
||||||
|
/* For instance 0, the HCI_ADVERTISING_CONNECTABLE setting
|
||||||
|
* corresponds to the "connectable" instance flag.
|
||||||
|
*/
|
||||||
|
if (hci_dev_test_flag(hdev, HCI_ADVERTISING_CONNECTABLE))
|
||||||
|
flags |= MGMT_ADV_FLAG_CONNECTABLE;
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
adv_instance = hci_find_adv_instance(hdev, instance);
|
adv_instance = hci_find_adv_instance(hdev, instance);
|
||||||
|
|
||||||
/* Return 0 when we got an invalid instance identifier. */
|
/* Return 0 when we got an invalid instance identifier. */
|
||||||
|
@ -970,18 +984,6 @@ static u32 get_adv_instance_flags(struct hci_dev *hdev, u8 instance)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return adv_instance->flags;
|
return adv_instance->flags;
|
||||||
}
|
|
||||||
|
|
||||||
/* Instance 0 always manages the "Tx Power" and "Flags" fields */
|
|
||||||
flags = MGMT_ADV_FLAG_TX_POWER | MGMT_ADV_FLAG_MANAGED_FLAGS;
|
|
||||||
|
|
||||||
/* For instance 0, the HCI_ADVERTISING_CONNECTABLE setting corresponds
|
|
||||||
* to the "connectable" instance flag.
|
|
||||||
*/
|
|
||||||
if (hci_dev_test_flag(hdev, HCI_ADVERTISING_CONNECTABLE))
|
|
||||||
flags |= MGMT_ADV_FLAG_CONNECTABLE;
|
|
||||||
|
|
||||||
return flags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance)
|
static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance)
|
||||||
|
|
Loading…
Add table
Reference in a new issue