|
@@ -524,47 +524,20 @@ static int btmrvl_service_main_thread(void *data)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-struct btmrvl_private *btmrvl_add_card(void *card)
|
|
|
+int btmrvl_register_hdev(struct btmrvl_private *priv)
|
|
|
{
|
|
|
struct hci_dev *hdev = NULL;
|
|
|
- struct btmrvl_private *priv;
|
|
|
int ret;
|
|
|
|
|
|
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
|
|
|
- if (!priv) {
|
|
|
- BT_ERR("Can not allocate priv");
|
|
|
- goto err_priv;
|
|
|
- }
|
|
|
-
|
|
|
- priv->adapter = kzalloc(sizeof(*priv->adapter), GFP_KERNEL);
|
|
|
- if (!priv->adapter) {
|
|
|
- BT_ERR("Allocate buffer for btmrvl_adapter failed!");
|
|
|
- goto err_adapter;
|
|
|
- }
|
|
|
-
|
|
|
- btmrvl_init_adapter(priv);
|
|
|
-
|
|
|
hdev = hci_alloc_dev();
|
|
|
if (!hdev) {
|
|
|
BT_ERR("Can not allocate HCI device");
|
|
|
goto err_hdev;
|
|
|
}
|
|
|
|
|
|
- BT_DBG("Starting kthread...");
|
|
|
- priv->main_thread.priv = priv;
|
|
|
- spin_lock_init(&priv->driver_lock);
|
|
|
-
|
|
|
- init_waitqueue_head(&priv->main_thread.wait_q);
|
|
|
- priv->main_thread.task = kthread_run(btmrvl_service_main_thread,
|
|
|
- &priv->main_thread, "btmrvl_main_service");
|
|
|
-
|
|
|
priv->btmrvl_dev.hcidev = hdev;
|
|
|
- priv->btmrvl_dev.card = card;
|
|
|
-
|
|
|
hdev->driver_data = priv;
|
|
|
|
|
|
- priv->btmrvl_dev.tx_dnld_rdy = true;
|
|
|
-
|
|
|
hdev->bus = HCI_SDIO;
|
|
|
hdev->open = btmrvl_open;
|
|
|
hdev->close = btmrvl_close;
|
|
@@ -574,6 +547,8 @@ struct btmrvl_private *btmrvl_add_card(void *card)
|
|
|
hdev->ioctl = btmrvl_ioctl;
|
|
|
hdev->owner = THIS_MODULE;
|
|
|
|
|
|
+ btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ);
|
|
|
+
|
|
|
ret = hci_register_dev(hdev);
|
|
|
if (ret < 0) {
|
|
|
BT_ERR("Can not register HCI device");
|
|
@@ -584,16 +559,52 @@ struct btmrvl_private *btmrvl_add_card(void *card)
|
|
|
btmrvl_debugfs_init(hdev);
|
|
|
#endif
|
|
|
|
|
|
- return priv;
|
|
|
+ return 0;
|
|
|
|
|
|
err_hci_register_dev:
|
|
|
- /* Stop the thread servicing the interrupts */
|
|
|
- kthread_stop(priv->main_thread.task);
|
|
|
-
|
|
|
hci_free_dev(hdev);
|
|
|
|
|
|
err_hdev:
|
|
|
+ /* Stop the thread servicing the interrupts */
|
|
|
+ kthread_stop(priv->main_thread.task);
|
|
|
+
|
|
|
btmrvl_free_adapter(priv);
|
|
|
+ kfree(priv);
|
|
|
+
|
|
|
+ return -ENOMEM;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(btmrvl_register_hdev);
|
|
|
+
|
|
|
+struct btmrvl_private *btmrvl_add_card(void *card)
|
|
|
+{
|
|
|
+ struct btmrvl_private *priv;
|
|
|
+
|
|
|
+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
|
|
|
+ if (!priv) {
|
|
|
+ BT_ERR("Can not allocate priv");
|
|
|
+ goto err_priv;
|
|
|
+ }
|
|
|
+
|
|
|
+ priv->adapter = kzalloc(sizeof(*priv->adapter), GFP_KERNEL);
|
|
|
+ if (!priv->adapter) {
|
|
|
+ BT_ERR("Allocate buffer for btmrvl_adapter failed!");
|
|
|
+ goto err_adapter;
|
|
|
+ }
|
|
|
+
|
|
|
+ btmrvl_init_adapter(priv);
|
|
|
+
|
|
|
+ BT_DBG("Starting kthread...");
|
|
|
+ priv->main_thread.priv = priv;
|
|
|
+ spin_lock_init(&priv->driver_lock);
|
|
|
+
|
|
|
+ init_waitqueue_head(&priv->main_thread.wait_q);
|
|
|
+ priv->main_thread.task = kthread_run(btmrvl_service_main_thread,
|
|
|
+ &priv->main_thread, "btmrvl_main_service");
|
|
|
+
|
|
|
+ priv->btmrvl_dev.card = card;
|
|
|
+ priv->btmrvl_dev.tx_dnld_rdy = true;
|
|
|
+
|
|
|
+ return priv;
|
|
|
|
|
|
err_adapter:
|
|
|
kfree(priv);
|