aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/bluetooth/hci_core.h1
-rw-r--r--net/bluetooth/hci_core.c33
2 files changed, 21 insertions, 13 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 47129b1ee20b..395e8f6982f9 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -293,6 +293,7 @@ struct hci_dev {
293 int (*open)(struct hci_dev *hdev); 293 int (*open)(struct hci_dev *hdev);
294 int (*close)(struct hci_dev *hdev); 294 int (*close)(struct hci_dev *hdev);
295 int (*flush)(struct hci_dev *hdev); 295 int (*flush)(struct hci_dev *hdev);
296 int (*setup)(struct hci_dev *hdev);
296 int (*send)(struct sk_buff *skb); 297 int (*send)(struct sk_buff *skb);
297 void (*notify)(struct hci_dev *hdev, unsigned int evt); 298 void (*notify)(struct hci_dev *hdev, unsigned int evt);
298 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); 299 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
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);