aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-08-08 02:32:51 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-08-14 02:49:17 -0400
commit54506918059a5bdbf396f34f2e0a2735803024db (patch)
tree6f49d893d86f04e5d707628f87c847428e5fb546 /net/bluetooth/hci_core.c
parent222916e3e509f04678d0b6f13f7b17bbc8dd14b6 (diff)
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/hci_core.c')
-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)
1926 debugfs_create_u16("discov_interleaved_timeout", 0644, 1926 debugfs_create_u16("discov_interleaved_timeout", 0644,
1927 hdev->debugfs, 1927 hdev->debugfs,
1928 &hdev->discov_interleaved_timeout); 1928 &hdev->discov_interleaved_timeout);
1929
1930 hci_register_smp(hdev);
1929 } 1931 }
1930 1932
1931 return 0; 1933 return 0;
@@ -4127,13 +4129,9 @@ int hci_register_dev(struct hci_dev *hdev)
4127 4129
4128 dev_set_name(&hdev->dev, "%s", hdev->name); 4130 dev_set_name(&hdev->dev, "%s", hdev->name);
4129 4131
4130 error = hci_register_smp(hdev);
4131 if (error)
4132 goto err_wqueue;
4133
4134 error = device_add(&hdev->dev); 4132 error = device_add(&hdev->dev);
4135 if (error < 0) 4133 if (error < 0)
4136 goto err_smp; 4134 goto err_wqueue;
4137 4135
4138 hdev->rfkill = rfkill_alloc(hdev->name, &hdev->dev, 4136 hdev->rfkill = rfkill_alloc(hdev->name, &hdev->dev,
4139 RFKILL_TYPE_BLUETOOTH, &hci_rfkill_ops, 4137 RFKILL_TYPE_BLUETOOTH, &hci_rfkill_ops,
@@ -4175,8 +4173,6 @@ int hci_register_dev(struct hci_dev *hdev)
4175 4173
4176 return id; 4174 return id;
4177 4175
4178err_smp:
4179 hci_unregister_smp(hdev);
4180err_wqueue: 4176err_wqueue:
4181 destroy_workqueue(hdev->workqueue); 4177 destroy_workqueue(hdev->workqueue);
4182 destroy_workqueue(hdev->req_workqueue); 4178 destroy_workqueue(hdev->req_workqueue);