Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278083
b: refs/heads/master
c: 61448a9
h: refs/heads/master
i:
  278081: 3d7264c
  278079: d9124f5
v: v3
  • Loading branch information
Kalle Valo committed Nov 11, 2011
1 parent 3e492e6 commit 2a6b92b
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 84 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4e3d54c7abcaad35062540432ba5b72bf27876aa
refs/heads/master: 61448a93efc26dc00e9684a9421394ca78142479
148 changes: 65 additions & 83 deletions trunk/drivers/net/wireless/ath/ath6kl/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1421,39 +1421,81 @@ static int ath6kl_init_hw_params(struct ath6kl *ar)
return 0;
}

static int ath6kl_init(struct ath6kl *ar)
int ath6kl_core_init(struct ath6kl *ar)
{
int status = 0;
struct ath6kl_bmi_target_info targ_info;
s32 timeleft;
struct net_device *ndev;
int i;
int i, ret = 0;

if (!ar)
return -EIO;
ar->ath6kl_wq = create_singlethread_workqueue("ath6kl");
if (!ar->ath6kl_wq)
return -ENOMEM;

ret = ath6kl_bmi_init(ar);
if (ret)
goto err_wq;

ret = ath6kl_hif_power_on(ar);
if (ret)
goto err_bmi_cleanup;

ret = ath6kl_bmi_get_target_info(ar, &targ_info);
if (ret)
goto err_power_off;

ar->version.target_ver = le32_to_cpu(targ_info.version);
ar->target_type = le32_to_cpu(targ_info.type);
ar->wiphy->hw_version = le32_to_cpu(targ_info.version);

ret = ath6kl_init_hw_params(ar);
if (ret)
goto err_power_off;

ret = ath6kl_configure_target(ar);
if (ret)
goto err_power_off;

ar->htc_target = ath6kl_htc_create(ar);

if (!ar->htc_target) {
ret = -ENOMEM;
goto err_power_off;
}

ret = ath6kl_fetch_firmwares(ar);
if (ret)
goto err_htc_cleanup;

/* FIXME: we should free all firmwares in the error cases below */

ret = ath6kl_init_upload(ar);
if (ret)
goto err_htc_cleanup;

/* Do we need to finish the BMI phase */
if (ath6kl_bmi_done(ar)) {
status = -EIO;
goto ath6kl_init_done;
ret = -EIO;
goto err_htc_cleanup;
}

/* Indicate that WMI is enabled (although not ready yet) */
set_bit(WMI_ENABLED, &ar->flag);
ar->wmi = ath6kl_wmi_init(ar);
if (!ar->wmi) {
ath6kl_err("failed to initialize wmi\n");
status = -EIO;
goto ath6kl_init_done;
ret = -EIO;
goto err_htc_cleanup;
}

ath6kl_dbg(ATH6KL_DBG_TRC, "%s: got wmi @ 0x%p.\n", __func__, ar->wmi);

status = ath6kl_register_ieee80211_hw(ar);
if (status)
ret = ath6kl_register_ieee80211_hw(ar);
if (ret)
goto err_node_cleanup;

status = ath6kl_debug_init(ar);
if (status) {
ret = ath6kl_debug_init(ar);
if (ret) {
wiphy_unregister(ar->wiphy);
goto err_node_cleanup;
}
Expand All @@ -1471,7 +1513,7 @@ static int ath6kl_init(struct ath6kl *ar)

if (!ndev) {
ath6kl_err("Failed to instantiate a network device\n");
status = -ENOMEM;
ret = -ENOMEM;
wiphy_unregister(ar->wiphy);
goto err_debug_init;
}
Expand All @@ -1486,12 +1528,12 @@ static int ath6kl_init(struct ath6kl *ar)
* size.
*/
if (ath6kl_htc_wait_target(ar->htc_target)) {
status = -EIO;
ret = -EIO;
goto err_if_deinit;
}

if (ath6kl_init_service_ep(ar)) {
status = -EIO;
ret = -EIO;
goto err_cleanup_scatter;
}

Expand All @@ -1514,9 +1556,8 @@ static int ath6kl_init(struct ath6kl *ar)
ath6kl_cookie_init(ar);

/* start HTC */
status = ath6kl_htc_start(ar->htc_target);

if (status) {
ret = ath6kl_htc_start(ar->htc_target);
if (ret) {
ath6kl_cookie_cleanup(ar);
goto err_rxbuf_cleanup;
}
Expand All @@ -1532,13 +1573,13 @@ static int ath6kl_init(struct ath6kl *ar)
if (ar->version.abi_ver != ATH6KL_ABI_VERSION) {
ath6kl_err("abi version mismatch: host(0x%x), target(0x%x)\n",
ATH6KL_ABI_VERSION, ar->version.abi_ver);
status = -EIO;
ret = -EIO;
goto err_htc_stop;
}

if (!timeleft || signal_pending(current)) {
ath6kl_err("wmi is not ready or wait was interrupted\n");
status = -EIO;
ret = -EIO;
goto err_htc_stop;
}

Expand All @@ -1555,8 +1596,8 @@ static int ath6kl_init(struct ath6kl *ar)
WIPHY_FLAG_HAVE_AP_SME;

for (i = 0; i < MAX_NUM_VIF; i++) {
status = ath6kl_target_config_wlan_params(ar, i);
if (status)
ret = ath6kl_target_config_wlan_params(ar, i);
if (ret)
goto err_htc_stop;
}

Expand All @@ -1566,7 +1607,7 @@ static int ath6kl_init(struct ath6kl *ar)
*/
memcpy(ndev->dev_addr, ar->mac_addr, ETH_ALEN);

return status;
return ret;

err_htc_stop:
ath6kl_htc_stop(ar->htc_target);
Expand All @@ -1586,65 +1627,6 @@ static int ath6kl_init(struct ath6kl *ar)
ath6kl_wmi_shutdown(ar->wmi);
clear_bit(WMI_ENABLED, &ar->flag);
ar->wmi = NULL;

ath6kl_init_done:
return status;
}

int ath6kl_core_init(struct ath6kl *ar)
{
int ret = 0;
struct ath6kl_bmi_target_info targ_info;

ar->ath6kl_wq = create_singlethread_workqueue("ath6kl");
if (!ar->ath6kl_wq)
return -ENOMEM;

ret = ath6kl_bmi_init(ar);
if (ret)
goto err_wq;

ret = ath6kl_hif_power_on(ar);
if (ret)
goto err_bmi_cleanup;

ret = ath6kl_bmi_get_target_info(ar, &targ_info);
if (ret)
goto err_power_off;

ar->version.target_ver = le32_to_cpu(targ_info.version);
ar->target_type = le32_to_cpu(targ_info.type);
ar->wiphy->hw_version = le32_to_cpu(targ_info.version);

ret = ath6kl_init_hw_params(ar);
if (ret)
goto err_power_off;

ret = ath6kl_configure_target(ar);
if (ret)
goto err_power_off;

ar->htc_target = ath6kl_htc_create(ar);

if (!ar->htc_target) {
ret = -ENOMEM;
goto err_power_off;
}

ret = ath6kl_fetch_firmwares(ar);
if (ret)
goto err_htc_cleanup;

ret = ath6kl_init_upload(ar);
if (ret)
goto err_htc_cleanup;

ret = ath6kl_init(ar);
if (ret)
goto err_htc_cleanup;

return ret;

err_htc_cleanup:
ath6kl_htc_cleanup(ar->htc_target);
err_power_off:
Expand Down

0 comments on commit 2a6b92b

Please sign in to comment.