rtl8188eu: Fix more sparse warnings

Most of these are for endian issues

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-06-07 09:43:09 -05:00
parent 21703c67e2
commit 254539b5ec
5 changed files with 434 additions and 575 deletions

View file

@ -1343,8 +1343,8 @@ u16 rtw_get_cur_max_rate(_adapter *adapter)
bw_40MHz = (pmlmeext->cur_bwmode && (HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH & pmlmeinfo->HT_info.infos[0])) ? 1:0; bw_40MHz = (pmlmeext->cur_bwmode && (HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH & pmlmeinfo->HT_info.infos[0])) ? 1:0;
//short_GI = (pht_capie->cap_info&(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) ? 1:0; //short_GI = (pht_capie->cap_info&(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) ? 1:0;
short_GI_20 = (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info&IEEE80211_HT_CAP_SGI_20) ? 1:0; short_GI_20 = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info)&IEEE80211_HT_CAP_SGI_20) ? 1:0;
short_GI_40 = (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info&IEEE80211_HT_CAP_SGI_40) ? 1:0; short_GI_40 = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info)&IEEE80211_HT_CAP_SGI_40) ? 1:0;
rtw_hal_get_hwreg(adapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); rtw_hal_get_hwreg(adapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
max_rate = rtw_mcs_rate( max_rate = rtw_mcs_rate(

View file

@ -489,7 +489,7 @@ u8 *rtw_get_capability_from_ie(u8 *ie)
u16 rtw_get_capability(WLAN_BSSID_EX *bss) u16 rtw_get_capability(WLAN_BSSID_EX *bss)
{ {
u16 val; __le16 val;
_func_enter_; _func_enter_;
_rtw_memcpy((u8 *)&val, rtw_get_capability_from_ie(bss->IEs), 2); _rtw_memcpy((u8 *)&val, rtw_get_capability_from_ie(bss->IEs), 2);
@ -632,41 +632,25 @@ inline int is_same_ess(WLAN_BSSID_EX *a, WLAN_BSSID_EX *b)
int is_same_network(WLAN_BSSID_EX *src, WLAN_BSSID_EX *dst) int is_same_network(WLAN_BSSID_EX *src, WLAN_BSSID_EX *dst)
{ {
u16 s_cap, d_cap; u16 s_cap, d_cap;
__le16 le_scap, le_dcap;
_func_enter_; _func_enter_;
_rtw_memcpy((u8 *)&le_scap, rtw_get_capability_from_ie(src->IEs), 2);
#ifdef PLATFORM_OS_XP _rtw_memcpy((u8 *)&le_dcap, rtw_get_capability_from_ie(dst->IEs), 2);
if ( ((uint)dst) <= 0x7fffffff ||
((uint)src) <= 0x7fffffff ||
((uint)&s_cap) <= 0x7fffffff ||
((uint)&d_cap) <= 0x7fffffff)
{
RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("\n@@@@ error address of dst\n"));
KeBugCheckEx(0x87110000, (ULONG_PTR)dst, (ULONG_PTR)src,(ULONG_PTR)&s_cap, (ULONG_PTR)&d_cap);
return false;
}
#endif
_rtw_memcpy((u8 *)&s_cap, rtw_get_capability_from_ie(src->IEs), 2); s_cap = le16_to_cpu(le_scap);
_rtw_memcpy((u8 *)&d_cap, rtw_get_capability_from_ie(dst->IEs), 2); d_cap = le16_to_cpu(le_dcap);
s_cap = le16_to_cpu(s_cap);
d_cap = le16_to_cpu(d_cap);
_func_exit_; _func_exit_;
return ((src->Ssid.SsidLength == dst->Ssid.SsidLength) && return ((src->Ssid.SsidLength == dst->Ssid.SsidLength) &&
// (src->Configuration.DSConfig == dst->Configuration.DSConfig) && ( (_rtw_memcmp(src->MacAddress, dst->MacAddress, ETH_ALEN)) == true) &&
( (_rtw_memcmp(src->MacAddress, dst->MacAddress, ETH_ALEN)) == true) && ( (_rtw_memcmp(src->Ssid.Ssid, dst->Ssid.Ssid, src->Ssid.SsidLength)) == true) &&
( (_rtw_memcmp(src->Ssid.Ssid, dst->Ssid.Ssid, src->Ssid.SsidLength)) == true) && ((s_cap & WLAN_CAPABILITY_IBSS) ==
((s_cap & WLAN_CAPABILITY_IBSS) == (d_cap & WLAN_CAPABILITY_IBSS)) &&
(d_cap & WLAN_CAPABILITY_IBSS)) && ((s_cap & WLAN_CAPABILITY_BSS) ==
((s_cap & WLAN_CAPABILITY_BSS) == (d_cap & WLAN_CAPABILITY_BSS)));
(d_cap & WLAN_CAPABILITY_BSS)));
} }
@ -1384,8 +1368,7 @@ _func_enter_;
pmlmepriv->to_join = false; pmlmepriv->to_join = false;
if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED)) if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED)) {
{
#ifdef CONFIG_SW_ANTENNA_DIVERSITY #ifdef CONFIG_SW_ANTENNA_DIVERSITY
rtw_hal_set_hwreg(padapter, HW_VAR_ANTENNA_DIVERSITY_LINK, 0); rtw_hal_set_hwreg(padapter, HW_VAR_ANTENNA_DIVERSITY_LINK, 0);
@ -1397,11 +1380,9 @@ _func_enter_;
#ifdef CONFIG_DRVEXT_MODULE #ifdef CONFIG_DRVEXT_MODULE
if (padapter->drvextpriv.enable_wpa) if (padapter->drvextpriv.enable_wpa) {
{
indicate_l2_connect(padapter); indicate_l2_connect(padapter);
} } else
else
#endif #endif
{ {
rtw_os_indicate_connect(padapter); rtw_os_indicate_connect(padapter);
@ -3495,9 +3476,8 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len)
//update cur_bwmode & cur_ch_offset //update cur_bwmode & cur_ch_offset
if ((pregistrypriv->cbw40_enable) && if ((pregistrypriv->cbw40_enable) &&
(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & BIT(1)) && (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & BIT(1)) &&
(pmlmeinfo->HT_info.infos[0] & BIT(2))) (pmlmeinfo->HT_info.infos[0] & BIT(2))) {
{
int i; int i;
u8 rf_type; u8 rf_type;
@ -3550,25 +3530,14 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len)
// //
// Config SM Power Save setting // Config SM Power Save setting
// //
pmlmeinfo->SM_PS = (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & 0x0C) >> 2; pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & 0x0C) >> 2;
if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC)
{
/*u8 i;
//update the MCS rates
for (i = 0; i < 16; i++)
{
pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i];
}*/
DBG_88E("%s(): WLAN_HT_CAP_SM_PS_STATIC\n",__func__); DBG_88E("%s(): WLAN_HT_CAP_SM_PS_STATIC\n",__func__);
}
// //
// Config current HT Protection mode. // Config current HT Protection mode.
// //
pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3; pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3;
} }
void rtw_issue_addbareq_cmd(_adapter *padapter, struct xmit_frame *pxmitframe) void rtw_issue_addbareq_cmd(_adapter *padapter, struct xmit_frame *pxmitframe)

File diff suppressed because it is too large Load diff

View file

@ -2199,7 +2199,7 @@ _func_enter_;
RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("\n===pattrib->hdrlen: %x, pattrib->iv_len:%x ===\n\n", pattrib->hdrlen, pattrib->iv_len)); RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("\n===pattrib->hdrlen: %x, pattrib->iv_len:%x ===\n\n", pattrib->hdrlen, pattrib->iv_len));
_rtw_memcpy(&eth_type, ptr+rmv_len, 2); _rtw_memcpy(&eth_type, ptr+rmv_len, 2);
eth_type= ntohs((unsigned short )eth_type); //pattrib->ether_type eth_type= ntohs((u16)eth_type); //pattrib->ether_type
pattrib->eth_type = eth_type; pattrib->eth_type = eth_type;
if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true)) if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true))

View file

@ -253,7 +253,7 @@ enum WIFI_REG_DOMAIN {
*(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_); \ *(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_); \
} while (0) } while (0)
#define GetToDs(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_TO_DS_)) != 0) #define GetToDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_TO_DS_)) != 0)
#define ClearToDs(pbuf) \ #define ClearToDs(pbuf) \
do { \ do { \
@ -265,7 +265,7 @@ enum WIFI_REG_DOMAIN {
*(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_); \ *(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_); \
} while (0) } while (0)
#define GetFrDs(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_FROM_DS_)) != 0) #define GetFrDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_FROM_DS_)) != 0)
#define ClearFrDs(pbuf) \ #define ClearFrDs(pbuf) \
do { \ do { \
@ -280,7 +280,7 @@ enum WIFI_REG_DOMAIN {
*(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_); \ *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_); \
} while (0) } while (0)
#define GetMFrag(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_MORE_FRAG_)) != 0) #define GetMFrag(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_FRAG_)) != 0)
#define ClearMFrag(pbuf) \ #define ClearMFrag(pbuf) \
do { \ do { \
@ -292,7 +292,7 @@ enum WIFI_REG_DOMAIN {
*(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_); \ *(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_); \
} while (0) } while (0)
#define GetRetry(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_RETRY_)) != 0) #define GetRetry(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_RETRY_)) != 0)
#define ClearRetry(pbuf) \ #define ClearRetry(pbuf) \
do { \ do { \
@ -304,7 +304,7 @@ enum WIFI_REG_DOMAIN {
*(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_); \ *(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_); \
} while (0) } while (0)
#define GetPwrMgt(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_PWRMGT_)) != 0) #define GetPwrMgt(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_PWRMGT_)) != 0)
#define ClearPwrMgt(pbuf) \ #define ClearPwrMgt(pbuf) \
do { \ do { \
@ -316,7 +316,7 @@ enum WIFI_REG_DOMAIN {
*(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_); \ *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_); \
} while (0) } while (0)
#define GetMData(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_MORE_DATA_)) != 0) #define GetMData(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_DATA_)) != 0)
#define ClearMData(pbuf) \ #define ClearMData(pbuf) \
do { \ do { \
@ -328,7 +328,7 @@ enum WIFI_REG_DOMAIN {
*(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_); \ *(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_); \
} while (0) } while (0)
#define GetPrivacy(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_PRIVACY_)) != 0) #define GetPrivacy(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_PRIVACY_)) != 0)
#define ClearPrivacy(pbuf) \ #define ClearPrivacy(pbuf) \
do { \ do { \
@ -336,9 +336,9 @@ enum WIFI_REG_DOMAIN {
} while (0) } while (0)
#define GetOrder(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_ORDER_)) != 0) #define GetOrder(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_ORDER_)) != 0)
#define GetFrameType(pbuf) (le16_to_cpu(*(unsigned short *)(pbuf)) & (BIT(3) | BIT(2))) #define GetFrameType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(3) | BIT(2)))
#define SetFrameType(pbuf,type) \ #define SetFrameType(pbuf,type) \
do { \ do { \
@ -346,7 +346,7 @@ enum WIFI_REG_DOMAIN {
*(unsigned short *)(pbuf) |= __constant_cpu_to_le16(type); \ *(unsigned short *)(pbuf) |= __constant_cpu_to_le16(type); \
} while (0) } while (0)
#define GetFrameSubType(pbuf) (cpu_to_le16(*(unsigned short *)(pbuf)) & (BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2))) #define GetFrameSubType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2)))
#define SetFrameSubType(pbuf,type) \ #define SetFrameSubType(pbuf,type) \
do { \ do { \
@ -369,9 +369,9 @@ enum WIFI_REG_DOMAIN {
#define SetSeqNum(pbuf, num) \ #define SetSeqNum(pbuf, num) \
do { \ do { \
*(u16 *)((SIZE_PTR)(pbuf) + 22) = \ *(__le16 *)((SIZE_PTR)(pbuf) + 22) = \
((*(u16 *)((SIZE_PTR)(pbuf) + 22)) & le16_to_cpu((unsigned short)0x000f)) | \ ((*(__le16 *)((SIZE_PTR)(pbuf) + 22)) & cpu_to_le16((unsigned short)0x000f)) | \
le16_to_cpu((unsigned short)(0xfff0 & (num << 4))); \ cpu_to_le16((unsigned short)(0xfff0 & (num << 4))); \
} while (0) } while (0)
#define SetDuration(pbuf, dur) \ #define SetDuration(pbuf, dur) \
@ -711,7 +711,7 @@ struct HT_caps_element
{ {
struct struct
{ {
unsigned short HT_caps_info; __le16 HT_caps_info;
unsigned char AMPDU_para; unsigned char AMPDU_para;
unsigned char MCS_rate[16]; unsigned char MCS_rate[16];
unsigned short HT_ext_caps; unsigned short HT_ext_caps;
@ -784,7 +784,7 @@ struct HT_caps_element
{ {
struct struct
{ {
unsigned short HT_caps_info; __le16 HT_caps_info;
unsigned char AMPDU_para; unsigned char AMPDU_para;
unsigned char MCS_rate[16]; unsigned char MCS_rate[16];
unsigned short HT_ext_caps; unsigned short HT_ext_caps;