From: Jes Sorensen Date: Sat, 26 Apr 2014 16:55:06 +0000 (+0200) Subject: staging: rtl8723au: Preserve const attribute of cmd handler argument X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=0348dc74f6689825c16db40fbe0ce6ad2da5bab9;p=deliverable%2Flinux.git staging: rtl8723au: Preserve const attribute of cmd handler argument Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8723au/core/rtw_cmd.c b/drivers/staging/rtl8723au/core/rtw_cmd.c index b9e38dc6a26c..508576ef1eb2 100644 --- a/drivers/staging/rtl8723au/core/rtw_cmd.c +++ b/drivers/staging/rtl8723au/core/rtw_cmd.c @@ -1446,7 +1446,7 @@ static void c2h_wk_callback(struct work_struct *work) u8 rtw_drvextra_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) { - struct drvextra_cmd_parm *pdrvextra_cmd; + const struct drvextra_cmd_parm *pdrvextra_cmd; if (!pbuf) return H2C_PARAMETERS_ERROR; @@ -1482,7 +1482,11 @@ u8 rtw_drvextra_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) if (pdrvextra_cmd->pbuf && (pdrvextra_cmd->type_size > 0)) { kfree(pdrvextra_cmd->pbuf); - pdrvextra_cmd->pbuf = NULL; + /* + * No need to set pdrvextra_cmd->pbuf = NULL as we were + * operating on a copy of the original pcmd->parmbuf + * created in rtw_cmd_work(). + */ } return H2C_SUCCESS; diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index 4ac1821bd9a4..303b76f9e196 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -3959,7 +3959,8 @@ void issue_action_spct_ch_switch23a(struct rtw_adapter *padapter, dump_mgntframe23a(padapter, pmgntframe); } -void issue_action_BA23a(struct rtw_adapter *padapter, unsigned char *raddr, +void issue_action_BA23a(struct rtw_adapter *padapter, + const unsigned char *raddr, unsigned char action, unsigned short status) { u8 category = WLAN_CATEGORY_BACK; @@ -5844,7 +5845,7 @@ u8 setopmode_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) u8 type; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - struct setopmode_parm *psetop = (struct setopmode_parm *)pbuf; + const struct setopmode_parm *psetop = (struct setopmode_parm *)pbuf; if (psetop->mode == Ndis802_11APMode) { pmlmeinfo->state = WIFI_FW_AP_STATE; @@ -5869,7 +5870,7 @@ u8 createbss_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wlan_bssid_ex *pnetwork = &pmlmeinfo->network; - struct wlan_bssid_ex *pparm = (struct wlan_bssid_ex *)pbuf; + const struct wlan_bssid_ex *pparm = (struct wlan_bssid_ex *)pbuf; /* u32 initialgain; */ if (pparm->InfrastructureMode == Ndis802_11APMode) { @@ -5927,7 +5928,7 @@ u8 join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wlan_bssid_ex *pnetwork = &pmlmeinfo->network; - struct wlan_bssid_ex *pparm = (struct wlan_bssid_ex *)pbuf; + const struct wlan_bssid_ex *pparm = (struct wlan_bssid_ex *)pbuf; struct HT_info_element *pht_info; u32 i; /* u32 initialgain; */ @@ -6045,7 +6046,7 @@ u8 join_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) u8 disconnect_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) { - struct disconnect_parm *param = (struct disconnect_parm *)pbuf; + const struct disconnect_parm *param = (struct disconnect_parm *)pbuf; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wlan_bssid_ex *pnetwork = &pmlmeinfo->network; @@ -6089,8 +6090,10 @@ u8 disconnect_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) return H2C_SUCCESS; } -static int rtw_scan_ch_decision(struct rtw_adapter *padapter, struct rtw_ieee80211_channel *out, - u32 out_num, struct rtw_ieee80211_channel *in, u32 in_num) +static int +rtw_scan_ch_decision(struct rtw_adapter *padapter, + struct rtw_ieee80211_channel *out, u32 out_num, + const struct rtw_ieee80211_channel *in, u32 in_num) { int i, j; int scan_ch_num = 0; @@ -6157,7 +6160,7 @@ static int rtw_scan_ch_decision(struct rtw_adapter *padapter, struct rtw_ieee802 u8 sitesurvey_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct sitesurvey_parm *pparm = (struct sitesurvey_parm *)pbuf; + const struct sitesurvey_parm *pparm = (struct sitesurvey_parm *)pbuf; u8 bdelayscan = false; u32 initialgain; u32 i; @@ -6238,7 +6241,7 @@ u8 sitesurvey_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) u8 setauth_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) { - struct setauth_parm *pparm = (struct setauth_parm *)pbuf; + const struct setauth_parm *pparm = (struct setauth_parm *)pbuf; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; @@ -6253,7 +6256,7 @@ u8 setauth_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) u8 setkey_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) { unsigned short ctrl; - struct setkey_parm *pparm = (struct setkey_parm *)pbuf; + const struct setkey_parm *pparm = (struct setkey_parm *)pbuf; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; unsigned char null_sta[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; @@ -6281,7 +6284,7 @@ u8 set_stakey_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) u8 cam_id;/* cam_entry */ struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; - struct set_stakey_parm *pparm = (struct set_stakey_parm *)pbuf; + const struct set_stakey_parm *pparm = (struct set_stakey_parm *)pbuf; /* cam_entry: */ /* 0~3 for default key */ @@ -6364,7 +6367,7 @@ u8 set_stakey_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) u8 add_ba_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) { - struct addBaReq_parm *pparm = (struct addBaReq_parm *)pbuf; + const struct addBaReq_parm *pparm = (struct addBaReq_parm *)pbuf; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; @@ -6436,7 +6439,7 @@ u8 mlme_evt_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) { u8 evt_code, evt_seq; u16 evt_sz; - uint *peventbuf; + const uint *peventbuf; void (*event_callback)(struct rtw_adapter *dev, u8 *pbuf); struct evt_priv *pevt_priv = &padapter->evtpriv; @@ -6544,7 +6547,7 @@ u8 tx_beacon_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) u8 set_ch_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) { - struct set_ch_parm *set_ch_parm; + const struct set_ch_parm *set_ch_parm; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; if (!pbuf) @@ -6567,7 +6570,7 @@ u8 set_ch_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) u8 set_chplan_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) { - struct SetChannelPlan_param *setChannelPlan_param; + const struct SetChannelPlan_param *setChannelPlan_param; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; if (!pbuf) diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c index 451b58f47287..a64c350591c2 100644 --- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c @@ -405,12 +405,12 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter) } /* any station allocated can be searched by hash list */ -struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, u8 *hwaddr) +struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr) { struct list_head *plist, *phead; struct sta_info *psta = NULL; u32 index; - u8 *addr; + const u8 *addr; u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; if (hwaddr == NULL) diff --git a/drivers/staging/rtl8723au/hal/hal_com.c b/drivers/staging/rtl8723au/hal/hal_com.c index d1701a35bc90..8e08977e929b 100644 --- a/drivers/staging/rtl8723au/hal/hal_com.c +++ b/drivers/staging/rtl8723au/hal/hal_com.c @@ -686,7 +686,7 @@ void rtl8723a_cam_invalid_all(struct rtw_adapter *padapter) } void rtl8723a_cam_write(struct rtw_adapter *padapter, - u8 entry, u16 ctrl, u8 *mac, u8 *key) + u8 entry, u16 ctrl, const u8 *mac, const u8 *key) { u32 cmd; unsigned int i, val, addr; diff --git a/drivers/staging/rtl8723au/include/hal_com.h b/drivers/staging/rtl8723au/include/hal_com.h index 5f050a346a8a..4a161e26c8dc 100644 --- a/drivers/staging/rtl8723au/include/hal_com.h +++ b/drivers/staging/rtl8723au/include/hal_com.h @@ -184,7 +184,7 @@ void rtl8723a_set_sec_cfg(struct rtw_adapter *padapter, u8 sec); void rtl8723a_cam_empty_entry(struct rtw_adapter *padapter, u8 ucIndex); void rtl8723a_cam_invalid_all(struct rtw_adapter *padapter); void rtl8723a_cam_write(struct rtw_adapter *padapter, - u8 entry, u16 ctrl, u8 *mac, u8 *key); + u8 entry, u16 ctrl, const u8 *mac, const u8 *key); void rtl8723a_fifo_cleanup(struct rtw_adapter *padapter); void rtl8723a_set_apfm_on_mac(struct rtw_adapter *padapter, u8 val); void rtl8723a_bcn_valid(struct rtw_adapter *padapter); diff --git a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h index 8a287c231034..26d360178eac 100644 --- a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h @@ -605,8 +605,9 @@ int issue_deauth23a_ex23a(struct rtw_adapter *padapter, u8 *da, unsigned short r int try_cnt, int wait_ms); void issue_action_spct_ch_switch23a(struct rtw_adapter *padapter, u8 *ra, u8 new_ch, u8 ch_offset); -void issue_action_BA23a(struct rtw_adapter *padapter, unsigned char *raddr, - unsigned char action, unsigned short status); +void issue_action_BA23a(struct rtw_adapter *padapter, + const unsigned char *raddr, + unsigned char action, unsigned short status); unsigned int send_delba23a(struct rtw_adapter *padapter, u8 initiator, u8 *addr); unsigned int send_beacon23a(struct rtw_adapter *padapter); diff --git a/drivers/staging/rtl8723au/include/sta_info.h b/drivers/staging/rtl8723au/include/sta_info.h index ffbc9e3f2156..c02947f6bd9b 100644 --- a/drivers/staging/rtl8723au/include/sta_info.h +++ b/drivers/staging/rtl8723au/include/sta_info.h @@ -349,7 +349,7 @@ struct sta_priv { struct wlan_acl_pool acl_list; }; -static inline u32 wifi_mac_hash(u8 *mac) +static inline u32 wifi_mac_hash(const u8 *mac) { u32 x; @@ -377,7 +377,7 @@ struct sta_info *rtw_get_stainfo23a_by_offset23a(struct sta_priv *stapriv, struct sta_info *rtw_alloc_stainfo23a(struct sta_priv *pstapriv, u8 *hwaddr); u32 rtw_free_stainfo23a(struct rtw_adapter *padapter, struct sta_info *psta); void rtw_free_all_stainfo23a(struct rtw_adapter *padapter); -struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, u8 *hwaddr); +struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr); u32 rtw_init_bcmc_stainfo23a(struct rtw_adapter *padapter); struct sta_info *rtw_get_bcmc_stainfo23a(struct rtw_adapter *padapter); u8 rtw_access_ctrl23a(struct rtw_adapter *padapter, u8 *mac_addr);