From: Kristina Martšenko Date: Tue, 11 Mar 2014 18:58:14 +0000 (+0200) Subject: staging: rtl8188eu: explicitly convert from __le16 to integer X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=b812982e6b9ce3797f160ad3778766db107b5086;p=linux-beck.git staging: rtl8188eu: explicitly convert from __le16 to integer BA_para_set (of type __le16) is implicitly cast into an integer for bitwise operations, after which the result is converted back into a __le16. Make the initial cast explicit to make the code clearer. In addition, refactor the code for readability. This also removes five sparse warnings of the following type: drivers/staging/rtl8188eu//core/rtw_mlme_ext.c:6114:70: warning: restricted __le16 degrades to integer Signed-off-by: Kristina Martšenko Signed-off-by: Peter P Waskiewicz Jr --- diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 4942759b19c8..21f2f8707176 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -6109,17 +6109,26 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned ch case 1: /* ADDBA rsp */ pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->ADDBA_req.dialog_token), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&status), &(pattrib->pktlen)); + + BA_para_set = le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f; rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); - if (MAX_AMPDU_FACTOR_64K == max_rx_ampdu_factor) - BA_para_set = (((pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); /* 64 buffer size */ - else if (MAX_AMPDU_FACTOR_32K == max_rx_ampdu_factor) - BA_para_set = (((pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0800); /* 32 buffer size */ - else if (MAX_AMPDU_FACTOR_16K == max_rx_ampdu_factor) - BA_para_set = (((pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0400); /* 16 buffer size */ - else if (MAX_AMPDU_FACTOR_8K == max_rx_ampdu_factor) - BA_para_set = (((pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0200); /* 8 buffer size */ - else - BA_para_set = (((pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); /* 64 buffer size */ + switch (max_rx_ampdu_factor) { + case MAX_AMPDU_FACTOR_64K: + BA_para_set |= 0x1000; /* 64 buffer size */ + break; + case MAX_AMPDU_FACTOR_32K: + BA_para_set |= 0x0800; /* 32 buffer size */ + break; + case MAX_AMPDU_FACTOR_16K: + BA_para_set |= 0x0400; /* 16 buffer size */ + break; + case MAX_AMPDU_FACTOR_8K: + BA_para_set |= 0x0200; /* 8 buffer size */ + break; + default: + BA_para_set |= 0x1000; /* 64 buffer size */ + break; + } if (pregpriv->ampdu_amsdu == 0)/* disabled */ BA_para_set = BA_para_set & ~BIT(0);