[PATCH] Staging: rtl18192u: fix style issues in ieee80211_softmac_wx.c

From: Mike Dupuis
Date: Fri Sep 04 2015 - 19:01:31 EST


This is a patch to the ieee80211_softmac_wx.c file that corrects several
checkpatch.pl warnings and errors.
Signed-off-by: Mike Dupuis <mike.dupuis.0@xxxxxxxxx>

---
.../rtl8192u/ieee80211/ieee80211_softmac_wx.c | 114 ++++++++++----------
1 file changed, 54 insertions(+), 60 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
index 3e502520..a8acd17 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
@@ -28,11 +28,11 @@ const long ieee80211_wlan_frequencies[] = {
};
EXPORT_SYMBOL(ieee80211_wlan_frequencies);

-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
- union iwreq_data *wrqu, char *b)
+int ieee80211_wx_set_freq(struct ieee80211_device *ieee,
+ struct iw_request_info *a, union iwreq_data *wrqu, char *b)
{
int ret;
- struct iw_freq *fwrq = & wrqu->freq;
+ struct iw_freq *fwrq = &wrqu->freq;

down(&ieee->wx_sem);

@@ -57,11 +57,11 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info
}
}

- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1) {
ret = -EOPNOTSUPP;
goto out;

- }else { /* Set the channel */
+ } else { /* Set the channel */

if (!(GET_DOT11D_INFO(ieee)->channel_map)[fwrq->m]) {
ret = -EINVAL;
@@ -70,11 +70,10 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);

- if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+ if (ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
+ if (ieee->state == IEEE80211_LINKED) {
+ ieee80211_stop_send_beacons(ieee);
+ ieee80211_start_send_beacons(ieee);
}
}

@@ -89,15 +88,15 @@ int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct iw_freq *fwrq = & wrqu->freq;
+ struct iw_freq *fwrq = &wrqu->freq;

if (ieee->current_network.channel == 0)
return -1;
- //NM 0.7.0 will not accept channel any more.
+ /* NM 0.7.0 will not accept channel any more. */
fwrq->m = ieee80211_wlan_frequencies[ieee->current_network.channel-1] * 100000;
fwrq->e = 1;
-// fwrq->m = ieee->current_network.channel;
-// fwrq->e = 0;
+/* fwrq->m = ieee->current_network.channel; */
+/* fwrq->e = 0; */

return 0;
}
@@ -141,7 +140,7 @@ int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
int ret = 0;
unsigned long flags;

- short ifup = ieee->proto_started;//dev->flags & IFF_UP;
+ short ifup = ieee->proto_started; /* dev->flags & IFF_UP; */
struct sockaddr *temp = (struct sockaddr *)awrq;

ieee->sync_scan_hurryup = 1;
@@ -179,7 +178,8 @@ out:
}
EXPORT_SYMBOL(ieee80211_wx_set_wap);

- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+int ieee80211_wx_get_essid(struct ieee80211_device *ieee,
+ struct iw_request_info *a, union iwreq_data *wrqu, char *b)
{
int len, ret = 0;
unsigned long flags;
@@ -223,7 +223,7 @@ int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
u32 target_rate = wrqu->bitrate.value;

ieee->rate = target_rate/100000;
- //FIXME: we might want to limit rate also in management protocols.
+ /* FIXME: we might want to limit rate also in management protocols. */
return 0;
}
EXPORT_SYMBOL(ieee80211_wx_set_rate);
@@ -233,6 +233,7 @@ int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
union iwreq_data *wrqu, char *extra)
{
u32 tmp_rate;
+
tmp_rate = TxCountToDataRate(ieee, ieee->softmac_stats.CurrentShowTxate);

wrqu->bitrate.value = tmp_rate * 500000;
@@ -247,8 +248,7 @@ int ieee80211_wx_set_rts(struct ieee80211_device *ieee,
{
if (wrqu->rts.disabled || !wrqu->rts.fixed)
ieee->rts = DEFAULT_RTS_THRESHOLD;
- else
- {
+ else {
if (wrqu->rts.value < MIN_RTS_THRESHOLD ||
wrqu->rts.value > MAX_RTS_THRESHOLD)
return -EINVAL;
@@ -269,8 +269,8 @@ int ieee80211_wx_get_rts(struct ieee80211_device *ieee,
}
EXPORT_SYMBOL(ieee80211_wx_get_rts);

-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
- union iwreq_data *wrqu, char *b)
+int ieee80211_wx_set_mode(struct ieee80211_device *ieee,
+ struct iw_request_info *a, union iwreq_data *wrqu, char *b)
{

ieee->sync_scan_hurryup = 1;
@@ -280,16 +280,14 @@ int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info
if (wrqu->mode == ieee->iw_mode)
goto out;

- if (wrqu->mode == IW_MODE_MONITOR){
-
+ if (wrqu->mode == IW_MODE_MONITOR)
ieee->dev->type = ARPHRD_IEEE80211;
- }else{
+ else
ieee->dev->type = ARPHRD_ETHER;
- }

- if (!ieee->proto_started){
+ if (!ieee->proto_started)
ieee->iw_mode = wrqu->mode;
- }else{
+ else {
ieee80211_stop_protocol(ieee);
ieee->iw_mode = wrqu->mode;
ieee80211_start_protocol(ieee);
@@ -305,10 +303,11 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work)
{
struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
short chan;
- HT_EXTCHNL_OFFSET chan_offset=0;
- HT_CHANNEL_WIDTH bandwidth=0;
+ HT_EXTCHNL_OFFSET chan_offset = 0;
+ HT_CHANNEL_WIDTH bandwidth = 0;
int b40M = 0;
static int count;
+
chan = ieee->current_network.channel;
netif_carrier_off(ieee->dev);

@@ -344,26 +343,24 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work)
ieee->InitialGainHandler(ieee->dev, IG_Restore);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- // To prevent the immediately calling watch_dog after scan.
- if (ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 )
- {
+ /* To prevent the immediately calling watch_dog after scan. */
+ if (ieee->LinkDetectInfo.NumRecvBcnInPeriod == 0 || ieee->LinkDetectInfo.NumRecvDataInPeriod == 0) {
ieee->LinkDetectInfo.NumRecvBcnInPeriod = 1;
- ieee->LinkDetectInfo.NumRecvDataInPeriod= 1;
+ ieee->LinkDetectInfo.NumRecvDataInPeriod = 1;
}
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);

- if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
+ if (ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
ieee80211_start_send_beacons(ieee);

netif_carrier_on(ieee->dev);
count = 0;
up(&ieee->wx_sem);
-
}

-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
- union iwreq_data *wrqu, char *b)
+int ieee80211_wx_set_scan(struct ieee80211_device *ieee,
+ struct iw_request_info *a, union iwreq_data *wrqu, char *b)
{
int ret = 0;

@@ -401,32 +398,30 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
proto_started = ieee->proto_started;

if (wrqu->essid.length > IW_ESSID_MAX_SIZE) {
- ret= -E2BIG;
+ ret = -E2BIG;
goto out;
}

if (ieee->iw_mode == IW_MODE_MONITOR) {
- ret= -1;
+ ret = -1;
goto out;
}

- if(proto_started)
+ if (proto_started)
ieee80211_stop_protocol(ieee);

-
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);

if (wrqu->essid.flags && wrqu->essid.length) {
- //first flush current network.ssid
- len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
+ /* first flush current network.ssid */
+ len = ((wrqu->essid.length - 1) < IW_ESSID_MAX_SIZE) ? wrqu->essid.length - 1 : IW_ESSID_MAX_SIZE;
strncpy(ieee->current_network.ssid, extra, len+1);
ieee->current_network.ssid_len = len+1;
ieee->ssid_set = 1;
- }
- else{
+ } else {
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
@@ -441,16 +436,15 @@ out:
}
EXPORT_SYMBOL(ieee80211_wx_set_essid);

- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
wrqu->mode = ieee->iw_mode;
return 0;
}
EXPORT_SYMBOL(ieee80211_wx_get_mode);

- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -461,7 +455,7 @@ EXPORT_SYMBOL(ieee80211_wx_get_mode);

down(&ieee->wx_sem);

- if(enable)
+ if (enable)
ieee->raw_tx = 1;
else
ieee->raw_tx = 0;
@@ -469,8 +463,7 @@ EXPORT_SYMBOL(ieee80211_wx_get_mode);
printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");

- if (ieee->iw_mode == IW_MODE_MONITOR)
- {
+ if (ieee->iw_mode == IW_MODE_MONITOR) {
if (prev == 0 && ieee->raw_tx) {
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
@@ -478,7 +471,7 @@ EXPORT_SYMBOL(ieee80211_wx_get_mode);
netif_carrier_on(ieee->dev);
}

- if(prev && ieee->raw_tx == 1)
+ if (prev && ieee->raw_tx == 1)
netif_carrier_off(ieee->dev);
}

@@ -520,6 +513,7 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee,
union iwreq_data *wrqu, char *extra)
{
int ret = 0;
+
down(&ieee->wx_sem);

if (wrqu->power.disabled) {
@@ -527,15 +521,15 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee,
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
- //ieee->ps_period = wrqu->power.value / 1000;
+ /* ieee->ps_period = wrqu->power.value / 1000; */
ieee->ps_timeout = wrqu->power.value / 1000;
}

if (wrqu->power.flags & IW_POWER_PERIOD) {

- //ieee->ps_timeout = wrqu->power.value / 1000;
+ /* ieee->ps_timeout = wrqu->power.value / 1000; */
ieee->ps_period = wrqu->power.value / 1000;
- //wrq->value / 1024;
+ /* wrq->value / 1024; */

}
switch (wrqu->power.flags & IW_POWER_MODE) {
@@ -550,7 +544,7 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee,
break;

case IW_POWER_ON:
- // ieee->ps = IEEE80211_PS_DISABLED;
+ /* ieee->ps = IEEE80211_PS_DISABLED; */
break;

default:
@@ -583,14 +577,14 @@ int ieee80211_wx_get_power(struct ieee80211_device *ieee,
wrqu->power.flags = IW_POWER_TIMEOUT;
wrqu->power.value = ieee->ps_timeout * 1000;
} else {
-// ret = -EOPNOTSUPP;
-// goto exit;
+ /* ret = -EOPNOTSUPP; */
+ /* goto exit; */
wrqu->power.flags = IW_POWER_PERIOD;
wrqu->power.value = ieee->ps_period * 1000;
-//ieee->current_network.dtim_period * ieee->current_network.beacon_interval * 1024;
+ /* ieee->current_network.dtim_period * ieee->current_network.beacon_interval * 1024; */
}

- if ((ieee->ps & (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST)) == (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST))
+ if ((ieee->ps & (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST)) == (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST))
wrqu->power.flags |= IW_POWER_ALL_R;
else if (ieee->ps & IEEE80211_PS_MBCAST)
wrqu->power.flags |= IW_POWER_MULTICAST_R;
--
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/