diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 92385e7c70d5..ead7d4faab81 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -3238,7 +3238,7 @@ static void hdd_roam_ibss_indication_handler(struct hdd_adapter *pAdapter, case eCSR_ROAM_RESULT_IBSS_COALESCED: { struct hdd_context *pHddCtx = - (struct hdd_context *) pAdapter->pHddCtx; + WLAN_HDD_GET_CTX(pAdapter); struct hdd_station_ctx *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); struct qdf_mac_addr broadcastMacAddr = diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index d35640e6e4ba..78f264921d90 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -228,7 +228,7 @@ static void hdd_hostapd_channel_allow_suspend(struct hdd_adapter *pAdapter, uint8_t channel) { - struct hdd_context *pHddCtx = (struct hdd_context *) (pAdapter->pHddCtx); + struct hdd_context *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); @@ -266,7 +266,7 @@ static void hdd_hostapd_channel_allow_suspend(struct hdd_adapter *pAdapter, static void hdd_hostapd_channel_prevent_suspend(struct hdd_adapter *pAdapter, uint8_t channel) { - struct hdd_context *pHddCtx = (struct hdd_context *) (pAdapter->pHddCtx); + struct hdd_context *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); @@ -973,7 +973,7 @@ static void __wlan_hdd_sap_pre_cac_failure(void *data) return; } - hdd_ctx = (struct hdd_context *) (adapter->pHddCtx); + hdd_ctx = WLAN_HDD_GET_CTX(adapter); if (wlan_hdd_validate_context(hdd_ctx)) { hdd_err("HDD context is null"); return; @@ -1023,7 +1023,7 @@ static void wlan_hdd_sap_pre_cac_success(void *data) return; } - hdd_ctx = (struct hdd_context *) (pHostapdAdapter->pHddCtx); + hdd_ctx = WLAN_HDD_GET_CTX(pHostapdAdapter); if (!hdd_ctx) { hdd_err("HDD context is null"); return; @@ -1078,7 +1078,7 @@ static QDF_STATUS hdd_handle_acs_scan_event(tpSap_Event sap_event, QDF_STATUS qdf_status; int chan_list_size; - hdd_ctx = (struct hdd_context *)(adapter->pHddCtx); + hdd_ctx = WLAN_HDD_GET_CTX(adapter); if (!hdd_ctx) { hdd_err("HDD context is null"); return QDF_STATUS_E_FAILURE; @@ -1389,7 +1389,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, sapEvent = pSapEvent->sapHddEventCode; memset(&wrqu, '\0', sizeof(wrqu)); - pHddCtx = (struct hdd_context *) (pHostapdAdapter->pHddCtx); + pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); if (!pHddCtx) { hdd_err("HDD context is null"); diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index ce0d293a7b7b..e0558f21584f 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -6905,7 +6905,7 @@ static int hdd_drv_cmd_process(struct hdd_adapter *adapter, return -EINVAL; } - hdd_ctx = (struct hdd_context *)adapter->pHddCtx; + hdd_ctx = WLAN_HDD_GET_CTX(adapter); for (i = 0; i < cmd_num_total; i++) { diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index 895e3caefb7e..dac1d4b2d5ba 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -1671,7 +1671,7 @@ static void __hdd_ipa_uc_stat_request(struct hdd_adapter *adapter, uint8_t reaso if (!adapter) return; - hdd_ctx = (struct hdd_context *)adapter->pHddCtx; + hdd_ctx = WLAN_HDD_GET_CTX(adapter); if (wlan_hdd_validate_context(hdd_ctx)) return; @@ -1728,7 +1728,7 @@ void hdd_ipa_uc_sharing_stats_request(struct hdd_adapter *adapter, if (!adapter) return; - pHddCtx = adapter->pHddCtx; + pHddCtx = WLAN_HDD_GET_CTX(adapter); hdd_ipa = pHddCtx->hdd_ipa; if (!hdd_ipa_is_enabled(pHddCtx) || !(hdd_ipa_uc_is_enabled(pHddCtx))) { @@ -1765,7 +1765,7 @@ void hdd_ipa_uc_set_quota(struct hdd_adapter *adapter, uint8_t set_quota, if (!adapter) return; - pHddCtx = adapter->pHddCtx; + pHddCtx = WLAN_HDD_GET_CTX(adapter); hdd_ipa = pHddCtx->hdd_ipa; if (!hdd_ipa_is_enabled(pHddCtx) || !(hdd_ipa_uc_is_enabled(pHddCtx))) { diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index e0d6c762e67b..47a001edbf28 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -2595,6 +2595,7 @@ static int hdd_stop(struct net_device *dev) static void __hdd_uninit(struct net_device *dev) { struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); + struct hdd_context *hdd_ctx; ENTER_DEV(dev); @@ -2604,7 +2605,8 @@ static void __hdd_uninit(struct net_device *dev) break; } - if (NULL == adapter->pHddCtx) { + hdd_ctx = WLAN_HDD_GET_CTX(adapter); + if (!hdd_ctx) { hdd_err("NULL hdd_ctx"); break; } @@ -2612,7 +2614,7 @@ static void __hdd_uninit(struct net_device *dev) if (dev != adapter->dev) hdd_err("Invalid device reference"); - hdd_deinit_adapter(adapter->pHddCtx, adapter, true); + hdd_deinit_adapter(hdd_ctx, adapter, true); /* after uninit our adapter structure will no longer be valid */ adapter->dev = NULL; diff --git a/core/hdd/src/wlan_hdd_ocb.c b/core/hdd/src/wlan_hdd_ocb.c index 1126160ff5d1..d4381523f35d 100644 --- a/core/hdd/src/wlan_hdd_ocb.c +++ b/core/hdd/src/wlan_hdd_ocb.c @@ -507,7 +507,7 @@ static int __iw_set_dot11p_channel_sched(struct net_device *dev, /* Release all the mac addresses used for OCB */ for (i = 0; i < adapter->ocb_mac_addr_count; i++) { - wlan_hdd_release_intf_addr(adapter->pHddCtx, + wlan_hdd_release_intf_addr(hdd_ctx, adapter->ocb_mac_address[i].bytes); } adapter->ocb_mac_addr_count = 0; @@ -539,7 +539,7 @@ static int __iw_set_dot11p_channel_sched(struct net_device *dev, qdf_copy_macaddr(&curr_chan->mac_address, &adapter->macAddressCurrent); } else { - mac_addr = wlan_hdd_get_intf_addr(adapter->pHddCtx); + mac_addr = wlan_hdd_get_intf_addr(hdd_ctx); if (mac_addr == NULL) { hdd_err("Cannot obtain mac address"); rc = -EINVAL; @@ -880,7 +880,7 @@ static int __wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy, /* Release all the mac addresses used for OCB */ for (i = 0; i < adapter->ocb_mac_addr_count; i++) { - wlan_hdd_release_intf_addr(adapter->pHddCtx, + wlan_hdd_release_intf_addr(hdd_ctx, adapter->ocb_mac_address[i].bytes); } adapter->ocb_mac_addr_count = 0; @@ -894,7 +894,7 @@ static int __wlan_hdd_cfg80211_ocb_set_config(struct wiphy *wiphy, qdf_copy_macaddr(&config->channels[i].mac_address, &adapter->macAddressCurrent); } else { - mac_addr = wlan_hdd_get_intf_addr(adapter->pHddCtx); + mac_addr = wlan_hdd_get_intf_addr(hdd_ctx); if (mac_addr == NULL) { hdd_err("Cannot obtain mac address"); goto fail; diff --git a/core/hdd/src/wlan_hdd_oemdata.c b/core/hdd/src/wlan_hdd_oemdata.c index 01bd3c8c7af4..3a2abb82fd85 100644 --- a/core/hdd/src/wlan_hdd_oemdata.c +++ b/core/hdd/src/wlan_hdd_oemdata.c @@ -67,7 +67,7 @@ static int populate_oem_data_cap(struct hdd_adapter *adapter, struct hdd_config *config; uint32_t num_chan; uint8_t *chan_list; - struct hdd_context *hdd_ctx = adapter->pHddCtx; + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); config = hdd_ctx->config; if (!config) { diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c index ea62ef7bdede..d3c3945678d1 100644 --- a/core/hdd/src/wlan_hdd_p2p.c +++ b/core/hdd/src/wlan_hdd_p2p.c @@ -1578,7 +1578,7 @@ static int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, if (NULL != cfgState->buf) { if (!noack) { hdd_err("Previous P2P Action frame packet pending"); - hdd_cleanup_actionframe(pAdapter->pHddCtx, pAdapter); + hdd_cleanup_actionframe(pHddCtx, pAdapter); } else { hdd_err("Pending Action frame packet return EBUSY"); return -EBUSY; @@ -1600,7 +1600,7 @@ static int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, home_ch = pAdapter->sessionCtx.station.conn_info.operationChannel; } else { - goAdapter = hdd_get_adapter(pAdapter->pHddCtx, QDF_P2P_GO_MODE); + goAdapter = hdd_get_adapter(pHddCtx, QDF_P2P_GO_MODE); if (goAdapter && (test_bit(SOFTAP_BSS_STARTED, &goAdapter->event_flags))) home_ch = goAdapter->sessionCtx.ap.operatingChannel; diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 8dc4451647f2..0c80ab973edb 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -953,7 +953,7 @@ out: void hdd_enable_mc_addr_filtering(struct hdd_adapter *adapter, enum pmo_offload_trigger trigger) { - struct hdd_context *hdd_ctx = (struct hdd_context *)adapter->pHddCtx; + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); QDF_STATUS status; struct wlan_objmgr_psoc *psoc = hdd_ctx->hdd_psoc; @@ -973,7 +973,7 @@ out: void hdd_disable_mc_addr_filtering(struct hdd_adapter *adapter, enum pmo_offload_trigger trigger) { - struct hdd_context *hdd_ctx = (struct hdd_context *)adapter->pHddCtx; + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); QDF_STATUS status = QDF_STATUS_SUCCESS; struct wlan_objmgr_psoc *psoc = hdd_ctx->hdd_psoc; @@ -1010,7 +1010,7 @@ int hdd_cache_mc_addr_list(struct pmo_mc_addr_list_params *mc_list_config) void hdd_disable_and_flush_mc_addr_list(struct hdd_adapter *adapter, enum pmo_offload_trigger trigger) { - struct hdd_context *hdd_ctx = (struct hdd_context *)adapter->pHddCtx; + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); struct wlan_objmgr_psoc *psoc = hdd_ctx->hdd_psoc; QDF_STATUS status = QDF_STATUS_SUCCESS; diff --git a/core/hdd/src/wlan_hdd_softap_tx_rx.c b/core/hdd/src/wlan_hdd_softap_tx_rx.c index f38c5fc44df9..bc6c27274266 100644 --- a/core/hdd/src/wlan_hdd_softap_tx_rx.c +++ b/core/hdd/src/wlan_hdd_softap_tx_rx.c @@ -219,7 +219,7 @@ static inline struct sk_buff *hdd_skb_orphan(struct hdd_adapter *pAdapter, struct sk_buff *skb) { struct sk_buff *nskb; - struct hdd_context *hdd_ctx = pAdapter->pHddCtx; + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); nskb = skb_unshare(skb, GFP_ATOMIC); if (unlikely(hdd_ctx->config->tx_orphan_enable) && (nskb == skb)) { @@ -713,7 +713,7 @@ QDF_STATUS hdd_softap_rx_packet_cbk(void *context, qdf_nbuf_t rxBuf) return QDF_STATUS_E_FAILURE; } - pHddCtx = pAdapter->pHddCtx; + pHddCtx = WLAN_HDD_GET_CTX(pAdapter); if (unlikely(NULL == pHddCtx)) { QDF_TRACE(QDF_MODULE_ID_HDD_SAP_DATA, QDF_TRACE_LEVEL_ERROR, "%s: HDD context is Null", __func__); @@ -833,7 +833,7 @@ QDF_STATUS hdd_softap_deregister_sta(struct hdd_adapter *pAdapter, return QDF_STATUS_E_INVAL; } - pHddCtx = (struct hdd_context *) (pAdapter->pHddCtx); + pHddCtx = WLAN_HDD_GET_CTX(pAdapter); /* Clear station in TL and then update HDD data * structures. This helps to block RX frames from other * station to this station. @@ -889,7 +889,7 @@ QDF_STATUS hdd_softap_register_sta(struct hdd_adapter *pAdapter, { QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; struct ol_txrx_desc_type staDesc = { 0 }; - struct hdd_context *pHddCtx = pAdapter->pHddCtx; + struct hdd_context *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); struct ol_txrx_ops txrx_ops; void *soc = cds_get_context(QDF_MODULE_ID_SOC); void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c index 24e518eb0eab..428ab7566aec 100644 --- a/core/hdd/src/wlan_hdd_tx_rx.c +++ b/core/hdd/src/wlan_hdd_tx_rx.c @@ -298,7 +298,7 @@ static inline struct sk_buff *hdd_skb_orphan(struct hdd_adapter *pAdapter, struct sk_buff *skb) { struct sk_buff *nskb; - struct hdd_context *hdd_ctx = pAdapter->pHddCtx; + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); nskb = skb_unshare(skb, GFP_ATOMIC); if (unlikely(hdd_ctx->config->tx_orphan_enable) && (nskb == skb)) { @@ -1167,7 +1167,7 @@ QDF_STATUS hdd_rx_packet_cbk(void *context, qdf_nbuf_t rxBuf) return QDF_STATUS_E_FAILURE; } - pHddCtx = pAdapter->pHddCtx; + pHddCtx = WLAN_HDD_GET_CTX(pAdapter); if (unlikely(NULL == pHddCtx)) { QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_ERROR, "%s: HDD context is Null", __func__); diff --git a/core/hdd/src/wlan_hdd_wowl.c b/core/hdd/src/wlan_hdd_wowl.c index c7eeb578cd16..3854f061848e 100644 --- a/core/hdd/src/wlan_hdd_wowl.c +++ b/core/hdd/src/wlan_hdd_wowl.c @@ -109,7 +109,7 @@ bool hdd_add_wowl_ptrn(struct hdd_adapter *pAdapter, const char *ptrn) const char *temp; tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); uint8_t sessionId = pAdapter->sessionId; - struct hdd_context *pHddCtx = pAdapter->pHddCtx; + struct hdd_context *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); len = find_ptrn_len(ptrn); @@ -269,7 +269,7 @@ bool hdd_del_wowl_ptrn(struct hdd_adapter *pAdapter, const char *ptrn) bool patternFound = false; QDF_STATUS qdf_ret_status; uint8_t sessionId = pAdapter->sessionId; - struct hdd_context *pHddCtx = pAdapter->pHddCtx; + struct hdd_context *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); /* Detect pattern */ for (id = 0;