From 64b389c53ce2e4b72f16020b624c0fb2da3a0a9d Mon Sep 17 00:00:00 2001 From: Gavin Thomas Claugus Date: Thu, 10 Dec 2015 21:35:35 -0500 Subject: Staging: rtl8192u: Fix block comment formatting Change block comments to comply with checkpatch style guidelines. Signed-off-by: Gavin Thomas Claugus Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8190_rtl8256.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.c b/drivers/staging/rtl8192u/r8190_rtl8256.c index e00032947e0f..5c3bb3be2720 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.c +++ b/drivers/staging/rtl8192u/r8190_rtl8256.c @@ -1,12 +1,11 @@ /* - 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. - - *Many* thanks to Realtek Corp. for their great support! - +* 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. +* +* *Many* thanks to Realtek Corp. for their great support! */ #include "r8192U.h" @@ -22,7 +21,8 @@ * Output: NONE * Return: NONE * Note: 8226 support both 20M and 40 MHz - *---------------------------------------------------------------------------*/ + *-------------------------------------------------------------------------- + */ void PHY_SetRF8256Bandwidth(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth) { u8 eRFPath; @@ -83,7 +83,8 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth) * Input: struct net_device* dev * Output: NONE * Return: NONE - *---------------------------------------------------------------------------*/ + *-------------------------------------------------------------------------- + */ void PHY_RF8256_Config(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -100,7 +101,8 @@ void PHY_RF8256_Config(struct net_device *dev) * Input: struct net_device* dev * Output: NONE * Return: NONE - *---------------------------------------------------------------------------*/ + *-------------------------------------------------------------------------- + */ void phy_RF8256_Config_ParaFile(struct net_device *dev) { u32 u4RegValue = 0; -- cgit v1.2.3 From 79a5ccd97209264630a8ff4277089746124f130c Mon Sep 17 00:00:00 2001 From: Okash Khawaja Date: Thu, 17 Dec 2015 20:30:38 +0000 Subject: staging: rtl8192u: fix large frame size compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes following compiler warning: drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c: In function ‘RxReorderIndicatePacket’: drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:758:1: warning: the frame size of 1064 bytes is larger than 1024 bytes [-Wframe-larger-than=] It replaces the statically allocated array prxbIndicateArray with a kmalloc'd one. Signed-off-by: Okash Khawaja Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 130c852ffa02..28ad63ac289b 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -594,12 +594,18 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; PRX_REORDER_ENTRY pReorderEntry = NULL; - struct ieee80211_rxb *prxbIndicateArray[REORDER_WIN_SIZE]; + struct ieee80211_rxb **prxbIndicateArray; u8 WinSize = pHTInfo->RxReorderWinSize; u16 WinEnd = (pTS->RxIndicateSeq + WinSize -1)%4096; u8 index = 0; bool bMatchWinStart = false, bPktInBuf = false; IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): Seq is %d,pTS->RxIndicateSeq is %d, WinSize is %d\n",__func__,SeqNum,pTS->RxIndicateSeq,WinSize); + + prxbIndicateArray = kmalloc(sizeof(struct ieee80211_rxb *) * + REORDER_WIN_SIZE, GFP_KERNEL); + if (!prxbIndicateArray) + return; + /* Rx Reorder initialize condition.*/ if (pTS->RxIndicateSeq == 0xffff) { pTS->RxIndicateSeq = SeqNum; @@ -618,6 +624,8 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, kfree(prxb); prxb = NULL; } + + kfree(prxbIndicateArray); return; } @@ -741,6 +749,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, // Indicate packets if(index>REORDER_WIN_SIZE){ IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Rx Reorer buffer full!! \n"); + kfree(prxbIndicateArray); return; } ieee80211_indicate_packets(ieee, prxbIndicateArray, index); @@ -755,6 +764,8 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, pTS->RxPktPendingTimer.expires = jiffies + MSECS(pHTInfo->RxReorderPendingTime); add_timer(&pTS->RxPktPendingTimer); } + + kfree(prxbIndicateArray); } static u8 parse_subframe(struct sk_buff *skb, -- cgit v1.2.3 From a5959f3f12488e8ef732717d2d887f2c03ac81af Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Mon, 28 Dec 2015 23:43:38 +0800 Subject: staging: rtl8192u: use to_delayed_work Use to_delayed_work() instead of open-coding it. Signed-off-by: Geliang Tang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 6 +++--- drivers/staging/rtl8192u/r8192U_core.c | 3 +-- drivers/staging/rtl8192u/r8192U_dm.c | 4 ++-- drivers/staging/rtl8192u/r819xU_phy.c | 3 +-- 4 files changed, 7 insertions(+), 9 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 38c3eb78094e..21ee41034d7a 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -487,7 +487,7 @@ EXPORT_SYMBOL(ieee80211_softmac_scan_syncro); static void ieee80211_softmac_scan_wq(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); static short watchdog; u8 channel_map[MAX_CHANNEL_NUMBER+1]; @@ -2330,7 +2330,7 @@ static void ieee80211_start_monitor_mode(struct ieee80211_device *ieee) static void ieee80211_start_ibss_wq(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq); /* iwconfig mode ad-hoc will schedule this and return * on the other hand this will block further iwconfig SET @@ -2504,7 +2504,7 @@ EXPORT_SYMBOL(ieee80211_disassociate); static void ieee80211_associate_retry_wq(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); unsigned long flags; diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index f4a4eae72aa4..5ac089335aca 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3436,8 +3436,7 @@ static void rtl819x_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum, static void rtl819x_watchdog_wqcallback(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, - struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct r8192_priv *priv = container_of(dwork, struct r8192_priv, watch_dog_wq); struct net_device *dev = priv->ieee80211->dev; diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 375ec96b9469..9b58b1afc1d1 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -767,7 +767,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) void dm_txpower_trackingcallback(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct r8192_priv *priv = container_of(dwork, struct r8192_priv, txpower_tracking_wq); struct net_device *dev = priv->ieee80211->dev; @@ -2412,7 +2412,7 @@ static void dm_check_pbc_gpio(struct net_device *dev) *---------------------------------------------------------------------------*/ void dm_rf_pathcheck_workitemcallback(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct r8192_priv *priv = container_of(dwork, struct r8192_priv, rfpath_check_wq); struct net_device *dev = priv->ieee80211->dev; /*bool bactually_set = false;*/ diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index f264d88364a1..696df3440077 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -1683,8 +1683,7 @@ void InitialGain819xUsb(struct net_device *dev, u8 Operation) void InitialGainOperateWorkItemCallBack(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, - work); + struct delayed_work *dwork = to_delayed_work(work); struct r8192_priv *priv = container_of(dwork, struct r8192_priv, initialgain_operate_wq); struct net_device *dev = priv->ieee80211->dev; -- cgit v1.2.3 From 957f95bfc96dac0bf716f4f4fd2c28929566e487 Mon Sep 17 00:00:00 2001 From: Yannik Schmidt Date: Sat, 2 Jan 2016 16:02:28 +0100 Subject: staging/rtl8192u: fixed typos Fixed all checkpatch-warnings concerning typos in r8192U_core.c. Signed-off-by: Yannik Schmidt Signed-off-by: Lukas Lehnert CC: linux-kernel@i4.cs.fau.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 5ac089335aca..07f4e7a5469a 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1371,7 +1371,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) */ static u8 MapHwQueueToFirmwareQueue(u8 QueueID) { - u8 QueueSelect = 0x0; /* defualt set to */ + u8 QueueSelect = 0x0; /* default set to */ switch (QueueID) { case BE_QUEUE: @@ -4296,7 +4296,7 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, if (is_cck_rate) { /* (1)Hardware does not provide RSSI for CCK */ - /* (2)PWDB, Average PWDB cacluated by hardware + /* (2)PWDB, Average PWDB calculated by hardware * (for rate adaptive) */ u8 report; @@ -4397,7 +4397,7 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, } - /* (2)PWDB, Average PWDB cacluated by hardware + /* (2)PWDB, Average PWDB calculated by hardware * (for rate adaptive) */ rx_pwr_all = (((pofdm_buf->pwdb_all) >> 1) & 0x7f) - 106; -- cgit v1.2.3 From 39ce4e835e1d528c6a7d4159acb7174d07e6bba4 Mon Sep 17 00:00:00 2001 From: Byeoungwook Kim Date: Mon, 1 Feb 2016 14:35:06 +0900 Subject: staging: rtl8192u: Fix block comments use * on subsequent lines in r8192U_wx.c clean up checkpatch warning: WARNING: Block comments use * on subsequent lines Signed-off-by: Byeoungwook Kim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_wx.c | 38 +++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 4911fef2e2e5..f828e6441f2d 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -1,21 +1,23 @@ -/* - This file contains wireless extension handlers. - - This is part of rtl8180 OpenSource driver. - Copyright (C) Andrea Merello 2004-2005 - 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 Schenke & Andres Salomon. - - Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. - - We want to thank the Authors of those projects and the Ndiswrapper - project Authors. -*/ +/****************************************************************************** + * + * This file contains wireless extension handlers. + * + * This is part of rtl8180 OpenSource driver. + * Copyright (C) Andrea Merello 2004-2005 + * 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 Schenke & Andres Salomon. + * + * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. + * + * We want to thank the Authors of those projects and the Ndiswrapper + * project Authors. + * + *****************************************************************************/ #include #include "r8192U.h" -- cgit v1.2.3 From d0aaa57df2d8f5d355c64935dcff58cd4ab9fe2f Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Mon, 4 Jan 2016 20:30:58 -0600 Subject: staging: r8192U: Fix check pointer after usage problem In routine rtl8192_tx_isr(), pointer skb is dereferenced before it is checked for NULL. This patch has only been compile-tested, as I do not have the hardware. This problem was reported at https://bugzilla.kernel.org/show_bug.cgi?id=109951. Fixes: bugzilla.kernel.org: #109951 Reported-by: Yong Shi Signed-off-by: Larry Finger Cc: Yong Shi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 07f4e7a5469a..3c589636139a 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1092,10 +1092,17 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) static void rtl8192_tx_isr(struct urb *tx_urb) { struct sk_buff *skb = (struct sk_buff *)tx_urb->context; - struct net_device *dev = (struct net_device *)(skb->cb); + struct net_device *dev; struct r8192_priv *priv = NULL; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - u8 queue_index = tcb_desc->queue_index; + cb_desc *tcb_desc; + u8 queue_index; + + if (!skb) + return; + + dev = (struct net_device *)(skb->cb); + tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + queue_index = tcb_desc->queue_index; priv = ieee80211_priv(dev); @@ -1113,11 +1120,9 @@ static void rtl8192_tx_isr(struct urb *tx_urb) } /* free skb and tx_urb */ - if (skb != NULL) { - dev_kfree_skb_any(skb); - usb_free_urb(tx_urb); - atomic_dec(&priv->tx_pending[queue_index]); - } + dev_kfree_skb_any(skb); + usb_free_urb(tx_urb); + atomic_dec(&priv->tx_pending[queue_index]); /* * Handle HW Beacon: -- cgit v1.2.3 From f3b8a53c6d0145eae7f5e9b452a9f6f3d03e17cc Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 13 Feb 2016 10:03:47 +0530 Subject: staging: rtl8192u: ieee80211: rtl819x_TSProc: Replace MSECS with msecs_to_jiffies Replace driver specific macro MSECS with msecs_to_jiffies(). This was found using the following Coccinelle semantic patch: // @@ expression e; @@ - MSECS(e) + msecs_to_jiffies(e) // Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index f33c74342cf3..36a165eab3b7 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -87,7 +87,8 @@ static void RxPktPendingTimeout(unsigned long data) if(bPktInBuf && (pRxTs->RxTimeoutIndicateSeq==0xffff)) { pRxTs->RxTimeoutIndicateSeq = pRxTs->RxIndicateSeq; - mod_timer(&pRxTs->RxPktPendingTimer, jiffies + MSECS(ieee->pHTInfo->RxReorderPendingTime)); + mod_timer(&pRxTs->RxPktPendingTimer, + jiffies + msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime)); } spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); @@ -212,7 +213,8 @@ static void AdmitTS(struct ieee80211_device *ieee, del_timer_sync(&pTsCommonInfo->InactTimer); if(InactTime!=0) - mod_timer(&pTsCommonInfo->InactTimer, jiffies + MSECS(InactTime)); + mod_timer(&pTsCommonInfo->InactTimer, + jiffies + msecs_to_jiffies(InactTime)); } @@ -590,7 +592,8 @@ void TsStartAddBaProcess(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTS) if(pTxTS->bAddBaReqDelayed) { IEEE80211_DEBUG(IEEE80211_DL_BA, "TsStartAddBaProcess(): Delayed Start ADDBA after 60 sec!!\n"); - mod_timer(&pTxTS->TsAddBaTimer, jiffies + MSECS(TS_ADDBA_DELAY)); + mod_timer(&pTxTS->TsAddBaTimer, + jiffies + msecs_to_jiffies(TS_ADDBA_DELAY)); } else { -- cgit v1.2.3 From 69bf7ecea2f441aeed71b496d92e31c6a86d9504 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 13 Feb 2016 10:03:54 +0530 Subject: staging: rtl8192u: ieee80211: rtl819x_BAProc: Replace MSECS with msecs_to_jiffies Replace driver specific macro MSECS with msecs_to_jiffies(). This was found using the following Coccinelle semantic patch: // @@ expression e; @@ - MSECS(e) + msecs_to_jiffies(e) // Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index 3bde744604c2..789b7c95b86e 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -19,7 +19,7 @@ static void ActivateBAEntry(struct ieee80211_device *ieee, PBA_RECORD pBA, u16 T { pBA->bValid = true; if(Time != 0) - mod_timer(&pBA->Timer, jiffies + MSECS(Time)); + mod_timer(&pBA->Timer, jiffies + msecs_to_jiffies(Time)); } /******************************************************************************************************************** -- cgit v1.2.3 From 4763a75289926cce327f7c25b4f757d29377d127 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 13 Feb 2016 10:04:04 +0530 Subject: staging: rtl8192u: ieee80211: ieee80211_softmac: Replace MSECS with msecs_to_jiffies Replace driver specific macro MSECS with msecs_to_jiffies(). This was found using the following Coccinelle semantic patch: // @@ expression e; @@ - MSECS(e) + msecs_to_jiffies(e) // Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 21ee41034d7a..6d85648c6d7c 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -380,7 +380,8 @@ static void ieee80211_send_beacon(struct ieee80211_device *ieee) if (ieee->beacon_txing && ieee->ieee_up) { // if(!timer_pending(&ieee->beacon_timer)) // add_timer(&ieee->beacon_timer); - mod_timer(&ieee->beacon_timer,jiffies+(MSECS(ieee->current_network.beacon_interval-5))); + mod_timer(&ieee->beacon_timer, + jiffies + msecs_to_jiffies(ieee->current_network.beacon_interval-5)); } //spin_unlock_irqrestore(&ieee->beacon_lock,flags); } @@ -1735,10 +1736,12 @@ static short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps)) return 2; - if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout))) + if(!time_after(jiffies, + ieee->dev->trans_start + msecs_to_jiffies(timeout))) return 0; - if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout))) + if(!time_after(jiffies, + ieee->last_rx_ps_time + msecs_to_jiffies(timeout))) return 0; if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) && -- cgit v1.2.3 From b1d96609031782a219efd0b441e196b7bfc5ed05 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 13 Feb 2016 10:04:10 +0530 Subject: staging: rtl8192u: ieee80211: ieee80211_rx: Replace MSECS with msecs_to_jiffies Replace driver specific macro MSECS with msecs_to_jiffies(). This was found using the following Coccinelle semantic patch: // @@ expression e; @@ - MSECS(e) + msecs_to_jiffies(e) // Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 28ad63ac289b..9dfde0794b80 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -761,7 +761,8 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, pTS->RxTimeoutIndicateSeq = pTS->RxIndicateSeq; if(timer_pending(&pTS->RxPktPendingTimer)) del_timer_sync(&pTS->RxPktPendingTimer); - pTS->RxPktPendingTimer.expires = jiffies + MSECS(pHTInfo->RxReorderPendingTime); + pTS->RxPktPendingTimer.expires = jiffies + + msecs_to_jiffies(pHTInfo->RxReorderPendingTime); add_timer(&pTS->RxPktPendingTimer); } -- cgit v1.2.3 From e6be66fff720f85402be6c22ec57db154bf7df76 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 13 Feb 2016 10:04:16 +0530 Subject: staging: rtl8192u: r8192U_dm: Replace MSECS with msecs_to_jiffies Replace driver specific macro MSECS with msecs_to_jiffies(). This was found using the following Coccinelle semantic patch: // @@ expression e; @@ - MSECS(e) + msecs_to_jiffies(e) // Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_dm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 9b58b1afc1d1..d2e86b9d2c97 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -2769,12 +2769,14 @@ void dm_fsync_timer_callback(unsigned long data) if (bDoubleTimeInterval) { if (timer_pending(&priv->fsync_timer)) del_timer_sync(&priv->fsync_timer); - priv->fsync_timer.expires = jiffies + MSECS(priv->ieee80211->fsync_time_interval*priv->ieee80211->fsync_multiple_timeinterval); + priv->fsync_timer.expires = jiffies + + msecs_to_jiffies(priv->ieee80211->fsync_time_interval*priv->ieee80211->fsync_multiple_timeinterval); add_timer(&priv->fsync_timer); } else { if (timer_pending(&priv->fsync_timer)) del_timer_sync(&priv->fsync_timer); - priv->fsync_timer.expires = jiffies + MSECS(priv->ieee80211->fsync_time_interval); + priv->fsync_timer.expires = jiffies + + msecs_to_jiffies(priv->ieee80211->fsync_time_interval); add_timer(&priv->fsync_timer); } } else { @@ -2847,7 +2849,8 @@ static void dm_StartSWFsync(struct net_device *dev) } if (timer_pending(&priv->fsync_timer)) del_timer_sync(&priv->fsync_timer); - priv->fsync_timer.expires = jiffies + MSECS(priv->ieee80211->fsync_time_interval); + priv->fsync_timer.expires = jiffies + + msecs_to_jiffies(priv->ieee80211->fsync_time_interval); add_timer(&priv->fsync_timer); write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cd); -- cgit v1.2.3 From 4ebeaf513310618fcc1648bbbb89b06b5ab75bee Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 13 Feb 2016 10:04:23 +0530 Subject: staging: rtl8192u: ieee80211: Remove MSECS macro Remove driver specific macro MSECS since all instances of this macro have been replaced by direct calls to msecs_to_jiffies(). Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 967ef9a98fc0..c0a0897bc2cd 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -329,7 +329,6 @@ typedef struct ieee_param { // linux under 2.6.9 release may not support it, so modify it for common use -#define MSECS(t) msecs_to_jiffies(t) #define msleep_interruptible_rsl msleep_interruptible #define IEEE80211_DATA_LEN 2304 -- cgit v1.2.3 From 3a341db3dbba968baa449f85cc3efeaaf2969ade Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 13 Feb 2016 12:31:33 +0530 Subject: staging: rtl8192u: ieee80211: ieee80211_softmac: Replace driver specific macro msleep_interruptible_rsl Replace driver specific msleep_interruptible_rsl macro with direct call to msleep_interruptible. Signed-off-by: Amitoj Kaur Chawla Reviewed-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 6d85648c6d7c..c1995f2f0918 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -469,7 +469,7 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee) if (ieee->state >= IEEE80211_LINKED && ieee->sync_scan_hurryup) goto out; - msleep_interruptible_rsl(IEEE80211_SOFTMAC_SCAN_TIME); + msleep_interruptible(IEEE80211_SOFTMAC_SCAN_TIME); } out: -- cgit v1.2.3 From e4d31fbad2752ce923ee79a05ef1789acb568627 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 13 Feb 2016 12:34:14 +0530 Subject: staging: rtl8192u: ieee80211: Remove msleep_interruptible_rsl Macro Remove driver specific macro msleep_interruptible_rsl as it has been replaced by a direct call to msleep_interruptible in the single instance referencing it. Signed-off-by: Amitoj Kaur Chawla Reviewed-by: Vaishali Thakkar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index c0a0897bc2cd..ae1c104ac9f3 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -329,8 +329,6 @@ typedef struct ieee_param { // linux under 2.6.9 release may not support it, so modify it for common use -#define msleep_interruptible_rsl msleep_interruptible - #define IEEE80211_DATA_LEN 2304 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 6.2.1.1.2. -- cgit v1.2.3 From 04bdfd20e08f9a10f6155d181a7e2e1a0d8ca24c Mon Sep 17 00:00:00 2001 From: Janani Ravichandran Date: Sat, 13 Feb 2016 15:58:52 -0500 Subject: staging: rtl8192u: ieee80211: Fix comment style This patch changes some C99-style "//..." comments to C89 "/* ... */" style. Signed-off-by: Janani Ravichandran Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index c1995f2f0918..9bc5aac0ac81 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -103,12 +103,12 @@ static void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) { u8 *tag = *tag_p; - *tag++ = MFIE_TYPE_GENERIC; //0 + *tag++ = MFIE_TYPE_GENERIC; /* 0 */ *tag++ = 7; *tag++ = 0x00; *tag++ = 0x50; *tag++ = 0xf2; - *tag++ = 0x02;//5 + *tag++ = 0x02; /* 5 */ *tag++ = 0x00; *tag++ = 0x01; #ifdef SUPPORT_USPD @@ -128,12 +128,12 @@ static void ieee80211_TURBO_Info(struct ieee80211_device *ieee, u8 **tag_p) { u8 *tag = *tag_p; - *tag++ = MFIE_TYPE_GENERIC; //0 + *tag++ = MFIE_TYPE_GENERIC; /* 0 */ *tag++ = 7; *tag++ = 0x00; *tag++ = 0xe0; *tag++ = 0x4c; - *tag++ = 0x01;//5 + *tag++ = 0x01; /* 5 */ *tag++ = 0x02; *tag++ = 0x11; *tag++ = 0x00; @@ -186,14 +186,14 @@ static u8 MgntQuery_MgntFrameTxRate(struct ieee80211_device *ieee) PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; u8 rate; - // 2008/01/25 MH For broadcom, MGNT frame set as OFDM 6M. + /* 2008/01/25 MH For broadcom, MGNT frame set as OFDM 6M. */ if(pHTInfo->IOTAction & HT_IOT_ACT_MGNT_USE_CCK_6M) rate = 0x0c; else rate = ieee->basic_rate & 0x7f; if (rate == 0) { - // 2005.01.26, by rcnjko. + /* 2005.01.26, by rcnjko. */ if(ieee->mode == IEEE_A|| ieee->mode== IEEE_N_5G|| (ieee->mode== IEEE_N_24G&&!pHTInfo->bCurSuppCCK)) @@ -340,7 +340,7 @@ inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee) req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request)); req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); - req->header.duration_id = 0; //FIXME: is this OK ? + req->header.duration_id = 0; /* FIXME: is this OK? */ memset(req->header.addr1, 0xff, ETH_ALEN); memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN); @@ -673,7 +673,7 @@ inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be else if(ieee->auth_mode == 1) auth->algorithm = cpu_to_le16(WLAN_AUTH_SHARED_KEY); else if(ieee->auth_mode == 2) - auth->algorithm = WLAN_AUTH_OPEN;//0x80; + auth->algorithm = WLAN_AUTH_OPEN; /* 0x80; */ printk("=================>%s():auth->algorithm is %d\n",__func__,auth->algorithm); auth->transaction = cpu_to_le16(ieee->associate_seq); ieee->associate_seq++; @@ -728,7 +728,7 @@ static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d encrypt = ieee->host_encrypt && crypt && crypt->ops && ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len)); - //HT ralated element + /* HT ralated element */ tmp_ht_cap_buf =(u8 *) &(ieee->pHTInfo->SelfHTCap); tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap); tmp_ht_info_buf =(u8 *) &(ieee->pHTInfo->SelfHTInfo); @@ -766,13 +766,13 @@ static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN); memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN); - beacon_buf->header.duration_id = 0; //FIXME + beacon_buf->header.duration_id = 0; /* FIXME */ beacon_buf->beacon_interval = cpu_to_le16(ieee->current_network.beacon_interval); beacon_buf->capability = cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS); beacon_buf->capability |= - cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE); //add short preamble here + cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE); /* add short preamble here */ if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT)) beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); @@ -1013,7 +1013,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco crypt = ieee->crypt[ieee->tx_keyidx]; encrypt = ieee->host_encrypt && crypt && crypt->ops && ((0 == strcmp(crypt->ops->name,"WEP") || wpa_ie_len)); - //Include High Throuput capability && Realtek proprietary + /* Include High Throuput capability && Realtek proprietary */ if (ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT) { ht_cap_buf = (u8 *)&(ieee->pHTInfo->SelfHTCap); @@ -1045,8 +1045,8 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco #ifdef THOMAS_TURBO len = sizeof(struct ieee80211_assoc_request_frame)+ 2 - + beacon->ssid_len//essid tagged val - + rate_len//rates tagged val + + beacon->ssid_len /* essid tagged val */ + + rate_len /* rates tagged val */ + wpa_ie_len + wmm_info_len + turbo_info_len @@ -1058,8 +1058,8 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco + ieee->tx_headroom; #else len = sizeof(struct ieee80211_assoc_request_frame)+ 2 - + beacon->ssid_len//essid tagged val - + rate_len//rates tagged val + + beacon->ssid_len /* essid tagged val */ + + rate_len /* rates tagged val */ + wpa_ie_len + wmm_info_len + ht_cap_len -- cgit v1.2.3 From c8279611f3fcabdb05e6fe87fe393ccfc2e3d8bc Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sun, 14 Feb 2016 10:59:50 +0530 Subject: Staging: rtl8192u: Remove useless comments Remove the commented out places where macros PlatformAcquireSpinLock and PlatformReleaseSpinLock are called as these macros are no longer used. Signed-off-by: Bhumika Goyal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index 36a165eab3b7..148d0d45547b 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -35,9 +35,7 @@ static void RxPktPendingTimeout(unsigned long data) u8 index = 0; bool bPktInBuf = false; - spin_lock_irqsave(&(ieee->reorder_spinlock), flags); - //PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK); IEEE80211_DEBUG(IEEE80211_DL_REORDER,"==================>%s()\n",__func__); if(pRxTs->RxTimeoutIndicateSeq != 0xffff) { @@ -91,7 +89,6 @@ static void RxPktPendingTimeout(unsigned long data) jiffies + msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime)); } spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); - //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); } /******************************************************************************************************************** @@ -471,7 +468,6 @@ static void RemoveTsEntry(struct ieee80211_device *ieee, PTS_COMMON_INFO pTs, while(!list_empty(&pRxTS->RxPendingPktList)) { - // PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK); spin_lock_irqsave(&(ieee->reorder_spinlock), flags); //pRxReorderEntry = list_entry(&pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); pRxReorderEntry = (PRX_REORDER_ENTRY)list_entry(pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); @@ -491,7 +487,6 @@ static void RemoveTsEntry(struct ieee80211_device *ieee, PTS_COMMON_INFO pTs, prxb = NULL; } list_add_tail(&pRxReorderEntry->List,&ieee->RxReorder_Unused_List); - //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); } -- cgit v1.2.3 From 8cce78a73ff34ea4a5e0af03c929dc3f89781981 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 13 Feb 2016 16:42:32 +0530 Subject: Staging: rtl819u: ieee80211: Remove function ieee80211_wep_null Remove function ieee80211_wep_null from the file as is it blank and remove its declaration from the header file. Also remove its function call as it is of no use calling this function. Signed-off-by: Bhumika Goyal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 3 --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 3 --- drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 1 - 3 files changed, 7 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index ae1c104ac9f3..68931e5ecd8f 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -238,8 +238,6 @@ typedef struct cb_desc { #define ieee80211_tkip_null ieee80211_tkip_null_rsl -#define ieee80211_wep_null ieee80211_wep_null_rsl - #define free_ieee80211 free_ieee80211_rsl #define alloc_ieee80211 alloc_ieee80211_rsl @@ -2257,7 +2255,6 @@ void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee); /* ieee80211_crypt_ccmp&tkip&wep.c */ void ieee80211_tkip_null(void); -void ieee80211_wep_null(void); void ieee80211_ccmp_null(void); int ieee80211_crypto_init(void); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index 681611dc93d3..cde8e2b958cb 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -274,6 +274,3 @@ void __exit ieee80211_crypto_wep_exit(void) ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); } -void ieee80211_wep_null(void) -{ -} diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index 425b2ddfc916..30fff6c5696b 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -177,7 +177,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv) /* These function were added to load crypte module autoly */ ieee80211_tkip_null(); - ieee80211_wep_null(); ieee80211_ccmp_null(); return dev; -- cgit v1.2.3 From f59140964b1a1d71dec8b1e6f8dfc68afc2b4aec Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Tue, 16 Feb 2016 15:26:05 +0530 Subject: Staging: rtl8192u: Convert long if-else block to switch-case Replace long if-else block with switch-case to make it more readable and compact. Signed-off-by: Bhumika Goyal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_dm.c | 52 +++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 12 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index d2e86b9d2c97..1e0e53c9c314 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -1628,47 +1628,75 @@ static void dm_bb_initialgain_backup(struct net_device *dev) void dm_change_dynamic_initgain_thresh(struct net_device *dev, u32 dm_type, u32 dm_value) { - if (dm_type == DIG_TYPE_THRESH_HIGH) { + switch (dm_type) { + case DIG_TYPE_THRESH_HIGH: dm_digtable.rssi_high_thresh = dm_value; - } else if (dm_type == DIG_TYPE_THRESH_LOW) { + break; + + case DIG_TYPE_THRESH_LOW: dm_digtable.rssi_low_thresh = dm_value; - } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH) { + break; + + case DIG_TYPE_THRESH_HIGHPWR_HIGH: dm_digtable.rssi_high_power_highthresh = dm_value; - } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_LOW) { + break; + + case DIG_TYPE_THRESH_HIGHPWR_LOW: dm_digtable.rssi_high_power_lowthresh = dm_value; - } else if (dm_type == DIG_TYPE_ENABLE) { + break; + + case DIG_TYPE_ENABLE: dm_digtable.dig_state = DM_STA_DIG_MAX; dm_digtable.dig_enable_flag = true; - } else if (dm_type == DIG_TYPE_DISABLE) { + break; + + case DIG_TYPE_DISABLE: dm_digtable.dig_state = DM_STA_DIG_MAX; dm_digtable.dig_enable_flag = false; - } else if (dm_type == DIG_TYPE_DBG_MODE) { + break; + + case DIG_TYPE_DBG_MODE: if (dm_value >= DM_DBG_MAX) dm_value = DM_DBG_OFF; dm_digtable.dbg_mode = (u8)dm_value; - } else if (dm_type == DIG_TYPE_RSSI) { + break; + + case DIG_TYPE_RSSI: if (dm_value > 100) dm_value = 30; dm_digtable.rssi_val = (long)dm_value; - } else if (dm_type == DIG_TYPE_ALGORITHM) { + break; + + case DIG_TYPE_ALGORITHM: if (dm_value >= DIG_ALGO_MAX) dm_value = DIG_ALGO_BY_FALSE_ALARM; if (dm_digtable.dig_algorithm != (u8)dm_value) dm_digtable.dig_algorithm_switch = 1; dm_digtable.dig_algorithm = (u8)dm_value; - } else if (dm_type == DIG_TYPE_BACKOFF) { + break; + + case DIG_TYPE_BACKOFF: if (dm_value > 30) dm_value = 30; dm_digtable.backoff_val = (u8)dm_value; - } else if (dm_type == DIG_TYPE_RX_GAIN_MIN) { + break; + + case DIG_TYPE_RX_GAIN_MIN: if (dm_value == 0) dm_value = 0x1; dm_digtable.rx_gain_range_min = (u8)dm_value; - } else if (dm_type == DIG_TYPE_RX_GAIN_MAX) { + break; + + case DIG_TYPE_RX_GAIN_MAX: if (dm_value > 0x50) dm_value = 0x50; dm_digtable.rx_gain_range_max = (u8)dm_value; + break; + + default: + break; } + } /* DM_ChangeDynamicInitGainThresh */ /*----------------------------------------------------------------------------- -- cgit v1.2.3 From 1761a85c3bed33591af9a4c2bfac1705c793143f Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Sat, 20 Feb 2016 16:49:50 +0530 Subject: staging: rtl8192u: Remove create_workqueue() With cmwq, use of dedicated workqueues can be replaced by system_wq. Removed the dedicated workqueue and used system_wq instead. Since the work items in the workqueues do not need to be ordered, increase of concurrency by switching to system_wq should not break anything. All work items are sync canceled so it is guaranteed that no work is running when driver is detached. Signed-off-by: Bhaktipriya Shridhar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 18 ++++++++---------- drivers/staging/rtl8192u/r8192U_core.c | 13 +++++-------- 2 files changed, 13 insertions(+), 18 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 9bc5aac0ac81..f8041f9d61c8 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -515,7 +515,7 @@ static void ieee80211_softmac_scan_wq(struct work_struct *work) ieee80211_send_probe_requests(ieee); - queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME); + schedule_delayed_work(&ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME); up(&ieee->scan_sem); return; @@ -614,7 +614,7 @@ static void ieee80211_start_scan(struct ieee80211_device *ieee) if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){ if (ieee->scanning == 0) { ieee->scanning = 1; - queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0); + schedule_delayed_work(&ieee->softmac_scan_wq, 0); } }else ieee->start_scan(ieee->dev); @@ -1241,7 +1241,7 @@ void ieee80211_associate_abort(struct ieee80211_device *ieee) ieee->state = IEEE80211_ASSOCIATING_RETRY; - queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, \ + schedule_delayed_work(&ieee->associate_retry_wq, \ IEEE80211_SOFTMAC_ASSOC_RETRY_TIME); spin_unlock_irqrestore(&ieee->lock, flags); @@ -1382,7 +1382,7 @@ static void ieee80211_associate_complete(struct ieee80211_device *ieee) ieee->state = IEEE80211_LINKED; //ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet); - queue_work(ieee->wq, &ieee->associate_complete_wq); + schedule_work(&ieee->associate_complete_wq); } static void ieee80211_associate_procedure_wq(struct work_struct *work) @@ -1483,7 +1483,7 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee } ieee->state = IEEE80211_ASSOCIATING; - queue_work(ieee->wq, &ieee->associate_procedure_wq); + schedule_work(&ieee->associate_procedure_wq); }else{ if(ieee80211_is_54g(&ieee->current_network) && (ieee->modulation & IEEE80211_OFDM_MODULATION)){ @@ -2044,7 +2044,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, "Association response status code 0x%x\n", errcode); if(ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) { - queue_work(ieee->wq, &ieee->associate_procedure_wq); + schedule_work(&ieee->associate_procedure_wq); } else { ieee80211_associate_abort(ieee); } @@ -2100,7 +2100,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, notify_wx_assoc_event(ieee); //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); RemovePeerTS(ieee, header->addr2); - queue_work(ieee->wq, &ieee->associate_procedure_wq); + schedule_work(&ieee->associate_procedure_wq); } break; case IEEE80211_STYPE_MANAGE_ACT: @@ -2442,7 +2442,7 @@ static void ieee80211_start_ibss_wq(struct work_struct *work) inline void ieee80211_start_ibss(struct ieee80211_device *ieee) { - queue_delayed_work(ieee->wq, &ieee->start_ibss_wq, 150); + schedule_delayed_work(&ieee->start_ibss_wq, 150); } /* this is called only in user context, with wx_sem held */ @@ -2725,7 +2725,6 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee) setup_timer(&ieee->beacon_timer, ieee80211_send_beacon_cb, (unsigned long)ieee); - ieee->wq = create_workqueue(DRV_NAME); INIT_DELAYED_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq); INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq); @@ -2755,7 +2754,6 @@ void ieee80211_softmac_free(struct ieee80211_device *ieee) del_timer_sync(&ieee->associate_timer); cancel_delayed_work(&ieee->associate_retry_wq); - destroy_workqueue(ieee->wq); up(&ieee->wx_sem); } diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 3c589636139a..3a93218f320b 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1962,7 +1962,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, network->qos_data.param_count)) { network->qos_data.old_param_count = network->qos_data.param_count; - queue_work(priv->priv_wq, &priv->qos_activate); + schedule_work(&priv->qos_activate); RT_TRACE(COMP_QOS, "QoS parameters change call qos_activate\n"); } @@ -1971,7 +1971,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, &def_qos_parameters, size); if ((network->qos_data.active == 1) && (active_network == 1)) { - queue_work(priv->priv_wq, &priv->qos_activate); + schedule_work(&priv->qos_activate); RT_TRACE(COMP_QOS, "QoS was disabled call qos_activate\n"); } @@ -1990,7 +1990,7 @@ static int rtl8192_handle_beacon(struct net_device *dev, struct r8192_priv *priv = ieee80211_priv(dev); rtl8192_qos_handle_probe_response(priv, 1, network); - queue_delayed_work(priv->priv_wq, &priv->update_beacon_wq, 0); + schedule_delayed_work(&priv->update_beacon_wq, 0); return 0; } @@ -2042,7 +2042,7 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv, network->flags, priv->ieee80211->current_network.qos_data.active); if (set_qos_param == 1) - queue_work(priv->priv_wq, &priv->qos_activate); + schedule_work(&priv->qos_activate); return 0; @@ -2387,7 +2387,6 @@ static void rtl8192_init_priv_task(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - priv->priv_wq = create_workqueue(DRV_NAME); INIT_WORK(&priv->reset_wq, rtl8192_restart); @@ -3518,7 +3517,7 @@ static void watch_dog_timer_callback(unsigned long data) { struct r8192_priv *priv = ieee80211_priv((struct net_device *)data); - queue_delayed_work(priv->priv_wq, &priv->watch_dog_wq, 0); + schedule_delayed_work(&priv->watch_dog_wq, 0); mod_timer(&priv->watch_dog_timer, jiffies + msecs_to_jiffies(IEEE80211_WATCH_DOG_TIME)); } @@ -5022,7 +5021,6 @@ fail2: kfree(priv->pFirmware); priv->pFirmware = NULL; rtl8192_usb_deleteendpoints(dev); - destroy_workqueue(priv->priv_wq); mdelay(10); fail: free_ieee80211(dev); @@ -5060,7 +5058,6 @@ static void rtl8192_usb_disconnect(struct usb_interface *intf) kfree(priv->pFirmware); priv->pFirmware = NULL; rtl8192_usb_deleteendpoints(dev); - destroy_workqueue(priv->priv_wq); mdelay(10); } free_ieee80211(dev); -- cgit v1.2.3 From b1b20e7155de612f065dbc0cda53186605fa944c Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Sun, 21 Feb 2016 15:43:00 +0530 Subject: staging: rtl8192u: ieee80211: Use macro DIV_ROUND_UP The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)). It clarifies the divisor calculations. This was done using the coccinelle script: @@ expression e1; expression e2; @@ ( - ((e1) + e2 - 1) / (e2) + DIV_ROUND_UP(e1,e2) | - ((e1) + (e2 - 1)) / (e2) + DIV_ROUND_UP(e1,e2) ) Signed-off-by: Bhaktipriya Shridhar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index 27ce4817faeb..2dc25cc2c726 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -242,7 +242,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); - blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; + blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN); last = data_len % AES_BLOCK_LEN; for (i = 1; i <= blocks; i++) { @@ -331,7 +331,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b); xor_block(mic, b, CCMP_MIC_LEN); - blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; + blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN); last = data_len % AES_BLOCK_LEN; for (i = 1; i <= blocks; i++) { -- cgit v1.2.3 From f705a2dddd206b31ff7731b3adc69a2433ca6d00 Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Wed, 24 Feb 2016 02:57:57 +0530 Subject: staging: rtl8192u: ieee802111: Drop Useless Initialization Removed initialisation of a varible if it is immediately reassigned. Changes were made using Coccinelle. @bad@ identifier i; position p; @@ i =@p <+...i...+>; @@ type T; constant C; expression e; identifier i; position p != bad.p; @@ T i - = C ; i =@p e; Signed-off-by: Bhaktipriya Shridhar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index 789b7c95b86e..28737ec65186 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -254,7 +254,7 @@ static struct sk_buff *ieee80211_DELBA( static void ieee80211_send_ADDBAReq(struct ieee80211_device *ieee, u8 *dst, PBA_RECORD pBA) { - struct sk_buff *skb = NULL; + struct sk_buff *skb; skb = ieee80211_ADDBA(ieee, dst, pBA, 0, ACT_ADDBAREQ); //construct ACT_ADDBAREQ frames so set statuscode zero. if (skb) @@ -282,7 +282,7 @@ static void ieee80211_send_ADDBAReq(struct ieee80211_device *ieee, static void ieee80211_send_ADDBARsp(struct ieee80211_device *ieee, u8 *dst, PBA_RECORD pBA, u16 StatusCode) { - struct sk_buff *skb = NULL; + struct sk_buff *skb; skb = ieee80211_ADDBA(ieee, dst, pBA, StatusCode, ACT_ADDBARSP); //construct ACT_ADDBARSP frames if (skb) { @@ -311,7 +311,7 @@ static void ieee80211_send_DELBA(struct ieee80211_device *ieee, u8 *dst, PBA_RECORD pBA, TR_SELECT TxRxSelect, u16 ReasonCode) { - struct sk_buff *skb = NULL; + struct sk_buff *skb; skb = ieee80211_DELBA(ieee, dst, pBA, TxRxSelect, ReasonCode); //construct ACT_ADDBARSP frames if (skb) { -- cgit v1.2.3 From 61645cc3124ef012d4e8ca576aa13adf16c17393 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Wed, 24 Feb 2016 15:47:35 +0530 Subject: Staging: rtl8192u: Clean up tests if NULL returned on failure Some functions return Null as their return value on failure. !x is generally preferred over x==NULL or NULL==x. So make use of !x if the value returned on failure is NULL. Done using coccinelle: @@ expression e; statement S; @@ e = \(kmalloc\|devm_kzalloc\|kmalloc_array \|devm_ioremap\|usb_alloc_urb\|alloc_netdev\)(...); - if(e==NULL) + if(!e) S Signed-off-by: Bhumika Goyal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 9dfde0794b80..879c41367e7a 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -1289,7 +1289,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, payload = skb->data + hdrlen; //ethertype = (payload[6] << 8) | payload[7]; rxb = kmalloc(sizeof(struct ieee80211_rxb), GFP_ATOMIC); - if (rxb == NULL) + if (!rxb) { IEEE80211_DEBUG(IEEE80211_DL_ERR,"%s(): kmalloc rxb error\n",__func__); goto rx_dropped; diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 3a93218f320b..849a95ef723c 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1732,7 +1732,7 @@ static short rtl8192_usb_initendpoints(struct net_device *dev) priv->rx_urb = kmalloc(sizeof(struct urb *) * (MAX_RX_URB + 1), GFP_KERNEL); - if (priv->rx_urb == NULL) + if (!priv->rx_urb) return -ENOMEM; #ifndef JACKSON_NEW_RX -- cgit v1.2.3 From 5a95f073b631ad8038c2f771b04bae737344df07 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Wed, 24 Feb 2016 22:46:00 +0530 Subject: Staging: rtl8192u: Remove debug messages As kmalloc generates a backtrace on failure so there is no need of these debug messages when kmalloc fails. Also remove unwanted {} around if block after removal of these messages. Signed-off-by: Bhumika Goyal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 879c41367e7a..b38ab3a0c0b8 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -460,10 +460,8 @@ static int is_duplicate_packet(struct ieee80211_device *ieee, // if (memcmp(entry->mac, mac, ETH_ALEN)){ if (p == &ieee->ibss_mac_hash[index]) { entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC); - if (!entry) { - printk(KERN_WARNING "Cannot malloc new mac entry\n"); + if (!entry) return 0; - } memcpy(entry->mac, mac, ETH_ALEN); entry->seq_num[tid] = seq; entry->frag_num[tid] = frag; @@ -1290,10 +1288,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, //ethertype = (payload[6] << 8) | payload[7]; rxb = kmalloc(sizeof(struct ieee80211_rxb), GFP_ATOMIC); if (!rxb) - { - IEEE80211_DEBUG(IEEE80211_DL_ERR,"%s(): kmalloc rxb error\n",__func__); goto rx_dropped; - } /* to parse amsdu packets */ /* qos data packets & reserved bit is 1 */ if (parse_subframe(skb, rx_stats, rxb, src, dst) == 0) { -- cgit v1.2.3 From 7288cadc199ebeb1e34237f999efa1368e4a3daf Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Sun, 28 Feb 2016 17:48:36 +0530 Subject: staging: rtl8192u: ieee80211: Remove unused variables The pointer *skb2 is declared 'globally' inside ifdef NOT_YET. It's used nowhere in the directory. Another pointer *skb2 is declared 'locally', again inside another ifdef NOT_YET in the function ieee80211_rx_frame_mgmt. Hence, skb2 stays unused and has been removed. This was done using Coccinelle: @@ type T; identifier i; constant c; @@ -T i; <... when != i -i = c; ...> Signed-off-by: Bhaktipriya Shridhar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index b38ab3a0c0b8..f18fc0b6775b 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -907,7 +907,6 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, //added by amy for reorder #ifdef NOT_YET struct net_device *wds = NULL; - struct sk_buff *skb2 = NULL; struct net_device *wds = NULL; int from_assoc_ap = 0; void *sta = NULL; -- cgit v1.2.3 From f80c1d57637800f3da8eece0859d1e942a119ea8 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Wed, 2 Mar 2016 00:18:31 +0530 Subject: Staging: rtl8192u: Replace memset with eth_broadcast_addr Use eth_broadcast_addr to assign the broadcast address to the given address array instead of memset when the second argument is a broacast address 0xff. ETH_ALEN is a macro with value 6, so 6 is treated as ETH_ALEN if it is the third argument of memset. Done using coccinelle. @@ expression e; @@ - memset(e,\(0xff\|0xFF\|255\),\(ETH_ALEN\|6\)); + eth_broadcast_addr(e); Signed-off-by: Bhumika Goyal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index f8041f9d61c8..2fbbf35c40ac 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -342,9 +342,9 @@ inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee) req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); req->header.duration_id = 0; /* FIXME: is this OK? */ - memset(req->header.addr1, 0xff, ETH_ALEN); + eth_broadcast_addr(req->header.addr1); memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN); - memset(req->header.addr3, 0xff, ETH_ALEN); + eth_broadcast_addr(req->header.addr3); tag = (u8 *) skb_put(skb,len+2+rate_len); -- cgit v1.2.3 From 0834ffac90526418fbcd877758840e811da817d2 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Wed, 2 Mar 2016 01:14:57 +0530 Subject: Staging: rtl8192u: Replace random_ether_addr with eth_random_addr The macro random_ether_addr is calling the function eth_random_addr. Therefore, the call to random_ether_addr can be replaced with eth_random_addr. Remove the wrapper function ieee80211_randomize_cell and replace its call with eth_random_addr as it is wrapping random_ether_addr. Done using coccinelle: @@ expression addr; @@ - random_ether_addr(addr); + eth_random_addr(addr); Signed-off-by: Bhumika Goyal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 2fbbf35c40ac..ae1274cfb392 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -2287,12 +2287,6 @@ void ieee80211_stop_queue(struct ieee80211_device *ieee) } EXPORT_SYMBOL(ieee80211_stop_queue); -inline void ieee80211_randomize_cell(struct ieee80211_device *ieee) -{ - - random_ether_addr(ieee->current_network.bssid); -} - /* called in user context only */ void ieee80211_start_master_bss(struct ieee80211_device *ieee) { @@ -2382,7 +2376,7 @@ static void ieee80211_start_ibss_wq(struct work_struct *work) if (ieee->state == IEEE80211_NOLINK) { printk("creating new IBSS cell\n"); if(!ieee->wap_set) - ieee80211_randomize_cell(ieee); + random_ether_addr(ieee->current_network.bssid); if(ieee->modulation & IEEE80211_CCK_MODULATION){ -- cgit v1.2.3 From db7425b130cbcfaf468d3e45f8c5e1659f8d1fb9 Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Thu, 10 Mar 2016 22:47:22 +0530 Subject: staging: rtl8192u: ieee80211_crypt: Remove unnecessary else after return This patch fixes the checkpatch warning that else is not generally useful after a break or return. This was done using Coccinelle: @@ expression e2; statement s1; @@ if(e2) { ... return ...; } -else s1 Signed-off-by: Bhaktipriya Shridhar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c index 3995620b3442..9cf90d040cfe 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c @@ -176,8 +176,7 @@ struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name) if (found_alg) return found_alg->ops; - else - return NULL; + return NULL; } -- cgit v1.2.3 From 56c4a79958ebe7fc476f03a31589863813e4dd89 Mon Sep 17 00:00:00 2001 From: Sandhya Bankar Date: Sun, 6 Mar 2016 16:19:28 +0530 Subject: Staging: ieee80211: Place constant on right side of the test. Place constant on right side of the test. Signed-off-by: Sandhya Bankar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/ieee80211/dot11d.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging/rtl8192u') diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.c b/drivers/staging/rtl8192u/ieee80211/dot11d.c index 82d60380bb40..00b6052fbbac 100644 --- a/drivers/staging/rtl8192u/ieee80211/dot11d.c +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.c @@ -103,7 +103,7 @@ u8 DOT11D_GetMaxTxPwrInDbm(struct ieee80211_device *dev, u8 Channel) PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); u8 MaxTxPwrInDbm = 255; - if (MAX_CHANNEL_NUMBER < Channel) { + if (Channel > MAX_CHANNEL_NUMBER) { netdev_err(dev->dev, "DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n"); return MaxTxPwrInDbm; } @@ -139,7 +139,7 @@ int IsLegalChannel(struct ieee80211_device *dev, u8 channel) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); - if (MAX_CHANNEL_NUMBER < channel) { + if (channel > MAX_CHANNEL_NUMBER) { netdev_err(dev->dev, "IsLegalChannel(): Invalid Channel\n"); return 0; } @@ -162,7 +162,7 @@ int ToLegalChannel(struct ieee80211_device *dev, u8 channel) } } - if (MAX_CHANNEL_NUMBER < channel) { + if (channel > MAX_CHANNEL_NUMBER) { netdev_err(dev->dev, "IsLegalChannel(): Invalid Channel\n"); return default_chn; } -- cgit v1.2.3