summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDundi Raviteja <dundi@codeaurora.org>2018-05-15 19:33:34 +0530
committernshrivas <nshrivas@codeaurora.org>2018-08-28 11:21:24 -0700
commitb17df5070b20c0bbc741493bd5a46749c2780b4e (patch)
treeb75cfdcc1caa1c5953fe2d031f2f6394f50f1310
parentef787d8332125859ada4be35c355846679311d66 (diff)
qcacld-3.0: Use QDF event framework for change country code event
We are transitioning the usage of change country code event to the new QDF event framework. Change-Id: I861b0fbe060a471a2f213698c88e9f65badbf723 CRs-Fixed: 2274940
-rw-r--r--core/hdd/inc/wlan_hdd_main.h4
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.c11
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.h1
-rw-r--r--core/hdd/src/wlan_hdd_ioctl.c15
-rw-r--r--core/hdd/src/wlan_hdd_main.c26
-rw-r--r--core/hdd/src/wlan_hdd_wext.c2
6 files changed, 26 insertions, 33 deletions
diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h
index 8bb825b9e4ef..8a31dc087341 100644
--- a/core/hdd/inc/wlan_hdd_main.h
+++ b/core/hdd/inc/wlan_hdd_main.h
@@ -1444,8 +1444,8 @@ struct hdd_adapter_s {
struct completion roaming_comp_var;
- /** Completion of change country code */
- struct completion change_country_code;
+ /** Event of change country code */
+ qdf_event_t change_country_code;
/* completion variable for Linkup Event */
struct completion linkup_event_var;
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index 66a3dfabb83c..a4909e65775a 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -14645,17 +14645,6 @@ static int wlan_hdd_cfg80211_change_bss(struct wiphy *wiphy,
return ret;
}
-/* FUNCTION: wlan_hdd_change_country_code_cd
- * to wait for contry code completion
- */
-void *wlan_hdd_change_country_code_cb(void *pAdapter)
-{
- hdd_adapter_t *call_back_pAdapter = pAdapter;
-
- complete(&call_back_pAdapter->change_country_code);
- return NULL;
-}
-
/**
* __wlan_hdd_cfg80211_change_iface() - change interface cfg80211 op
* @wiphy: Pointer to the wiphy structure
diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h
index b2d39fa6eacc..772ed6b1db31 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.h
+++ b/core/hdd/src/wlan_hdd_cfg80211.h
@@ -385,7 +385,6 @@ extern void wlan_hdd_cfg80211_update_replay_counter_cb(
tpSirGtkOffloadGetInfoRspParams
pGtkOffloadGetInfoRsp);
#endif
-void *wlan_hdd_change_country_code_cb(void *pAdapter);
void hdd_select_cbmode(hdd_adapter_t *pAdapter, uint8_t operationChannel,
struct ch_params_s *ch_params);
diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c
index f64f9dccbfe0..add22dc65888 100644
--- a/core/hdd/src/wlan_hdd_ioctl.c
+++ b/core/hdd/src/wlan_hdd_ioctl.c
@@ -3129,7 +3129,6 @@ static int drv_cmd_country(hdd_adapter_t *adapter,
{
int ret = 0;
QDF_STATUS status;
- unsigned long rc;
char *country_code;
int32_t cc_from_db;
@@ -3163,7 +3162,7 @@ static int drv_cmd_country(hdd_adapter_t *adapter,
}
}
- INIT_COMPLETION(adapter->change_country_code);
+ qdf_event_reset(&adapter->change_country_code);
status = sme_change_country_code(hdd_ctx->hHal,
wlan_hdd_change_country_code_callback,
@@ -3172,12 +3171,14 @@ static int drv_cmd_country(hdd_adapter_t *adapter,
hdd_ctx->pcds_context,
true,
true);
- if (status == QDF_STATUS_SUCCESS) {
- rc = wait_for_completion_timeout(
- &adapter->change_country_code,
- msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY));
- if (!rc)
+ if (QDF_IS_STATUS_SUCCESS(status)) {
+ status = qdf_wait_for_event_completion(
+ &adapter->change_country_code,
+ WLAN_WAIT_TIME_COUNTRY);
+ if (QDF_IS_STATUS_ERROR(status)) {
hdd_err("SME while setting country code timed out");
+ ret = -ETIMEDOUT;
+ }
} else {
hdd_err("SME Change Country code fail, status %d",
status);
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index dd57cfcc22f9..9791b741fa58 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -3236,16 +3236,14 @@ static hdd_adapter_t *hdd_alloc_station_adapter(hdd_context_t *hdd_ctx,
&adapter->qdf_session_open_event);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
hdd_err("Session open QDF event init failed!");
- free_netdev(adapter->dev);
- return NULL;
+ goto err_qdf_init;
}
qdf_status = qdf_event_create(
&adapter->qdf_session_close_event);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
hdd_err("Session close QDF event init failed!");
- free_netdev(adapter->dev);
- return NULL;
+ goto err_qdf_init;
}
init_completion(&adapter->disconnect_comp_var);
@@ -3263,7 +3261,11 @@ static hdd_adapter_t *hdd_alloc_station_adapter(hdd_context_t *hdd_ctx,
init_completion(&adapter->tdls_link_establish_req_comp);
#endif
init_completion(&adapter->ibss_peer_info_comp);
- init_completion(&adapter->change_country_code);
+ qdf_status = qdf_event_create(&adapter->change_country_code);
+ if (QDF_IS_STATUS_ERROR(qdf_status)) {
+ hdd_err("Change country code event init failed!");
+ goto err_qdf_init;
+ }
init_completion(&adapter->scan_info.abortscan_event_var);
@@ -3302,8 +3304,11 @@ static hdd_adapter_t *hdd_alloc_station_adapter(hdd_context_t *hdd_ctx,
spin_lock_init(&adapter->pause_map_lock);
adapter->start_time = adapter->last_time = qdf_system_ticks();
}
-
return adapter;
+
+err_qdf_init:
+ free_netdev(adapter->dev);
+ return NULL;
}
static QDF_STATUS hdd_register_interface(hdd_adapter_t *adapter, bool rtnl_held)
@@ -9171,12 +9176,11 @@ static int hdd_update_country_code(hdd_context_t *hdd_ctx,
{
QDF_STATUS status;
int ret = 0;
- unsigned long rc;
if (country_code == NULL)
return 0;
- INIT_COMPLETION(adapter->change_country_code);
+ qdf_event_reset(&adapter->change_country_code);
status = sme_change_country_code(hdd_ctx->hHal,
wlan_hdd_change_country_code_callback,
@@ -9191,9 +9195,9 @@ static int hdd_update_country_code(hdd_context_t *hdd_ctx,
return -EINVAL;
}
- rc = wait_for_completion_timeout(&adapter->change_country_code,
- msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY));
- if (!rc) {
+ status = qdf_wait_for_event_completion(&adapter->change_country_code,
+ WLAN_WAIT_TIME_COUNTRY);
+ if (QDF_IS_STATUS_ERROR(status)) {
hdd_err("SME while setting country code timed out");
ret = -ETIMEDOUT;
}
diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c
index 463a351d4fba..36fc15610624 100644
--- a/core/hdd/src/wlan_hdd_wext.c
+++ b/core/hdd/src/wlan_hdd_wext.c
@@ -5930,7 +5930,7 @@ void wlan_hdd_change_country_code_callback(void *context)
hdd_adapter_t *adapter = context;
if (adapter && (WLAN_HDD_ADAPTER_MAGIC == adapter->magic))
- complete(&adapter->change_country_code);
+ qdf_event_set(&adapter->change_country_code);
}
/**