From c2a156e17b49c2f2ffef48f4ef62588b80a05c35 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Thu, 25 Oct 2018 16:56:27 -0700 Subject: [PATCH] qcacld-3.0: Mark target not ready in hif disable path Currently, the target-not-ready flag is only ever cleared in the event of a firmware down notification from the platform driver. However, we know that the target is not ready after a certain point in the hif disable path. Additionally, the hif enable path does not clear this flag during error handling. Address these issues. Change-Id: I02555940dfba35874768aa453a24121a101354e5 CRs-Fixed: 2339361 --- core/hdd/src/wlan_hdd_driver_ops.c | 6 +++++- core/hdd/src/wlan_hdd_main.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index 3a167db35ea0..02b2ab8f10af 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -255,7 +255,7 @@ int hdd_hif_open(struct device *dev, void *bdev, const struct hif_bus_id *bid, hdd_err("NAPI creation error, rc: 0x%x, reinit: %d", ret, reinit); ret = -EFAULT; - goto err_hif_close; + goto mark_target_not_ready; } else { hdd_napi_event(NAPI_EVT_INI_FILE, (void *)hdd_ctx->napi_enable); @@ -271,6 +271,9 @@ int hdd_hif_open(struct device *dev, void *bdev, const struct hif_bus_id *bid, CFG_DP_CE_SERVICE_MAX_RX_IND_FLUSH)); return 0; +mark_target_not_ready: + cds_set_target_ready(false); + err_hif_close: hdd_deinit_cds_hif_context(); hif_close(hif_ctx); @@ -287,6 +290,7 @@ void hdd_hif_close(struct hdd_context *hdd_ctx, void *hif_ctx) if (hif_ctx == NULL) return; + cds_set_target_ready(false); hif_disable(hif_ctx, HIF_DISABLE_TYPE_REMOVE); hdd_napi_destroy(true); diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 4eedbe928b99..ab87de0ff37d 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -11077,7 +11077,7 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode) ol_cds_free(); - if (IS_IDLE_STOP && cds_is_target_ready()) { + if (IS_IDLE_STOP) { ret = pld_power_off(qdf_ctx->dev); if (ret) hdd_err("Failed to power down device; errno:%d", ret);