This patch adds the thread-safe version of helper functions to add and remove pending auto connections. These helpers will be used in next patches to implementing the Mgmt add/remove connection parameters commands. Signed-off-by: Andre Guedes <andre.guedes@xxxxxxxxxxxxx> --- include/net/bluetooth/hci_core.h | 4 ++++ net/bluetooth/hci_core.c | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 379bb36..2659123 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -779,8 +779,12 @@ bool hci_has_pending_auto_conn(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type); int __hci_add_pending_auto_conn(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type); +int hci_add_pending_auto_conn(struct hci_dev *hdev, bdaddr_t *addr, + u8 addr_type); void __hci_remove_pending_auto_conn(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type); +void hci_remove_pending_auto_conn(struct hci_dev *hdev, bdaddr_t *addr, + u8 addr_type); bool hci_is_scan_and_conn_supported(struct hci_dev *hdev); diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 63a56f5..5d7fd3d 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3029,6 +3029,18 @@ int __hci_add_pending_auto_conn(struct hci_dev *hdev, bdaddr_t *addr, return 0; } +int hci_add_pending_auto_conn(struct hci_dev *hdev, bdaddr_t *addr, + u8 addr_type) +{ + int err; + + hci_dev_lock(hdev); + err = __hci_add_pending_auto_conn(hdev, addr, addr_type); + hci_dev_unlock(hdev); + + return err; +} + /* This function requires the caller holds hdev->lock */ void __hci_remove_pending_auto_conn(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type) @@ -3051,6 +3063,14 @@ void __hci_remove_pending_auto_conn(struct hci_dev *hdev, bdaddr_t *addr, } } +void hci_remove_pending_auto_conn(struct hci_dev *hdev, bdaddr_t *addr, + u8 addr_type) +{ + hci_dev_lock(hdev); + __hci_remove_pending_auto_conn(hdev, addr, addr_type); + hci_dev_unlock(hdev); +} + /* This function requires the caller holds hdev->lock */ static void __clear_pending_auto_conn(struct hci_dev *hdev) { -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html