From 3e4e8e025c374959538d37a812a7c20f7aa8a5c1 Mon Sep 17 00:00:00 2001 From: Luca Ceresoli Date: Tue, 22 Sep 2015 23:50:37 +0200 Subject: [PATCH] staging: rtl8188eu: don't cast when calling rtw_set_fixed_ie() The 'pbuf' and 'source' arguments to rtw_set_fixed_ie() are (void *), the explicit typecasts are not needed. They just make code less readable. Also fix checkpatch issues in the lines touched: ERROR: space prohibited before that ',' (ctx:WxW) WARNING: line over 80 characters CHECK: Unnecessary parentheses around Note: some of the modified lines are still over 80 characters because they are not fixable by just adding newlines. They will be fixed in a later patch. Signed-off-by: Luca Ceresoli Cc: Larry Finger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 60 ++++++++++++------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 4258a5e8ed68..e31eae9b0583 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -812,17 +812,20 @@ static void issue_auth(struct adapter *padapter, struct sta_info *psta, le_val16 = 0; } - pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&le_val16, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, &le_val16, + &pattrib->pktlen); /* setting auth seq number */ val16 = (u16)psta->auth_seq; le_val16 = cpu_to_le16(val16); - pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&le_val16, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, &le_val16, + &pattrib->pktlen); /* setting status code... */ val16 = status; le_val16 = cpu_to_le16(val16); - pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&le_val16, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, + &le_val16, &pattrib->pktlen); /* added challenging text... */ if ((psta->auth_seq == 2) && (psta->state & WIFI_FW_AUTH_STATE) && (use_shared_key == 1)) @@ -844,23 +847,27 @@ static void issue_auth(struct adapter *padapter, struct sta_info *psta, if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key == 1)) { val32 = (pmlmeinfo->iv++) | (pmlmeinfo->key_index << 30); le_tmp32 = cpu_to_le32(val32); - pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *)&le_tmp32, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 4, &le_tmp32, + &pattrib->pktlen); pattrib->iv_len = 4; } le_tmp16 = cpu_to_le16(val16); - pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&le_tmp16, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, &le_tmp16, + &pattrib->pktlen); /* setting auth seq number */ val16 = pmlmeinfo->auth_seq; le_tmp16 = cpu_to_le16(val16); - pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&le_tmp16, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, &le_tmp16, + &pattrib->pktlen); /* setting status code... */ le_tmp16 = cpu_to_le16(status); - pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&le_tmp16, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, &le_tmp16, + &pattrib->pktlen); /* then checking to see if sending challenging text... */ if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key == 1)) { @@ -944,13 +951,14 @@ static void issue_asocrsp(struct adapter *padapter, unsigned short status, /* capability */ val = *(unsigned short *)rtw_get_capability_from_ie(ie); - pframe = rtw_set_fixed_ie(pframe, _CAPABILITY_ , (unsigned char *)&val, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, _CAPABILITY_, &val, &pattrib->pktlen); lestatus = cpu_to_le16(status); - pframe = rtw_set_fixed_ie(pframe , _STATUS_CODE_ , (unsigned char *)&lestatus, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, &lestatus, + &pattrib->pktlen); leval = cpu_to_le16(pstat->aid | BIT(14) | BIT(15)); - pframe = rtw_set_fixed_ie(pframe, _ASOC_ID_ , (unsigned char *)&leval, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, _ASOC_ID_, &leval, &pattrib->pktlen); if (pstat->bssratelen <= 8) { pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, pstat->bssratelen, pstat->bssrateset, &(pattrib->pktlen)); @@ -1499,7 +1507,8 @@ static int _issue_deauth(struct adapter *padapter, unsigned char *da, unsigned s pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); le_tmp = cpu_to_le16(reason); - pframe = rtw_set_fixed_ie(pframe, _RSON_CODE_ , (unsigned char *)&le_tmp, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, _RSON_CODE_, &le_tmp, + &pattrib->pktlen); pattrib->last_txcmdsz = pattrib->pktlen; @@ -1687,11 +1696,13 @@ static void issue_action_BA(struct adapter *padapter, unsigned char *raddr, BA_para_set = 0x1002 | ((status & 0xf) << 2); /* immediate ack & 64 buffer size */ le_tmp = cpu_to_le16(BA_para_set); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_tmp)), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 2, &(le_tmp), + &pattrib->pktlen); BA_timeout_value = 5000;/* 5ms */ le_tmp = cpu_to_le16(BA_timeout_value); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_tmp)), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 2, &(le_tmp), + &pattrib->pktlen); psta = rtw_get_stainfo(pstapriv, raddr); if (psta != NULL) { @@ -1704,11 +1715,15 @@ static void issue_action_BA(struct adapter *padapter, unsigned char *raddr, BA_starting_seqctrl = start_seq << 4; } le_tmp = cpu_to_le16(BA_starting_seqctrl); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_tmp)), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 2, &(le_tmp), + &pattrib->pktlen); break; 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)); + pframe = rtw_set_fixed_ie(pframe, 1, + &pmlmeinfo->ADDBA_req.dialog_token, + &pattrib->pktlen); + pframe = rtw_set_fixed_ie(pframe, 2, &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); @@ -1736,17 +1751,22 @@ static void issue_action_BA(struct adapter *padapter, unsigned char *raddr, BA_para_set = BA_para_set | BIT(0); le_tmp = cpu_to_le16(BA_para_set); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_tmp)), &(pattrib->pktlen)); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(pmlmeinfo->ADDBA_req.BA_timeout_value)), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 2, &(le_tmp), + &pattrib->pktlen); + pframe = rtw_set_fixed_ie(pframe, 2, + &pmlmeinfo->ADDBA_req.BA_timeout_value, + &pattrib->pktlen); break; case 2:/* DELBA */ BA_para_set = (status & 0x1F) << 3; le_tmp = cpu_to_le16(BA_para_set); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_tmp)), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 2, &(le_tmp), + &pattrib->pktlen); reason_code = 37;/* Requested from peer STA as it does not want to use the mechanism */ le_tmp = cpu_to_le16(reason_code); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_tmp)), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 2, &(le_tmp), + &pattrib->pktlen); break; default: break; -- 2.39.5