ath10k: embed HTC struct inside ath10k
[cascardo/linux.git] / drivers / net / wireless / ath / ath10k / core.c
index 2b3426b..4199560 100644 (file)
@@ -100,7 +100,7 @@ static int ath10k_init_connect_htc(struct ath10k *ar)
                goto conn_fail;
 
        /* Start HTC */
-       status = ath10k_htc_start(ar->htc);
+       status = ath10k_htc_start(&ar->htc);
        if (status)
                goto conn_fail;
 
@@ -116,7 +116,7 @@ static int ath10k_init_connect_htc(struct ath10k *ar)
        return 0;
 
 timeout:
-       ath10k_htc_stop(ar->htc);
+       ath10k_htc_stop(&ar->htc);
 conn_fail:
        return status;
 }
@@ -441,7 +441,6 @@ static int ath10k_init_hw_params(struct ath10k *ar)
 }
 
 struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
-                                 enum ath10k_bus bus,
                                  const struct ath10k_hif_ops *hif_ops)
 {
        struct ath10k *ar;
@@ -458,7 +457,6 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
 
        ar->hif.priv = hif_priv;
        ar->hif.ops = hif_ops;
-       ar->hif.bus = bus;
 
        ar->free_vdev_map = 0xFF; /* 8 vdevs */
 
@@ -507,7 +505,6 @@ EXPORT_SYMBOL(ath10k_core_destroy);
 
 int ath10k_core_register(struct ath10k *ar)
 {
-       struct ath10k_htc_ops htc_ops;
        struct bmi_target_info target_info;
        int status;
 
@@ -536,26 +533,26 @@ int ath10k_core_register(struct ath10k *ar)
        if (status)
                goto err;
 
-       htc_ops.target_send_suspend_complete = ath10k_send_suspend_complete;
+       ar->htc.htc_ops.target_send_suspend_complete =
+               ath10k_send_suspend_complete;
 
-       ar->htc = ath10k_htc_create(ar, &htc_ops);
-       if (IS_ERR(ar->htc)) {
-               status = PTR_ERR(ar->htc);
-               ath10k_err("could not create HTC (%d)\n", status);
+       status = ath10k_htc_init(ar);
+       if (status) {
+               ath10k_err("could not init HTC (%d)\n", status);
                goto err;
        }
 
        status = ath10k_bmi_done(ar);
        if (status)
-               goto err_htc_destroy;
+               goto err;
 
        status = ath10k_wmi_attach(ar);
        if (status) {
                ath10k_err("WMI attach failed: %d\n", status);
-               goto err_htc_destroy;
+               goto err;
        }
 
-       status = ath10k_htc_wait_target(ar->htc);
+       status = ath10k_htc_wait_target(&ar->htc);
        if (status)
                goto err_wmi_detach;
 
@@ -607,13 +604,11 @@ int ath10k_core_register(struct ath10k *ar)
 err_unregister_mac:
        ath10k_mac_unregister(ar);
 err_disconnect_htc:
-       ath10k_htc_stop(ar->htc);
+       ath10k_htc_stop(&ar->htc);
 err_htt_detach:
        ath10k_htt_detach(ar->htt);
 err_wmi_detach:
        ath10k_wmi_detach(ar);
-err_htc_destroy:
-       ath10k_htc_destroy(ar->htc);
 err:
        return status;
 }
@@ -625,10 +620,9 @@ void ath10k_core_unregister(struct ath10k *ar)
         * Otherwise we will fail to submit commands to FW and mac80211 will be
         * unhappy about callback failures. */
        ath10k_mac_unregister(ar);
-       ath10k_htc_stop(ar->htc);
+       ath10k_htc_stop(&ar->htc);
        ath10k_htt_detach(ar->htt);
        ath10k_wmi_detach(ar);
-       ath10k_htc_destroy(ar->htc);
 }
 EXPORT_SYMBOL(ath10k_core_unregister);