diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2012-11-12 00:02:14 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-04-04 12:16:12 -0400 |
commit | f41c70c4d5e3f6c2a7f9e5dfc10af452591a2484 (patch) | |
tree | 3b1f92c46f4d9a8b3adc38c8be460f75cf1903ff /net/bluetooth/hci_core.c | |
parent | 7b1abbbed0f2a1bc19bb8c0d48a284466043092a (diff) |
Bluetooth: Add driver setup stage for early init
Some drivers require a special stage for their early init. This is
always specific to the driver or transport. So call back into driver to
allow bringing up the device.
The advantage with this stage is that the Bluetooth core is actually
handling the HCI layer now. This means that command and event processing
is available.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r-- | net/bluetooth/hci_core.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 9567e32a1f0c..0f00b8bc279f 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1127,26 +1127,33 @@ int hci_dev_open(__u16 dev) | |||
1127 | goto done; | 1127 | goto done; |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) | ||
1131 | set_bit(HCI_RAW, &hdev->flags); | ||
1132 | |||
1133 | /* Treat all non BR/EDR controllers as raw devices if | ||
1134 | enable_hs is not set */ | ||
1135 | if (hdev->dev_type != HCI_BREDR && !enable_hs) | ||
1136 | set_bit(HCI_RAW, &hdev->flags); | ||
1137 | |||
1138 | if (hdev->open(hdev)) { | 1130 | if (hdev->open(hdev)) { |
1139 | ret = -EIO; | 1131 | ret = -EIO; |
1140 | goto done; | 1132 | goto done; |
1141 | } | 1133 | } |
1142 | 1134 | ||
1143 | if (!test_bit(HCI_RAW, &hdev->flags)) { | 1135 | atomic_set(&hdev->cmd_cnt, 1); |
1144 | atomic_set(&hdev->cmd_cnt, 1); | 1136 | set_bit(HCI_INIT, &hdev->flags); |
1145 | set_bit(HCI_INIT, &hdev->flags); | 1137 | |
1146 | ret = __hci_init(hdev); | 1138 | if (hdev->setup && test_bit(HCI_SETUP, &hdev->dev_flags)) |
1147 | clear_bit(HCI_INIT, &hdev->flags); | 1139 | ret = hdev->setup(hdev); |
1140 | |||
1141 | if (!ret) { | ||
1142 | /* Treat all non BR/EDR controllers as raw devices if | ||
1143 | * enable_hs is not set. | ||
1144 | */ | ||
1145 | if (hdev->dev_type != HCI_BREDR && !enable_hs) | ||
1146 | set_bit(HCI_RAW, &hdev->flags); | ||
1147 | |||
1148 | if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) | ||
1149 | set_bit(HCI_RAW, &hdev->flags); | ||
1150 | |||
1151 | if (!test_bit(HCI_RAW, &hdev->flags)) | ||
1152 | ret = __hci_init(hdev); | ||
1148 | } | 1153 | } |
1149 | 1154 | ||
1155 | clear_bit(HCI_INIT, &hdev->flags); | ||
1156 | |||
1150 | if (!ret) { | 1157 | if (!ret) { |
1151 | hci_dev_hold(hdev); | 1158 | hci_dev_hold(hdev); |
1152 | set_bit(HCI_UP, &hdev->flags); | 1159 | set_bit(HCI_UP, &hdev->flags); |