diff options
Diffstat (limited to 'drivers/staging/rtl8192u')
22 files changed, 186 insertions, 285 deletions
diff --git a/drivers/staging/rtl8192u/Kconfig b/drivers/staging/rtl8192u/Kconfig index 97df6507a485..22c2165e8b1c 100644 --- a/drivers/staging/rtl8192u/Kconfig +++ b/drivers/staging/rtl8192u/Kconfig @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 config RTL8192U tristate "RealTek RTL8192U Wireless LAN NIC driver" depends on PCI && WLAN && USB diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 8aa536d79900..d36963469015 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11 * remains copyright by the original authors @@ -15,11 +16,6 @@ * * Modified for Realtek's wi-fi cards by Andrea Merello * <andrea.merello@gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. */ #ifndef IEEE80211_H #define IEEE80211_H @@ -296,7 +292,7 @@ struct cb_desc { #define ieee80211_wx_get_encode_ext ieee80211_wx_get_encode_ext_rsl -typedef struct ieee_param { +struct ieee_param { u32 cmd; u8 sta_addr[ETH_ALEN]; union { @@ -323,7 +319,7 @@ typedef struct ieee_param { u8 key[0]; } crypt; } u; -} ieee_param; +}; // linux under 2.6.9 release may not support it, so modify it for common use @@ -1462,23 +1458,23 @@ struct tx_pending { struct ieee80211_txb *txb; }; -typedef struct _bandwidth_autoswitch { +struct bandwidth_autoswitch { long threshold_20Mhzto40Mhz; long threshold_40Mhzto20Mhz; bool bforced_tx20Mhz; bool bautoswitch_enable; -} bandwidth_autoswitch, *pbandwidth_autoswitch; +}; //added by amy for order #define REORDER_WIN_SIZE 128 #define REORDER_ENTRY_NUM 128 -typedef struct _RX_REORDER_ENTRY { +struct rx_reorder_entry { struct list_head List; u16 SeqNum; struct ieee80211_rxb *prxb; -} RX_REORDER_ENTRY, *PRX_REORDER_ENTRY; +}; //added by amy for order typedef enum _Fsync_State { Default_Fsync, @@ -1506,9 +1502,9 @@ typedef enum _RT_JOIN_ACTION { RT_NO_ACTION = 4, } RT_JOIN_ACTION; -typedef struct _IbssParms { +struct ibss_parms { u16 atimWin; -} IbssParms, *PIbssParms; +}; #define MAX_NUM_RATES 264 // Max num of support rates element: 8, Max num of ext. support rate: 255. 061122, by rcnjko. // RF state. @@ -1518,7 +1514,7 @@ typedef enum _RT_RF_POWER_STATE { eRfOff } RT_RF_POWER_STATE; -typedef struct _RT_POWER_SAVE_CONTROL { +struct rt_power_save_control { // // Inactive Power Save(IPS) : Disable RF when disconnected @@ -1554,7 +1550,7 @@ typedef struct _RT_POWER_SAVE_CONTROL { struct octet_string tmpSuppRateSet; u8 tmpSuppRateBuf[MAX_NUM_RATES]; bool bTmpSuppRate; - IbssParms tmpIbpm; + struct ibss_parms tmpIbpm; bool bTmpIbpm; // @@ -1562,7 +1558,7 @@ typedef struct _RT_POWER_SAVE_CONTROL { // bool bLeisurePs; -} RT_POWER_SAVE_CONTROL, *PRT_POWER_SAVE_CONTROL; +}; typedef u32 RT_RF_CHANGE_SOURCE; #define RF_CHANGE_BY_SW BIT(31) @@ -1586,7 +1582,7 @@ typedef enum { } country_code_type_t; #define RT_MAX_LD_SLOT_NUM 10 -typedef struct _RT_LINK_DETECT_T { +struct rt_link_detect { u32 NumRecvBcnInPeriod; u32 NumRecvDataInPeriod; @@ -1599,7 +1595,7 @@ typedef struct _RT_LINK_DETECT_T { u32 NumTxOkInPeriod; u32 NumRxOkInPeriod; bool bBusyTraffic; -} RT_LINK_DETECT_T, *PRT_LINK_DETECT_T; +}; struct ieee80211_device { @@ -1654,7 +1650,7 @@ struct ieee80211_device { struct list_head Rx_TS_Unused_List; struct rx_ts_record RxTsRecord[TOTAL_TS_NUM]; //#ifdef TO_DO_LIST - RX_REORDER_ENTRY RxReorderEntry[128]; + struct rx_reorder_entry RxReorderEntry[128]; struct list_head RxReorder_Unused_List; //#endif // Qos related. Added by Annie, 2005-11-01. @@ -1871,14 +1867,14 @@ struct ieee80211_device { Fsync_State fsync_state; bool bis_any_nonbepkts; //20Mhz 40Mhz AutoSwitch Threshold - bandwidth_autoswitch bandwidth_auto_switch; + struct bandwidth_autoswitch bandwidth_auto_switch; //for txpower tracking bool FwRWRF; //added by amy for AP roaming - RT_LINK_DETECT_T LinkDetectInfo; + struct rt_link_detect LinkDetectInfo; //added by amy for ps - RT_POWER_SAVE_CONTROL PowerSaveControl; + struct rt_power_save_control PowerSaveControl; //} /* used if IEEE_SOFTMAC_TX_QUEUE is set */ struct tx_pending tx_pending; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c index 6f457812e5a3..36987fccac5d 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c @@ -1,14 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Host AP crypto routines * * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> * Portions Copyright (C) 2004, Intel Corporation <jketreno@linux.intel.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. - * */ #include <linux/module.h> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h index 1f2aea7e0e55..d3bd5598b25b 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Original code based on Host AP (software wireless LAN access point) driver * for Intersil Prism2/2.5/3. @@ -10,11 +11,6 @@ * <jketreno@linux.intel.com> * * Copyright (c) 2004, Intel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. */ /* diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index 3534ddb900d1..d7188b3f3190 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -1,12 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Host AP crypt: host-based CCMP encryption implementation for Host AP driver * * Copyright (c) 2003-2004, Jouni Malinen <jkmaline@cc.hut.fi> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. */ #include <linux/module.h> @@ -216,7 +212,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) *pos++ = key->tx_pn[5]; *pos++ = key->tx_pn[4]; *pos++ = 0; - *pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */; + *pos++ = (key->key_idx << 6) | BIT(5) /* Ext IV included */; *pos++ = key->tx_pn[3]; *pos++ = key->tx_pn[2]; *pos++ = key->tx_pn[1]; @@ -274,7 +270,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) hdr = (struct rtl_80211_hdr_4addr *)skb->data; pos = skb->data + hdr_len; keyidx = pos[3]; - if (!(keyidx & (1 << 5))) { + if (!(keyidx & BIT(5))) { if (net_ratelimit()) { netdev_dbg(skb->dev, "CCMP: received packet without ExtIV flag from %pM\n", hdr->addr2); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index d67bb57994c4..0927b2b15151 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -1,12 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Host AP crypt: host-based TKIP encryption implementation for Host AP driver * * Copyright (c) 2003-2004, Jouni Malinen <jkmaline@cc.hut.fi> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. */ #include <linux/module.h> @@ -331,7 +327,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) *pos++ = rc4key[2]; } - *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */; + *pos++ = (tkey->key_idx << 6) | BIT(5) /* Ext IV included */; *pos++ = tkey->tx_iv32 & 0xff; *pos++ = (tkey->tx_iv32 >> 8) & 0xff; *pos++ = (tkey->tx_iv32 >> 16) & 0xff; @@ -390,7 +386,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) hdr = (struct rtl_80211_hdr_4addr *) skb->data; pos = skb->data + hdr_len; keyidx = pos[3]; - if (!(keyidx & (1 << 5))) { + if (!(keyidx & BIT(5))) { if (net_ratelimit()) { printk(KERN_DEBUG "TKIP: received packet without ExtIV" " flag from %pM\n", hdr->addr2); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index d4a1bf0caa7a..805493a0870d 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -1,12 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Host AP crypt: host-based WEP encryption implementation for Host AP driver * * Copyright (c) 2002-2004, Jouni Malinen <jkmaline@cc.hut.fi> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. */ #include <linux/module.h> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 5147f7c01e31..0e762e559675 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Original code based Host AP (software wireless LAN access point) driver * for Intersil Prism2/2.5/3 - hostap.o module, common routines @@ -6,11 +7,6 @@ * <jkmaline@cc.hut.fi> * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> * Copyright (c) 2004, Intel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. ****************************************************************************** Few modifications for Realtek's Wi-Fi drivers by @@ -151,7 +147,7 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee, * should have already been received */ entry = ieee80211_frag_cache_find(ieee, seq, frag, tid,hdr->addr2, hdr->addr1); - if (entry != NULL) { + if (entry) { entry->last_frag = frag; skb = entry->skb; } @@ -190,7 +186,7 @@ static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, entry = ieee80211_frag_cache_find(ieee, seq, -1, tid, hdr->addr2, hdr->addr1); - if (entry == NULL) { + if (!entry) { IEEE80211_DEBUG_FRAG( "could not invalidate fragment cache " "entry (seq=%u)\n", seq); @@ -341,7 +337,7 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, struct rtl_80211_hdr_4addr *hdr; int res, hdrlen; - if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) + if (!crypt || !crypt->ops->decrypt_mpdu) return 0; if (ieee->hwsec_active) { @@ -388,7 +384,7 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *s struct rtl_80211_hdr_4addr *hdr; int res, hdrlen; - if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) + if (!crypt || !crypt->ops->decrypt_msdu) return 0; if (ieee->hwsec_active) { @@ -508,23 +504,17 @@ drop: return 1; } -static bool AddReorderEntry(struct rx_ts_record *pTS, PRX_REORDER_ENTRY pReorderEntry) +static bool AddReorderEntry(struct rx_ts_record *pTS, struct rx_reorder_entry *pReorderEntry) { struct list_head *pList = &pTS->rx_pending_pkt_list; while(pList->next != &pTS->rx_pending_pkt_list) { - if( SN_LESS(pReorderEntry->SeqNum, ((PRX_REORDER_ENTRY)list_entry(pList->next,RX_REORDER_ENTRY,List))->SeqNum) ) - { + if (SN_LESS(pReorderEntry->SeqNum, list_entry(pList->next, struct rx_reorder_entry, List)->SeqNum)) pList = pList->next; - } - else if( SN_EQUAL(pReorderEntry->SeqNum, ((PRX_REORDER_ENTRY)list_entry(pList->next,RX_REORDER_ENTRY,List))->SeqNum) ) - { + else if (SN_EQUAL(pReorderEntry->SeqNum, list_entry(pList->next, struct rx_reorder_entry, List)->SeqNum)) return false; - } else - { break; - } } pReorderEntry->List.next = pList->next; pReorderEntry->List.next->prev = &pReorderEntry->List; @@ -589,7 +579,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, struct rx_ts_record *pTS, u16 SeqNum) { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; - PRX_REORDER_ENTRY pReorderEntry = NULL; + struct rx_reorder_entry *pReorderEntry = NULL; struct ieee80211_rxb **prxbIndicateArray; u8 WinSize = pHTInfo->RxReorderWinSize; u16 WinEnd = (pTS->rx_indicate_seq + WinSize - 1) % 4096; @@ -604,9 +594,8 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, return; /* Rx Reorder initialize condition.*/ - if (pTS->rx_indicate_seq == 0xffff) { + if (pTS->rx_indicate_seq == 0xffff) pTS->rx_indicate_seq = SeqNum; - } /* Drop out the packet which SeqNum is smaller than WinStart */ if (SN_LESS(SeqNum, pTS->rx_indicate_seq)) { @@ -663,7 +652,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, /* Current packet is going to be inserted into pending list.*/ //IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): We RX no ordered packed, insert to ordered list\n",__func__); if(!list_empty(&ieee->RxReorder_Unused_List)) { - pReorderEntry = (PRX_REORDER_ENTRY)list_entry(ieee->RxReorder_Unused_List.next,RX_REORDER_ENTRY,List); + pReorderEntry = list_entry(ieee->RxReorder_Unused_List.next, struct rx_reorder_entry, List); list_del_init(&pReorderEntry->List); /* Make a reorder entry and insert into a the packet list.*/ @@ -709,7 +698,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, /* Check if there is any packet need indicate.*/ while(!list_empty(&pTS->rx_pending_pkt_list)) { IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): start RREORDER indicate\n",__func__); - pReorderEntry = (PRX_REORDER_ENTRY)list_entry(pTS->rx_pending_pkt_list.prev,RX_REORDER_ENTRY,List); + pReorderEntry = list_entry(pTS->rx_pending_pkt_list.prev, struct rx_reorder_entry, List); if (SN_LESS(pReorderEntry->SeqNum, pTS->rx_indicate_seq) || SN_EQUAL(pReorderEntry->SeqNum, pTS->rx_indicate_seq)) { @@ -989,8 +978,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, /* allow NULL decrypt to indicate an station specific override * for default encryption */ - if (crypt && (crypt->ops == NULL || - crypt->ops->decrypt_mpdu == NULL)) + if (crypt && (!crypt->ops || !crypt->ops->decrypt_mpdu)) crypt = NULL; if (!crypt && (fc & IEEE80211_FCTL_WEP)) { @@ -1291,7 +1279,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, } //added by amy for reorder - if (!ieee->pHTInfo->bCurRxReorderEnable || pTS == NULL){ + if (!ieee->pHTInfo->bCurRxReorderEnable || !pTS) { //added by amy for reorder for(i = 0; i<rxb->nr_subframes; i++) { struct sk_buff *sub_skb = rxb->subframes[i]; @@ -1427,9 +1415,9 @@ static int ieee80211_read_qos_info_element(struct int ret = 0; u16 size = sizeof(struct ieee80211_qos_information_element) - 2; - if (element_info == NULL) + if (!element_info) return -1; - if (info_element == NULL) + if (!info_element) return -1; if ((info_element->id == QOS_ELEMENT_ID) && (info_element->len == size)) { @@ -2405,22 +2393,22 @@ static inline void ieee80211_process_probe_response( "'%s' (%pM): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", escape_essid(info_element->data, info_element->len), beacon->header.addr3, - (capability & (1 << 0xf)) ? '1' : '0', - (capability & (1 << 0xe)) ? '1' : '0', - (capability & (1 << 0xd)) ? '1' : '0', - (capability & (1 << 0xc)) ? '1' : '0', - (capability & (1 << 0xb)) ? '1' : '0', - (capability & (1 << 0xa)) ? '1' : '0', - (capability & (1 << 0x9)) ? '1' : '0', - (capability & (1 << 0x8)) ? '1' : '0', - (capability & (1 << 0x7)) ? '1' : '0', - (capability & (1 << 0x6)) ? '1' : '0', - (capability & (1 << 0x5)) ? '1' : '0', - (capability & (1 << 0x4)) ? '1' : '0', - (capability & (1 << 0x3)) ? '1' : '0', - (capability & (1 << 0x2)) ? '1' : '0', - (capability & (1 << 0x1)) ? '1' : '0', - (capability & (1 << 0x0)) ? '1' : '0'); + (capability & BIT(0xf)) ? '1' : '0', + (capability & BIT(0xe)) ? '1' : '0', + (capability & BIT(0xd)) ? '1' : '0', + (capability & BIT(0xc)) ? '1' : '0', + (capability & BIT(0xb)) ? '1' : '0', + (capability & BIT(0xa)) ? '1' : '0', + (capability & BIT(0x9)) ? '1' : '0', + (capability & BIT(0x8)) ? '1' : '0', + (capability & BIT(0x7)) ? '1' : '0', + (capability & BIT(0x6)) ? '1' : '0', + (capability & BIT(0x5)) ? '1' : '0', + (capability & BIT(0x4)) ? '1' : '0', + (capability & BIT(0x3)) ? '1' : '0', + (capability & BIT(0x2)) ? '1' : '0', + (capability & BIT(0x1)) ? '1' : '0', + (capability & BIT(0x0)) ? '1' : '0'); if (ieee80211_network_init(ieee, beacon, network, stats)) { IEEE80211_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n", diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 8635faf84316..944c8894f9ff 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* IEEE 802.11 SoftMAC layer * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> * @@ -9,8 +10,6 @@ * * WPA code stolen from the ipw2200 driver. * Copyright who own it's copyright. - * - * released under the GPL */ #include "ieee80211.h" diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c index 81020fbcdc20..aab1586fe0dd 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* IEEE 802.11 SoftMAC layer * Copyright (c) 2005 Andrea Merello <andrea.merello@gmail.com> * @@ -9,8 +10,6 @@ * * PS wx handler mostly stolen from hostap, copyright who * own it's copyright ;-) - * - * released under the GPL */ diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index 024fa2702546..8e1ec4409b4f 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -1,23 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /****************************************************************************** * * Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * * Contact Information: * James P. Ketrenos <ipw2100-admin@linux.intel.com> * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 @@ -318,17 +303,17 @@ static void ieee80211_tx_query_agg_cap(struct ieee80211_device *ieee, return; //check packet and mode later #ifdef TO_DO_LIST - if(pTcb->PacketLength >= 4096) + if (pTcb->PacketLength >= 4096) return; // For RTL819X, if pairwisekey = wep/tkip, we don't aggrregation. - if(!Adapter->HalFunc.GetNmodeSupportBySecCfgHandler(Adapter)) + if (!Adapter->HalFunc.GetNmodeSupportBySecCfgHandler(Adapter)) return; #endif - if(!ieee->GetNmodeSupportBySecCfg(ieee->dev)) + if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { return; } - if(pHTInfo->bCurrentAMPDUEnable) + if (pHTInfo->bCurrentAMPDUEnable) { if (!GetTs(ieee, (struct ts_common_info **)(&pTxTs), hdr->addr1, skb->priority, TX_DIR, true)) { @@ -398,18 +383,18 @@ ieee80211_query_HTCapShortGI(struct ieee80211_device *ieee, struct cb_desc *tcb_ tcb_desc->bUseShortGI = false; - if(!pHTInfo->bCurrentHTSupport||!pHTInfo->bEnableHT) + if (!pHTInfo->bCurrentHTSupport||!pHTInfo->bEnableHT) return; - if(pHTInfo->bForcedShortGI) + if (pHTInfo->bForcedShortGI) { tcb_desc->bUseShortGI = true; return; } - if((pHTInfo->bCurBW40MHz==true) && pHTInfo->bCurShortGI40MHz) + if ((pHTInfo->bCurBW40MHz==true) && pHTInfo->bCurShortGI40MHz) tcb_desc->bUseShortGI = true; - else if((pHTInfo->bCurBW40MHz==false) && pHTInfo->bCurShortGI20MHz) + else if ((pHTInfo->bCurBW40MHz==false) && pHTInfo->bCurShortGI20MHz) tcb_desc->bUseShortGI = true; } @@ -420,13 +405,13 @@ static void ieee80211_query_BandwidthMode(struct ieee80211_device *ieee, tcb_desc->bPacketBW = false; - if(!pHTInfo->bCurrentHTSupport||!pHTInfo->bEnableHT) + if (!pHTInfo->bCurrentHTSupport||!pHTInfo->bEnableHT) return; - if(tcb_desc->bMulticast || tcb_desc->bBroadcast) + if (tcb_desc->bMulticast || tcb_desc->bBroadcast) return; - if((tcb_desc->data_rate & 0x80)==0) // If using legacy rate, it shall use 20MHz channel. + if ((tcb_desc->data_rate & 0x80)==0) // If using legacy rate, it shall use 20MHz channel. return; //BandWidthAutoSwitch is for auto switch to 20 or 40 in long distance if(pHTInfo->bCurBW40MHz && pHTInfo->bCurTxBW40MHz && !ieee->bandwidth_auto_switch.bforced_tx20Mhz) @@ -851,7 +836,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev) else ieee->seq_ctrl[0]++; } - }else{ + } else { if (unlikely(skb->len < sizeof(struct rtl_80211_hdr_3addr))) { printk(KERN_WARNING "%s: skb too small (%d).\n", ieee->dev->name, skb->len); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c index fa59c712c74b..dead134f6de0 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /****************************************************************************** Copyright(c) 2004 Intel Corporation. All rights reserved. @@ -8,22 +9,6 @@ <jkmaline@cc.hut.fi> Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> - This program is free software; you can redistribute it and/or modify it - under the terms of version 2 of the GNU General Public License as - published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - Contact Information: James P. Ketrenos <ipw2100-admin@linux.intel.com> Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 @@ -86,7 +71,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, /* Add the protocol name */ iwe.cmd = SIOCGIWNAME; for(i=0; i<ARRAY_SIZE(ieee80211_modes); i++) { - if(network->mode&(1<<i)) { + if (network->mode & BIT(i)) { sprintf(pname,ieee80211_modes[i].mode_string,ieee80211_modes[i].mode_size); pname +=ieee80211_modes[i].mode_size; } @@ -195,7 +180,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, if (iwe.u.data.length) start = iwe_stream_add_point(info, start, stop, &iwe, custom); - if (ieee->wpa_enabled && network->wpa_ie_len){ + if (ieee->wpa_enabled && network->wpa_ie_len) { char buf[MAX_WPA_IE_LEN * 2 + 30]; // printk("WPA IE\n"); u8 *p = buf; @@ -210,7 +195,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, start = iwe_stream_add_point(info, start, stop, &iwe, buf); } - if (ieee->wpa_enabled && network->rsn_ie_len){ + if (ieee->wpa_enabled && network->rsn_ie_len) { char buf[MAX_WPA_IE_LEN * 2 + 30]; u8 *p = buf; @@ -394,9 +379,10 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, sec.key_sizes[key] = len; (*crypt)->ops->set_key(sec.keys[key], len, NULL, (*crypt)->priv); - sec.flags |= (1 << key); + sec.flags |= BIT(key); /* This ensures a key will be activated if no key is - * explicitely set */ + * explicitly set + */ if (key == sec.active_key) sec.flags |= SEC_ACTIVE_KEY; ieee->tx_keyidx = key; @@ -415,7 +401,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, (*crypt)->ops->set_key(sec.keys[key], 13, NULL, (*crypt)->priv); sec.key_sizes[key] = 13; - sec.flags |= (1 << key); + sec.flags |= BIT(key); } /* No key data - just set the default TX key index */ @@ -636,7 +622,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, if (ext->alg != IW_ENCODE_ALG_NONE) { //memcpy(sec.keys[idx], ext->key, ext->key_len); sec.key_sizes[idx] = ext->key_len; - sec.flags |= (1 << idx); + sec.flags |= BIT(idx); if (ext->alg == IW_ENCODE_ALG_WEP) { // sec.encode_alg[idx] = SEC_ALG_WEP; sec.flags |= SEC_LEVEL; @@ -766,15 +752,13 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee, case IW_AUTH_80211_AUTH_ALG: //printk("======>%s():data->value is %d\n",__func__,data->value); // ieee->open_wep = (data->value&IW_AUTH_ALG_OPEN_SYSTEM)?1:0; - if(data->value & IW_AUTH_ALG_SHARED_KEY){ + if (data->value & IW_AUTH_ALG_SHARED_KEY) { ieee->open_wep = 0; ieee->auth_mode = 1; - } - else if(data->value & IW_AUTH_ALG_OPEN_SYSTEM){ + } else if (data->value & IW_AUTH_ALG_OPEN_SYSTEM) { ieee->open_wep = 1; ieee->auth_mode = 0; - } - else if(data->value & IW_AUTH_ALG_LEAP){ + } else if (data->value & IW_AUTH_ALG_LEAP) { ieee->open_wep = 1; ieee->auth_mode = 2; } diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index 109445407cec..53869b3c985c 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -108,7 +108,7 @@ void ResetBaEntry(struct ba_record *pBA) static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, struct ba_record *pBA, u16 StatusCode, u8 type) { struct sk_buff *skb = NULL; - struct rtl_80211_hdr_3addr *BAReq = NULL; + struct rtl_80211_hdr_3addr *BAReq = NULL; u8 *tag = NULL; u16 len = ieee->tx_headroom + 9; //category(1) + action field(1) + Dialog Token(1) + BA Parameter Set(2) + BA Timeout Value(2) + BA Start SeqCtrl(2)(or StatusCode(2)) @@ -118,10 +118,8 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, s return NULL; } skb = dev_alloc_skb(len + sizeof(struct rtl_80211_hdr_3addr)); //need to add something others? FIXME - if (!skb) { - IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); + if (!skb) return NULL; - } memset(skb->data, 0, sizeof(struct rtl_80211_hdr_3addr)); //I wonder whether it's necessary. Apparently kernel will not do it when alloc a skb. skb_reserve(skb, ieee->tx_headroom); @@ -189,7 +187,7 @@ static struct sk_buff *ieee80211_DELBA( { union delba_param_set DelbaParamSet; struct sk_buff *skb = NULL; - struct rtl_80211_hdr_3addr *Delba = NULL; + struct rtl_80211_hdr_3addr *Delba = NULL; u8 *tag = NULL; //len = head len + DELBA Parameter Set(2) + Reason Code(2) u16 len = 6 + ieee->tx_headroom; @@ -205,10 +203,8 @@ static struct sk_buff *ieee80211_DELBA( DelbaParamSet.field.tid = pBA->param_set.field.tid; skb = dev_alloc_skb(len + sizeof(struct rtl_80211_hdr_3addr)); //need to add something others? FIXME - if (!skb) { - IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); + if (!skb) return NULL; - } // memset(skb->data, 0, len+sizeof( struct rtl_80211_hdr_3addr)); skb_reserve(skb, ieee->tx_headroom); @@ -318,7 +314,7 @@ static void ieee80211_send_DELBA(struct ieee80211_device *ieee, u8 *dst, ********************************************************************************************************************/ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) { - struct rtl_80211_hdr_3addr *req = NULL; + struct rtl_80211_hdr_3addr *req = NULL; u16 rc = 0; u8 *dst = NULL, *pDialogToken = NULL, *tag = NULL; struct ba_record *pBA = NULL; @@ -388,9 +384,9 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) pBA->start_seq_ctrl = *pBaStartSeqCtrl; //for half N mode we only aggregate 1 frame if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) - pBA->param_set.field.buffer_size = 1; + pBA->param_set.field.buffer_size = 1; else - pBA->param_set.field.buffer_size = 32; + pBA->param_set.field.buffer_size = 32; ActivateBAEntry(ieee, pBA, pBA->timeout_value); ieee80211_send_ADDBARsp(ieee, dst, pBA, ADDBA_STATUS_SUCCESS); @@ -418,7 +414,7 @@ OnADDBAReq_Fail: ********************************************************************************************************************/ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) { - struct rtl_80211_hdr_3addr *rsp = NULL; + struct rtl_80211_hdr_3addr *rsp = NULL; struct ba_record *pPendingBA, *pAdmittedBA; struct tx_ts_record *pTS = NULL; u8 *dst = NULL, *pDialogToken = NULL, *tag = NULL; @@ -542,7 +538,7 @@ OnADDBARsp_Reject: ********************************************************************************************************************/ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) { - struct rtl_80211_hdr_3addr *delba = NULL; + struct rtl_80211_hdr_3addr *delba = NULL; union delba_param_set *pDelBaParamSet = NULL; u8 *dst = NULL; diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h index 64d5359cf7e2..b7769bca9740 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h @@ -107,13 +107,13 @@ typedef struct _HT_INFORMATION_ELE { typedef enum _HT_SPEC_VER { HT_SPEC_VER_IEEE = 0, HT_SPEC_VER_EWC = 1, -}HT_SPEC_VER, *PHT_SPEC_VER; +} HT_SPEC_VER, *PHT_SPEC_VER; typedef enum _HT_AGGRE_MODE_E { HT_AGG_AUTO = 0, HT_AGG_FORCE_ENABLE = 1, HT_AGG_FORCE_DISABLE = 2, -}HT_AGGRE_MODE_E, *PHT_AGGRE_MODE_E; +} HT_AGGRE_MODE_E, *PHT_AGGRE_MODE_E; /* * The Data structure is used to keep HT related variables when card is diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index c76715ffa08b..7cac668bfb0b 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -28,7 +28,7 @@ static void RxPktPendingTimeout(struct timer_list *t) struct rx_ts_record *pRxTs = from_timer(pRxTs, t, rx_pkt_pending_timer); struct ieee80211_device *ieee = container_of(pRxTs, struct ieee80211_device, RxTsRecord[pRxTs->num]); - PRX_REORDER_ENTRY pReorderEntry = NULL; + struct rx_reorder_entry *pReorderEntry = NULL; //u32 flags = 0; unsigned long flags = 0; @@ -37,18 +37,18 @@ static void RxPktPendingTimeout(struct timer_list *t) spin_lock_irqsave(&(ieee->reorder_spinlock), flags); IEEE80211_DEBUG(IEEE80211_DL_REORDER, "==================>%s()\n", __func__); - if(pRxTs->rx_timeout_indicate_seq != 0xffff) { + if (pRxTs->rx_timeout_indicate_seq != 0xffff) { // Indicate the pending packets sequentially according to SeqNum until meet the gap. - while(!list_empty(&pRxTs->rx_pending_pkt_list)) { - pReorderEntry = (PRX_REORDER_ENTRY)list_entry(pRxTs->rx_pending_pkt_list.prev, RX_REORDER_ENTRY, List); - if(index == 0) + while (!list_empty(&pRxTs->rx_pending_pkt_list)) { + pReorderEntry = list_entry(pRxTs->rx_pending_pkt_list.prev, struct rx_reorder_entry, List); + if (index == 0) pRxTs->rx_indicate_seq = pReorderEntry->SeqNum; - if( SN_LESS(pReorderEntry->SeqNum, pRxTs->rx_indicate_seq) || - SN_EQUAL(pReorderEntry->SeqNum, pRxTs->rx_indicate_seq) ) { + if (SN_LESS(pReorderEntry->SeqNum, pRxTs->rx_indicate_seq) || + SN_EQUAL(pReorderEntry->SeqNum, pRxTs->rx_indicate_seq)) { list_del_init(&pReorderEntry->List); - if(SN_EQUAL(pReorderEntry->SeqNum, pRxTs->rx_indicate_seq)) + if (SN_EQUAL(pReorderEntry->SeqNum, pRxTs->rx_indicate_seq)) pRxTs->rx_indicate_seq = (pRxTs->rx_indicate_seq + 1) % 4096; IEEE80211_DEBUG(IEEE80211_DL_REORDER, "RxPktPendingTimeout(): IndicateSeq: %d\n", pReorderEntry->SeqNum); @@ -63,12 +63,12 @@ static void RxPktPendingTimeout(struct timer_list *t) } } - if(index>0) { + if (index > 0) { // Set rx_timeout_indicate_seq to 0xffff to indicate no pending packets in buffer now. pRxTs->rx_timeout_indicate_seq = 0xffff; // Indicate packets - if(index > REORDER_WIN_SIZE) { + if (index > REORDER_WIN_SIZE) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Rx Reorder buffer full!! \n"); spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); return; @@ -76,7 +76,7 @@ static void RxPktPendingTimeout(struct timer_list *t) ieee80211_indicate_packets(ieee, ieee->stats_IndicateArray, index); } - if(bPktInBuf && (pRxTs->rx_timeout_indicate_seq == 0xffff)) { + if (bPktInBuf && (pRxTs->rx_timeout_indicate_seq == 0xffff)) { pRxTs->rx_timeout_indicate_seq = pRxTs->rx_indicate_seq; mod_timer(&pRxTs->rx_pkt_pending_timer, jiffies + msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime)); @@ -133,7 +133,7 @@ void TSInitialize(struct ieee80211_device *ieee) { struct tx_ts_record *pTxTS = ieee->TxTsRecord; struct rx_ts_record *pRxTS = ieee->RxTsRecord; - PRX_REORDER_ENTRY pRxReorderEntry = ieee->RxReorderEntry; + struct rx_reorder_entry *pRxReorderEntry = ieee->RxReorderEntry; u8 count = 0; IEEE80211_DEBUG(IEEE80211_DL_TS, "==========>%s()\n", __func__); // Initialize Tx TS related info. @@ -141,7 +141,7 @@ void TSInitialize(struct ieee80211_device *ieee) INIT_LIST_HEAD(&ieee->Tx_TS_Pending_List); INIT_LIST_HEAD(&ieee->Tx_TS_Unused_List); - for(count = 0; count < TOTAL_TS_NUM; count++) { + for (count = 0; count < TOTAL_TS_NUM; count++) { // pTxTS->num = count; // The timers for the operation of Traffic Stream and Block Ack. @@ -164,7 +164,7 @@ void TSInitialize(struct ieee80211_device *ieee) INIT_LIST_HEAD(&ieee->Rx_TS_Admit_List); INIT_LIST_HEAD(&ieee->Rx_TS_Pending_List); INIT_LIST_HEAD(&ieee->Rx_TS_Unused_List); - for(count = 0; count < TOTAL_TS_NUM; count++) { + for (count = 0; count < TOTAL_TS_NUM; count++) { pRxTS->num = count; INIT_LIST_HEAD(&pRxTS->rx_pending_pkt_list); timer_setup(&pRxTS->ts_common_info.setup_timer, TsSetupTimeOut, @@ -181,9 +181,9 @@ void TSInitialize(struct ieee80211_device *ieee) // Initialize unused Rx Reorder List. INIT_LIST_HEAD(&ieee->RxReorder_Unused_List); //#ifdef TO_DO_LIST - for(count = 0; count < REORDER_ENTRY_NUM; count++) { - list_add_tail( &pRxReorderEntry->List,&ieee->RxReorder_Unused_List); - if(count == (REORDER_ENTRY_NUM-1)) + for (count = 0; count < REORDER_ENTRY_NUM; count++) { + list_add_tail(&pRxReorderEntry->List, &ieee->RxReorder_Unused_List); + if (count == (REORDER_ENTRY_NUM-1)) break; pRxReorderEntry = &ieee->RxReorderEntry[count+1]; } @@ -196,7 +196,7 @@ static void AdmitTS(struct ieee80211_device *ieee, del_timer_sync(&pTsCommonInfo->setup_timer); del_timer_sync(&pTsCommonInfo->inact_timer); - if(InactTime!=0) + if (InactTime != 0) mod_timer(&pTsCommonInfo->inact_timer, jiffies + msecs_to_jiffies(InactTime)); } @@ -211,54 +211,54 @@ static struct ts_common_info *SearchAdmitTRStream(struct ieee80211_device *ieee, bool search_dir[4] = {0}; struct list_head *psearch_list; //FIXME struct ts_common_info *pRet = NULL; - if(ieee->iw_mode == IW_MODE_MASTER) { //ap mode - if(TxRxSelect == TX_DIR) { + if (ieee->iw_mode == IW_MODE_MASTER) { //ap mode + if (TxRxSelect == TX_DIR) { search_dir[DIR_DOWN] = true; - search_dir[DIR_BI_DIR]= true; + search_dir[DIR_BI_DIR] = true; } else { search_dir[DIR_UP] = true; - search_dir[DIR_BI_DIR]= true; + search_dir[DIR_BI_DIR] = true; } - } else if(ieee->iw_mode == IW_MODE_ADHOC) { - if(TxRxSelect == TX_DIR) + } else if (ieee->iw_mode == IW_MODE_ADHOC) { + if (TxRxSelect == TX_DIR) search_dir[DIR_UP] = true; else search_dir[DIR_DOWN] = true; } else { - if(TxRxSelect == TX_DIR) { + if (TxRxSelect == TX_DIR) { search_dir[DIR_UP] = true; - search_dir[DIR_BI_DIR]= true; - search_dir[DIR_DIRECT]= true; + search_dir[DIR_BI_DIR] = true; + search_dir[DIR_DIRECT] = true; } else { search_dir[DIR_DOWN] = true; - search_dir[DIR_BI_DIR]= true; - search_dir[DIR_DIRECT]= true; + search_dir[DIR_BI_DIR] = true; + search_dir[DIR_DIRECT] = true; } } - if(TxRxSelect == TX_DIR) + if (TxRxSelect == TX_DIR) psearch_list = &ieee->Tx_TS_Admit_List; else psearch_list = &ieee->Rx_TS_Admit_List; //for(dir = DIR_UP; dir <= DIR_BI_DIR; dir++) - for(dir = 0; dir <= DIR_BI_DIR; dir++) { + for (dir = 0; dir <= DIR_BI_DIR; dir++) { if (!search_dir[dir]) continue; - list_for_each_entry(pRet, psearch_list, list){ + list_for_each_entry(pRet, psearch_list, list) { // IEEE80211_DEBUG(IEEE80211_DL_TS, "ADD:%pM, TID:%d, dir:%d\n", pRet->Addr, pRet->TSpec.ts_info.ucTSID, pRet->TSpec.ts_info.ucDirection); if (memcmp(pRet->addr, Addr, 6) == 0) if (pRet->t_spec.ts_info.uc_tsid == TID) - if(pRet->t_spec.ts_info.uc_direction == dir) { + if (pRet->t_spec.ts_info.uc_direction == dir) { // printk("Bingo! got it\n"); break; } } - if(&pRet->list != psearch_list) + if (&pRet->list != psearch_list) break; } - if(&pRet->list != psearch_list) + if (&pRet->list != psearch_list) return pRet ; else return NULL; @@ -270,15 +270,15 @@ static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *Addr, { u8 count; - if(pTsCommonInfo == NULL) + if (pTsCommonInfo == NULL) return; memcpy(pTsCommonInfo->addr, Addr, 6); - if(pTSPEC != NULL) + if (pTSPEC != NULL) memcpy((u8 *)(&(pTsCommonInfo->t_spec)), (u8 *)pTSPEC, sizeof(struct tspec_body)); - for(count = 0; count < TCLAS_Num; count++) + for (count = 0; count < TCLAS_Num; count++) memcpy((u8 *)(&(pTsCommonInfo->t_class[count])), (u8 *)pTCLAS, sizeof(union qos_tclas)); pTsCommonInfo->t_clas_proc = TCLAS_Proc; @@ -342,7 +342,7 @@ bool GetTs( Addr, UP, TxRxSelect); - if(*ppTS != NULL) { + if (*ppTS != NULL) { return true; } else { if (!bAddNewTs) { @@ -357,23 +357,23 @@ bool GetTs( struct tspec_body TSpec; struct qos_tsinfo *pTSInfo = &TSpec.ts_info; struct list_head *pUnusedList = - (TxRxSelect == TX_DIR)? - (&ieee->Tx_TS_Unused_List): + (TxRxSelect == TX_DIR) ? + (&ieee->Tx_TS_Unused_List) : (&ieee->Rx_TS_Unused_List); struct list_head *pAddmitList = - (TxRxSelect == TX_DIR)? - (&ieee->Tx_TS_Admit_List): + (TxRxSelect == TX_DIR) ? + (&ieee->Tx_TS_Admit_List) : (&ieee->Rx_TS_Admit_List); - enum direction_value Dir = (ieee->iw_mode == IW_MODE_MASTER)? - ((TxRxSelect==TX_DIR)?DIR_DOWN:DIR_UP): - ((TxRxSelect==TX_DIR)?DIR_UP:DIR_DOWN); + enum direction_value Dir = (ieee->iw_mode == IW_MODE_MASTER) ? + ((TxRxSelect == TX_DIR)?DIR_DOWN:DIR_UP) : + ((TxRxSelect == TX_DIR)?DIR_UP:DIR_DOWN); IEEE80211_DEBUG(IEEE80211_DL_TS, "to add Ts\n"); - if(!list_empty(pUnusedList)) { + if (!list_empty(pUnusedList)) { (*ppTS) = list_entry(pUnusedList->next, struct ts_common_info, list); list_del_init(&(*ppTS)->list); - if(TxRxSelect==TX_DIR) { + if (TxRxSelect == TX_DIR) { struct tx_ts_record *tmp = container_of(*ppTS, struct tx_ts_record, ts_common_info); ResetTxTsEntry(tmp); } else { @@ -416,17 +416,17 @@ static void RemoveTsEntry(struct ieee80211_device *ieee, struct ts_common_info * del_timer_sync(&pTs->inact_timer); TsInitDelBA(ieee, pTs, TxRxSelect); - if(TxRxSelect == RX_DIR) { + if (TxRxSelect == RX_DIR) { //#ifdef TO_DO_LIST - PRX_REORDER_ENTRY pRxReorderEntry; + struct rx_reorder_entry *pRxReorderEntry; struct rx_ts_record *pRxTS = (struct rx_ts_record *)pTs; - if(timer_pending(&pRxTS->rx_pkt_pending_timer)) + if (timer_pending(&pRxTS->rx_pkt_pending_timer)) del_timer_sync(&pRxTS->rx_pkt_pending_timer); - while(!list_empty(&pRxTS->rx_pending_pkt_list)) { + while (!list_empty(&pRxTS->rx_pending_pkt_list)) { spin_lock_irqsave(&(ieee->reorder_spinlock), flags); //pRxReorderEntry = list_entry(&pRxTS->rx_pending_pkt_list.prev,RX_REORDER_ENTRY,List); - pRxReorderEntry = (PRX_REORDER_ENTRY)list_entry(pRxTS->rx_pending_pkt_list.prev, RX_REORDER_ENTRY, List); + pRxReorderEntry = list_entry(pRxTS->rx_pending_pkt_list.prev, struct rx_reorder_entry, List); list_del_init(&pRxReorderEntry->List); { int i = 0; @@ -435,13 +435,13 @@ static void RemoveTsEntry(struct ieee80211_device *ieee, struct ts_common_info * spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); return; } - for(i =0; i < prxb->nr_subframes; i++) + for (i = 0; i < prxb->nr_subframes; i++) dev_kfree_skb(prxb->subframes[i]); kfree(prxb); prxb = NULL; } - list_add_tail(&pRxReorderEntry->List,&ieee->RxReorder_Unused_List); + list_add_tail(&pRxReorderEntry->List, &ieee->RxReorder_Unused_List); spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); } @@ -522,9 +522,9 @@ void RemoveAllTS(struct ieee80211_device *ieee) void TsStartAddBaProcess(struct ieee80211_device *ieee, struct tx_ts_record *pTxTS) { - if(!pTxTS->add_ba_req_in_progress) { + if (!pTxTS->add_ba_req_in_progress) { pTxTS->add_ba_req_in_progress = true; - if(pTxTS->add_ba_req_delayed) { + if (pTxTS->add_ba_req_delayed) { IEEE80211_DEBUG(IEEE80211_DL_BA, "TsStartAddBaProcess(): Delayed Start ADDBA after 60 sec!!\n"); mod_timer(&pTxTS->ts_add_ba_timer, jiffies + msecs_to_jiffies(TS_ADDBA_DELAY)); diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c index c414efc0662e..de83daa0c9ed 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.c +++ b/drivers/staging/rtl8192u/r8180_93cx6.c @@ -1,10 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * This files contains card eeprom (93c46 or 93c56) programming routines, * memory is addressed by 16 bits words. * * This is part of rtl8180 OpenSource driver. * Copyright (C) Andrea Merello 2004 <andrea.merello@gmail.com> - * Released under the terms of GPL (General Public Licence) * * Parts of this driver are based on the GPL part of the * official realtek driver. @@ -125,21 +125,21 @@ int eprom_read(struct net_device *dev, u32 addr) if (priv->epromtype == EPROM_93c56) { addr_str[7] = addr & 1; - addr_str[6] = addr & (1<<1); - addr_str[5] = addr & (1<<2); - addr_str[4] = addr & (1<<3); - addr_str[3] = addr & (1<<4); - addr_str[2] = addr & (1<<5); - addr_str[1] = addr & (1<<6); - addr_str[0] = addr & (1<<7); + addr_str[6] = addr & BIT(1); + addr_str[5] = addr & BIT(2); + addr_str[4] = addr & BIT(3); + addr_str[3] = addr & BIT(4); + addr_str[2] = addr & BIT(5); + addr_str[1] = addr & BIT(6); + addr_str[0] = addr & BIT(7); addr_len = 8; } else { addr_str[5] = addr & 1; - addr_str[4] = addr & (1<<1); - addr_str[3] = addr & (1<<2); - addr_str[2] = addr & (1<<3); - addr_str[1] = addr & (1<<4); - addr_str[0] = addr & (1<<5); + addr_str[4] = addr & BIT(1); + addr_str[3] = addr & BIT(2); + addr_str[2] = addr & BIT(3); + addr_str[1] = addr & BIT(4); + addr_str[0] = addr & BIT(5); addr_len = 6; } eprom_cs(dev, 1); diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.c b/drivers/staging/rtl8192u/r8190_rtl8256.c index a8c8e8c0660d..92de92a3325a 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.c +++ b/drivers/staging/rtl8192u/r8190_rtl8256.c @@ -1,6 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * This is part of the rtl8192 driver - * released under the GPL (See file COPYING for details). * * This files contains programming code for the rtl8256 * radio frontend. diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index f1eaab337dca..4065a4710142 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1,24 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /****************************************************************************** * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. * Linux device driver for RTL8192U * * Based on the r8187 driver, which is: * Copyright 2004-2005 Andrea Merello <andrea.merello@gmail.com>, et al. - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. * * Contact Information: * Jerry chuang <wlanfae@realtek.com> diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 6c9f9d82477d..2ba01041406b 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -43,20 +43,8 @@ u8 dm_shadow[16][256] = { {0} }; /* For Dynamic Rx Path Selection by Signal Strength */ static struct dynamic_rx_path_sel DM_RxPathSelTable; -/*------------------------Define global variable-----------------------------*/ - - -/*------------------------Define local variable------------------------------*/ -/*------------------------Define local variable------------------------------*/ - - -/*--------------------Define export function prototype-----------------------*/ extern void dm_check_fsync(struct net_device *dev); -/*--------------------Define export function prototype-----------------------*/ - - -/*---------------------Define local function prototype-----------------------*/ /* DM --> Rate Adaptive */ static void dm_check_rate_adaptive(struct net_device *dev); @@ -1454,7 +1442,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", - rCCK0_TxFilter1, TempVal); + rCCK0_TxFilter1, TempVal); /* Write 0xa24 ~ 0xa27 */ TempVal = CCKSwingTable_Ch14[priv->CCK_index][2] + (CCKSwingTable_Ch14[priv->CCK_index][3]<<8) + @@ -1462,14 +1450,14 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH (CCKSwingTable_Ch14[priv->CCK_index][5]<<24); rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", - rCCK0_TxFilter2, TempVal); + rCCK0_TxFilter2, TempVal); /* Write 0xa28 0xa29 */ TempVal = CCKSwingTable_Ch14[priv->CCK_index][6] + (CCKSwingTable_Ch14[priv->CCK_index][7]<<8); rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal); RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n", - rCCK0_DebugPort, TempVal); + rCCK0_DebugPort, TempVal); } } @@ -1520,7 +1508,7 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev) return; /* TODO: Only 11n mode is implemented currently, */ if (!(priv->ieee80211->mode == WIRELESS_MODE_N_24G || - priv->ieee80211->mode == WIRELESS_MODE_N_5G)) + priv->ieee80211->mode == WIRELESS_MODE_N_5G)) return; { @@ -1751,7 +1739,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( /* For smooth, we can not change DIG state. */ if ((priv->undecorated_smoothed_pwdb > dm_digtable.rssi_low_thresh) && - (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_thresh)) + (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_thresh)) return; /*DbgPrint("Dig by Fw False Alarm\n");*/ @@ -1814,7 +1802,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( u8 reset_flag = 0; if (dm_digtable.dig_state == DM_STA_DIG_ON && - (priv->reset_count == reset_cnt)) { + (priv->reset_count == reset_cnt)) { dm_ctrl_initgain_byrssi_highpwr(dev); return; } @@ -1912,7 +1900,7 @@ static void dm_ctrl_initgain_byrssi_highpwr( */ if (priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_power_highthresh) { if (dm_digtable.dig_highpwr_state == DM_STA_DIG_ON && - (priv->reset_count == reset_cnt_highpwr)) + (priv->reset_count == reset_cnt_highpwr)) return; dm_digtable.dig_highpwr_state = DM_STA_DIG_ON; @@ -1928,7 +1916,7 @@ static void dm_ctrl_initgain_byrssi_highpwr( write_nic_byte(dev, rOFDM0_RxDetector1, 0x43); } else { if (dm_digtable.dig_highpwr_state == DM_STA_DIG_OFF && - (priv->reset_count == reset_cnt_highpwr)) + (priv->reset_count == reset_cnt_highpwr)) return; dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF; @@ -2129,7 +2117,7 @@ static void dm_cs_ratio( { if ((dm_digtable.precs_ratio_state != dm_digtable.curcs_ratio_state) || - !initialized || force_write) { + !initialized || force_write) { /*DbgPrint("Write CS_ratio state = %d\n", DM_DigTable.CurCS_ratioState);*/ if (dm_digtable.curcs_ratio_state == DIG_CS_RATIO_LOWER) { /* Lower CS ratio for CCK. */ @@ -2646,7 +2634,7 @@ void dm_fsync_timer_callback(struct timer_list *t) bool bDoubleTimeInterval = false; if (priv->ieee80211->state == IEEE80211_LINKED && - priv->ieee80211->bfsync_enable && + priv->ieee80211->bfsync_enable && (priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_CDD_FSYNC)) { /* Count rate 54, MCS [7], [12, 13, 14, 15] */ u32 rate_bitmap; @@ -2936,17 +2924,17 @@ void dm_shadow_init(struct net_device *dev) for (page = 0; page < 5; page++) for (offset = 0; offset < 256; offset++) { - read_nic_byte(dev, offset+page*256, &dm_shadow[page][offset]); + read_nic_byte(dev, offset + page * 256, &dm_shadow[page][offset]); /*DbgPrint("P-%d/O-%02x=%02x\r\n", page, offset, DM_Shadow[page][offset]);*/ } for (page = 8; page < 11; page++) for (offset = 0; offset < 256; offset++) - read_nic_byte(dev, offset+page*256, &dm_shadow[page][offset]); + read_nic_byte(dev, offset + page * 256, &dm_shadow[page][offset]); for (page = 12; page < 15; page++) for (offset = 0; offset < 256; offset++) - read_nic_byte(dev, offset+page*256, &dm_shadow[page][offset]); + read_nic_byte(dev, offset + page * 256, &dm_shadow[page][offset]); } /* dm_shadow_init */ diff --git a/drivers/staging/rtl8192u/r8192U_hw.h b/drivers/staging/rtl8192u/r8192U_hw.h index 5a958335681d..95a2d2ee3c65 100644 --- a/drivers/staging/rtl8192u/r8192U_hw.h +++ b/drivers/staging/rtl8192u/r8192U_hw.h @@ -1,7 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * This is part of rtl8187 OpenSource driver. * Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> - * Released under the terms of GPL (General Public Licence) * * Parts of this driver are based on the GPL part of the * official Realtek driver. diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index e4e6c979bedf..5822bb7984b9 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -1,10 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /****************************************************************************** * * This file contains wireless extension handlers. * * This is part of rtl8180 OpenSource driver. * Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> - * Released under the terms of GPL (General Public Licence) * * Parts of this driver are based on the GPL part * of the official realtek driver. diff --git a/drivers/staging/rtl8192u/r8192U_wx.h b/drivers/staging/rtl8192u/r8192U_wx.h index a6c2b95e2e69..27423cd64b4c 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.h +++ b/drivers/staging/rtl8192u/r8192U_wx.h @@ -1,7 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * This is part of rtl8180 OpenSource driver - v 0.3 * Copyright (C) Andrea Merello 2004 <andrea.merello@gmail.com> - * Released under the terms of GPL (General Public Licence) * * Parts of this driver are based on the GPL part of the official realtek driver * Parts of this driver are based on the rtl8180 driver skeleton from Patric |