aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-08-08 09:32:51 +0300
committerMarcel Holtmann <marcel@holtmann.org>2014-08-14 08:49:17 +0200
commit54506918059a5bdbf396f34f2e0a2735803024db (patch)
tree6f49d893d86f04e5d707628f87c847428e5fb546 /net/bluetooth
parentBluetooth: Refactor SMP (de)initialization into separate functions (diff)
downloadlinux-dev-54506918059a5bdbf396f34f2e0a2735803024db.tar.xz
linux-dev-54506918059a5bdbf396f34f2e0a2735803024db.zip
Bluetooth: Move SMP initialization after HCI init
First of all, it's wasteful to initialize SMP if it's never going to be used (e.g. on non-LE controllers). Second of all, when we move to use l2cap_chan we need to know the real local address, meaning we must have completed at least part of the HCI init. This patch moves the SMP initialization to after the HCI init procedure and makes it depend on whether the controller actually supports LE. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_core.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 1f691c50abbc..9eb2869b183b 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1926,6 +1926,8 @@ static int __hci_init(struct hci_dev *hdev)
debugfs_create_u16("discov_interleaved_timeout", 0644,
hdev->debugfs,
&hdev->discov_interleaved_timeout);
+
+ hci_register_smp(hdev);
}
return 0;
@@ -4127,13 +4129,9 @@ int hci_register_dev(struct hci_dev *hdev)
dev_set_name(&hdev->dev, "%s", hdev->name);
- error = hci_register_smp(hdev);
- if (error)
- goto err_wqueue;
-
error = device_add(&hdev->dev);
if (error < 0)
- goto err_smp;
+ goto err_wqueue;
hdev->rfkill = rfkill_alloc(hdev->name, &hdev->dev,
RFKILL_TYPE_BLUETOOTH, &hci_rfkill_ops,
@@ -4175,8 +4173,6 @@ int hci_register_dev(struct hci_dev *hdev)
return id;
-err_smp:
- hci_unregister_smp(hdev);
err_wqueue:
destroy_workqueue(hdev->workqueue);
destroy_workqueue(hdev->req_workqueue);