Bluetooth: Split hci_update_page_scan into two functions
To keep the parameter list and its semantics clear it makes sense to split the hci_update_page_scan function into two separate functions: one taking a hci_dev and another taking a hci_request. The one taking a hci_dev constructs its own hci_request and then calls the other function. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Родитель
c8c7e3db81
Коммит
1d2dc5b7b3
|
@ -1306,7 +1306,8 @@ bool hci_req_pending(struct hci_dev *hdev);
|
||||||
void hci_req_add_le_scan_disable(struct hci_request *req);
|
void hci_req_add_le_scan_disable(struct hci_request *req);
|
||||||
void hci_req_add_le_passive_scan(struct hci_request *req);
|
void hci_req_add_le_passive_scan(struct hci_request *req);
|
||||||
|
|
||||||
void hci_update_page_scan(struct hci_dev *hdev, struct hci_request *req);
|
void hci_update_page_scan(struct hci_dev *hdev);
|
||||||
|
void __hci_update_page_scan(struct hci_request *req);
|
||||||
|
|
||||||
struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen,
|
struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen,
|
||||||
const void *param, u32 timeout);
|
const void *param, u32 timeout);
|
||||||
|
|
|
@ -5787,8 +5787,9 @@ static bool disconnected_whitelist_entries(struct hci_dev *hdev)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hci_update_page_scan(struct hci_dev *hdev, struct hci_request *req)
|
void __hci_update_page_scan(struct hci_request *req)
|
||||||
{
|
{
|
||||||
|
struct hci_dev *hdev = req->hdev;
|
||||||
u8 scan;
|
u8 scan;
|
||||||
|
|
||||||
if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags))
|
if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags))
|
||||||
|
@ -5812,8 +5813,14 @@ void hci_update_page_scan(struct hci_dev *hdev, struct hci_request *req)
|
||||||
if (test_bit(HCI_DISCOVERABLE, &hdev->dev_flags))
|
if (test_bit(HCI_DISCOVERABLE, &hdev->dev_flags))
|
||||||
scan |= SCAN_INQUIRY;
|
scan |= SCAN_INQUIRY;
|
||||||
|
|
||||||
if (req)
|
hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
|
||||||
hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
|
}
|
||||||
else
|
|
||||||
hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
|
void hci_update_page_scan(struct hci_dev *hdev)
|
||||||
|
{
|
||||||
|
struct hci_request req;
|
||||||
|
|
||||||
|
hci_req_init(&req, hdev);
|
||||||
|
__hci_update_page_scan(&req);
|
||||||
|
hci_req_run(&req, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2127,7 +2127,7 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
||||||
hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES,
|
hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES,
|
||||||
sizeof(cp), &cp);
|
sizeof(cp), &cp);
|
||||||
|
|
||||||
hci_update_page_scan(hdev, NULL);
|
hci_update_page_scan(hdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set packet type for incoming connection */
|
/* Set packet type for incoming connection */
|
||||||
|
@ -2308,7 +2308,7 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
|
||||||
if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
|
if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
|
||||||
hci_remove_link_key(hdev, &conn->dst);
|
hci_remove_link_key(hdev, &conn->dst);
|
||||||
|
|
||||||
hci_update_page_scan(hdev, NULL);
|
hci_update_page_scan(hdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type);
|
params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type);
|
||||||
|
|
|
@ -1566,7 +1566,7 @@ static void set_discoverable_complete(struct hci_dev *hdev, u8 status)
|
||||||
* entries.
|
* entries.
|
||||||
*/
|
*/
|
||||||
hci_req_init(&req, hdev);
|
hci_req_init(&req, hdev);
|
||||||
hci_update_page_scan(hdev, &req);
|
__hci_update_page_scan(&req);
|
||||||
update_class(&req);
|
update_class(&req);
|
||||||
hci_req_run(&req, NULL);
|
hci_req_run(&req, NULL);
|
||||||
|
|
||||||
|
@ -1813,7 +1813,7 @@ static void set_connectable_complete(struct hci_dev *hdev, u8 status)
|
||||||
|
|
||||||
if (conn_changed || discov_changed) {
|
if (conn_changed || discov_changed) {
|
||||||
new_settings(hdev, cmd->sk);
|
new_settings(hdev, cmd->sk);
|
||||||
hci_update_page_scan(hdev, NULL);
|
hci_update_page_scan(hdev);
|
||||||
if (discov_changed)
|
if (discov_changed)
|
||||||
mgmt_update_adv_data(hdev);
|
mgmt_update_adv_data(hdev);
|
||||||
hci_update_background_scan(hdev);
|
hci_update_background_scan(hdev);
|
||||||
|
@ -1847,7 +1847,7 @@ static int set_connectable_update_settings(struct hci_dev *hdev,
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
hci_update_page_scan(hdev, NULL);
|
hci_update_page_scan(hdev);
|
||||||
hci_update_background_scan(hdev);
|
hci_update_background_scan(hdev);
|
||||||
return new_settings(hdev, sk);
|
return new_settings(hdev, sk);
|
||||||
}
|
}
|
||||||
|
@ -4697,7 +4697,7 @@ static int set_bredr(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
|
||||||
hci_req_init(&req, hdev);
|
hci_req_init(&req, hdev);
|
||||||
|
|
||||||
write_fast_connectable(&req, false);
|
write_fast_connectable(&req, false);
|
||||||
hci_update_page_scan(hdev, &req);
|
__hci_update_page_scan(&req);
|
||||||
|
|
||||||
/* Since only the advertising data flags will change, there
|
/* Since only the advertising data flags will change, there
|
||||||
* is no need to update the scan response data.
|
* is no need to update the scan response data.
|
||||||
|
@ -5473,7 +5473,7 @@ static int add_device(struct sock *sk, struct hci_dev *hdev,
|
||||||
if (err)
|
if (err)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
||||||
hci_update_page_scan(hdev, NULL);
|
hci_update_page_scan(hdev);
|
||||||
|
|
||||||
goto added;
|
goto added;
|
||||||
}
|
}
|
||||||
|
@ -5556,7 +5556,7 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev,
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
hci_update_page_scan(hdev, NULL);
|
hci_update_page_scan(hdev);
|
||||||
|
|
||||||
device_removed(sk, hdev, &cp->addr.bdaddr,
|
device_removed(sk, hdev, &cp->addr.bdaddr,
|
||||||
cp->addr.type);
|
cp->addr.type);
|
||||||
|
@ -5607,7 +5607,7 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev,
|
||||||
kfree(b);
|
kfree(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
hci_update_page_scan(hdev, NULL);
|
hci_update_page_scan(hdev);
|
||||||
|
|
||||||
list_for_each_entry_safe(p, tmp, &hdev->le_conn_params, list) {
|
list_for_each_entry_safe(p, tmp, &hdev->le_conn_params, list) {
|
||||||
if (p->auto_connect == HCI_AUTO_CONN_DISABLED)
|
if (p->auto_connect == HCI_AUTO_CONN_DISABLED)
|
||||||
|
@ -6139,7 +6139,7 @@ static int powered_update_hci(struct hci_dev *hdev)
|
||||||
|
|
||||||
if (lmp_bredr_capable(hdev)) {
|
if (lmp_bredr_capable(hdev)) {
|
||||||
write_fast_connectable(&req, false);
|
write_fast_connectable(&req, false);
|
||||||
hci_update_page_scan(hdev, &req);
|
__hci_update_page_scan(&req);
|
||||||
update_class(&req);
|
update_class(&req);
|
||||||
update_name(&req);
|
update_name(&req);
|
||||||
update_eir(&req);
|
update_eir(&req);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче