mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
Bluetooth: make hdev->adv_instance_timeout a boolean
Mesh uses millisecond time units for advertisements instead of seconds as normally. These values go to hdev->adv_instance_timeout, which then has mixed units. hdev->adv_instance_timeout is however only used as a true/false flag. Make hdev->adv_instance_timeout boolean flag, to avoid possible future problems with its mixed-units values. Signed-off-by: Pauli Virtanen <pav@iki.fi> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
8a8d51eeed
commit
3d9526b171
|
|
@ -601,7 +601,7 @@ struct hci_dev {
|
|||
struct list_head adv_instances;
|
||||
unsigned int adv_instance_cnt;
|
||||
__u8 cur_adv_instance;
|
||||
__u16 adv_instance_timeout;
|
||||
bool adv_instance_timeout;
|
||||
struct delayed_work adv_instance_expire;
|
||||
|
||||
struct idr adv_monitors_idr;
|
||||
|
|
|
|||
|
|
@ -1617,7 +1617,7 @@ int hci_remove_adv_instance(struct hci_dev *hdev, u8 instance)
|
|||
if (hdev->cur_adv_instance == instance) {
|
||||
if (hdev->adv_instance_timeout) {
|
||||
cancel_delayed_work(&hdev->adv_instance_expire);
|
||||
hdev->adv_instance_timeout = 0;
|
||||
hdev->adv_instance_timeout = false;
|
||||
}
|
||||
hdev->cur_adv_instance = 0x00;
|
||||
}
|
||||
|
|
@ -1647,7 +1647,7 @@ void hci_adv_instances_clear(struct hci_dev *hdev)
|
|||
|
||||
if (hdev->adv_instance_timeout) {
|
||||
disable_delayed_work(&hdev->adv_instance_expire);
|
||||
hdev->adv_instance_timeout = 0;
|
||||
hdev->adv_instance_timeout = false;
|
||||
}
|
||||
|
||||
list_for_each_entry_safe(adv_instance, n, &hdev->adv_instances, list) {
|
||||
|
|
@ -2437,7 +2437,7 @@ struct hci_dev *hci_alloc_dev_priv(int sizeof_priv)
|
|||
hdev->adv_tx_power = HCI_TX_POWER_INVALID;
|
||||
hdev->adv_instance_cnt = 0;
|
||||
hdev->cur_adv_instance = 0x00;
|
||||
hdev->adv_instance_timeout = 0;
|
||||
hdev->adv_instance_timeout = false;
|
||||
|
||||
hdev->advmon_allowlist_duration = 300;
|
||||
hdev->advmon_no_filter_duration = 500;
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ static void reenable_adv(struct work_struct *work)
|
|||
static void cancel_adv_timeout(struct hci_dev *hdev)
|
||||
{
|
||||
if (hdev->adv_instance_timeout) {
|
||||
hdev->adv_instance_timeout = 0;
|
||||
hdev->adv_instance_timeout = false;
|
||||
cancel_delayed_work(&hdev->adv_instance_expire);
|
||||
}
|
||||
}
|
||||
|
|
@ -570,7 +570,7 @@ static void adv_timeout_expire(struct work_struct *work)
|
|||
|
||||
hci_dev_lock(hdev);
|
||||
|
||||
hdev->adv_instance_timeout = 0;
|
||||
hdev->adv_instance_timeout = false;
|
||||
|
||||
if (hdev->cur_adv_instance == 0x00)
|
||||
goto unlock;
|
||||
|
|
@ -2101,7 +2101,7 @@ int hci_schedule_adv_instance_sync(struct hci_dev *hdev, u8 instance,
|
|||
|
||||
/* Only use work for scheduling instances with legacy advertising */
|
||||
if (!ext_adv_capable(hdev)) {
|
||||
hdev->adv_instance_timeout = timeout;
|
||||
hdev->adv_instance_timeout = true;
|
||||
queue_delayed_work(hdev->req_workqueue,
|
||||
&hdev->adv_instance_expire,
|
||||
adv->mesh ? msecs_to_jiffies(timeout) :
|
||||
|
|
@ -5580,7 +5580,7 @@ int hci_dev_close_sync(struct hci_dev *hdev)
|
|||
|
||||
if (hdev->adv_instance_timeout) {
|
||||
cancel_delayed_work_sync(&hdev->adv_instance_expire);
|
||||
hdev->adv_instance_timeout = 0;
|
||||
hdev->adv_instance_timeout = false;
|
||||
}
|
||||
|
||||
err = hci_dev_shutdown(hdev);
|
||||
|
|
|
|||
|
|
@ -1299,7 +1299,7 @@ void mgmt_advertising_removed(struct sock *sk, struct hci_dev *hdev,
|
|||
static void cancel_adv_timeout(struct hci_dev *hdev)
|
||||
{
|
||||
if (hdev->adv_instance_timeout) {
|
||||
hdev->adv_instance_timeout = 0;
|
||||
hdev->adv_instance_timeout = false;
|
||||
cancel_delayed_work(&hdev->adv_instance_expire);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user