Re: [PATCH 2/2] Staging: rtl8192u: r8192U_wx.c Added {} braces and newlines

2014-05-28 Thread Greg KH
On Wed, May 28, 2014 at 07:32:39AM -0700, Chaitanya Hazarey wrote:
> -static int r8192_wx_set_scan_type(struct net_device *dev, struct 
> iw_request_info *aa, union
> - iwreq_data *wrqu, char *p){
> +static int r8192_wx_set_scan_type(struct net_device *dev, struct 
> iw_request_info *aa,
> + union iwreq_data *wrqu, char *p){

The '{' still isn't in the right place, but I'll let you fix that up in
a future patch.

thanks,

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


[PATCH 2/2] Staging: rtl8192u: r8192U_wx.c Added {} braces and newlines

2014-05-28 Thread Chaitanya Hazarey
Added {} braces and newlines to address the following:

ERROR: else should follow close brace '}'
ERROR: space required before the open brace '{'
ERROR: trailing statements should be on next line
ERROR: space required before the open parenthesis '('
ERROR: that open brace { should be on the previous line

Signed-off-by: Chaitanya Hazarey 
---
 drivers/staging/rtl8192u/r8192U_wx.c | 84 
 1 file changed, 46 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_wx.c 
b/drivers/staging/rtl8192u/r8192U_wx.c
index 1ba03ad..1af7c5d 100644
--- a/drivers/staging/rtl8192u/r8192U_wx.c
+++ b/drivers/staging/rtl8192u/r8192U_wx.c
@@ -315,7 +315,7 @@ static int rtl8180_wx_get_range(struct net_device *dev,
}
 
if (val == IW_MAX_FREQUENCIES)
-   break;
+   break;
}
range->num_frequency = val;
range->num_channels = val;
@@ -333,15 +333,14 @@ static int r8192_wx_set_scan(struct net_device *dev, 
struct iw_request_info *a,
struct ieee80211_device *ieee = priv->ieee80211;
int ret = 0;
 
-   if (!priv->up) return -ENETDOWN;
+   if (!priv->up)
+   return -ENETDOWN;
 
if (priv->ieee80211->LinkDetectInfo.bBusyTraffic == true)
return -EAGAIN;
-   if (wrqu->data.flags & IW_SCAN_THIS_ESSID)
-   {
+   if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
struct iw_scan_req *req = (struct iw_scan_req *)b;
-   if (req->essid_len)
-   {
+   if (req->essid_len) {
//printk("==**&*&*&**===>scan set ssid:%s\n", 
req->essid);
ieee->current_network.ssid_len = req->essid_len;
memcpy(ieee->current_network.ssid, req->essid, 
req->essid_len);
@@ -354,9 +353,9 @@ static int r8192_wx_set_scan(struct net_device *dev, struct 
iw_request_info *a,
priv->ieee80211->scanning = 0;
ieee80211_softmac_scan_syncro(priv->ieee80211);
ret = 0;
+   } else {
+   ret = ieee80211_wx_set_scan(priv->ieee80211, a, wrqu, b);
}
-   else
-   ret = ieee80211_wx_set_scan(priv->ieee80211, a, wrqu, b);
up(>wx_sem);
return ret;
 }
@@ -369,7 +368,8 @@ static int r8192_wx_get_scan(struct net_device *dev, struct 
iw_request_info *a,
int ret;
struct r8192_priv *priv = ieee80211_priv(dev);
 
-   if (!priv->up) return -ENETDOWN;
+   if (!priv->up)
+   return -ENETDOWN;
 
down(>wx_sem);
 
@@ -530,7 +530,8 @@ static int r8192_wx_set_enc(struct net_device *dev,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x03} };
int i;
 
-   if (!priv->up) return -ENETDOWN;
+   if (!priv->up)
+   return -ENETDOWN;
 
down(>wx_sem);
 
@@ -546,8 +547,10 @@ static int r8192_wx_set_enc(struct net_device *dev,
 
for (i = 0; i < 4; i++) {
hwkey[i] |=  key[4*i+0]
-   if (i == 1 && (4*i+1) == wrqu->encoding.length) mask = 
0x00;
-   if (i == 3 && (4*i+1) == wrqu->encoding.length) mask = 
0x00;
+   if (i == 1 && (4*i+1) == wrqu->encoding.length)
+   mask = 0x00;
+   if (i == 3 && (4*i+1) == wrqu->encoding.length)
+   mask = 0x00;
hwkey[i] |= (key[4*i+1])<<8;
hwkey[i] |= (key[4*i+2])<<16;
hwkey[i] |= (key[4*i+3])<<24;
@@ -557,12 +560,23 @@ static int r8192_wx_set_enc(struct net_device *dev,
#define CONF_WEP104 0x14
 
switch (wrqu->encoding.flags & IW_ENCODE_INDEX) {
-   case 0: key_idx = ieee->tx_keyidx; break;
-   case 1: key_idx = 0; break;
-   case 2: key_idx = 1; break;
-   case 3: key_idx = 2; break;
-   case 4: key_idx = 3; break;
-   default: break;
+   case 0:
+   key_idx = ieee->tx_keyidx;
+   break;
+   case 1:
+   key_idx = 0;
+   break;
+   case 2:
+   key_idx = 1;
+   break;
+   case 3:
+   key_idx = 2;
+   break;
+   case 4:
+   key_idx = 3;
+   break;
+   default:
+   break;
}
 
if (wrqu->encoding.length == 0x5) {
@@ -591,8 +605,9 @@ static int r8192_wx_set_enc(struct net_device *dev,
0,  //DefaultKey
hwkey); //KeyContent
 
+   } else {
+   printk("wrong type in WEP, not WEP40 and 

Re: [PATCH 2/2] Staging: rtl8192u: r8192U_wx.c Added {} braces and newlines

2014-05-28 Thread Greg KH
On Wed, May 28, 2014 at 07:32:39AM -0700, Chaitanya Hazarey wrote:
 -static int r8192_wx_set_scan_type(struct net_device *dev, struct 
 iw_request_info *aa, union
 - iwreq_data *wrqu, char *p){
 +static int r8192_wx_set_scan_type(struct net_device *dev, struct 
 iw_request_info *aa,
 + union iwreq_data *wrqu, char *p){

The '{' still isn't in the right place, but I'll let you fix that up in
a future patch.

thanks,

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


[PATCH 2/2] Staging: rtl8192u: r8192U_wx.c Added {} braces and newlines

2014-05-28 Thread Chaitanya Hazarey
Added {} braces and newlines to address the following:

ERROR: else should follow close brace '}'
ERROR: space required before the open brace '{'
ERROR: trailing statements should be on next line
ERROR: space required before the open parenthesis '('
ERROR: that open brace { should be on the previous line

Signed-off-by: Chaitanya Hazarey c...@24.io
---
 drivers/staging/rtl8192u/r8192U_wx.c | 84 
 1 file changed, 46 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_wx.c 
b/drivers/staging/rtl8192u/r8192U_wx.c
index 1ba03ad..1af7c5d 100644
--- a/drivers/staging/rtl8192u/r8192U_wx.c
+++ b/drivers/staging/rtl8192u/r8192U_wx.c
@@ -315,7 +315,7 @@ static int rtl8180_wx_get_range(struct net_device *dev,
}
 
if (val == IW_MAX_FREQUENCIES)
-   break;
+   break;
}
range-num_frequency = val;
range-num_channels = val;
@@ -333,15 +333,14 @@ static int r8192_wx_set_scan(struct net_device *dev, 
struct iw_request_info *a,
struct ieee80211_device *ieee = priv-ieee80211;
int ret = 0;
 
-   if (!priv-up) return -ENETDOWN;
+   if (!priv-up)
+   return -ENETDOWN;
 
if (priv-ieee80211-LinkDetectInfo.bBusyTraffic == true)
return -EAGAIN;
-   if (wrqu-data.flags  IW_SCAN_THIS_ESSID)
-   {
+   if (wrqu-data.flags  IW_SCAN_THIS_ESSID) {
struct iw_scan_req *req = (struct iw_scan_req *)b;
-   if (req-essid_len)
-   {
+   if (req-essid_len) {
//printk(==**===scan set ssid:%s\n, 
req-essid);
ieee-current_network.ssid_len = req-essid_len;
memcpy(ieee-current_network.ssid, req-essid, 
req-essid_len);
@@ -354,9 +353,9 @@ static int r8192_wx_set_scan(struct net_device *dev, struct 
iw_request_info *a,
priv-ieee80211-scanning = 0;
ieee80211_softmac_scan_syncro(priv-ieee80211);
ret = 0;
+   } else {
+   ret = ieee80211_wx_set_scan(priv-ieee80211, a, wrqu, b);
}
-   else
-   ret = ieee80211_wx_set_scan(priv-ieee80211, a, wrqu, b);
up(priv-wx_sem);
return ret;
 }
@@ -369,7 +368,8 @@ static int r8192_wx_get_scan(struct net_device *dev, struct 
iw_request_info *a,
int ret;
struct r8192_priv *priv = ieee80211_priv(dev);
 
-   if (!priv-up) return -ENETDOWN;
+   if (!priv-up)
+   return -ENETDOWN;
 
down(priv-wx_sem);
 
@@ -530,7 +530,8 @@ static int r8192_wx_set_enc(struct net_device *dev,
{0x00, 0x00, 0x00, 0x00, 0x00, 0x03} };
int i;
 
-   if (!priv-up) return -ENETDOWN;
+   if (!priv-up)
+   return -ENETDOWN;
 
down(priv-wx_sem);
 
@@ -546,8 +547,10 @@ static int r8192_wx_set_enc(struct net_device *dev,
 
for (i = 0; i  4; i++) {
hwkey[i] |=  key[4*i+0]mask;
-   if (i == 1  (4*i+1) == wrqu-encoding.length) mask = 
0x00;
-   if (i == 3  (4*i+1) == wrqu-encoding.length) mask = 
0x00;
+   if (i == 1  (4*i+1) == wrqu-encoding.length)
+   mask = 0x00;
+   if (i == 3  (4*i+1) == wrqu-encoding.length)
+   mask = 0x00;
hwkey[i] |= (key[4*i+1]mask)8;
hwkey[i] |= (key[4*i+2]mask)16;
hwkey[i] |= (key[4*i+3]mask)24;
@@ -557,12 +560,23 @@ static int r8192_wx_set_enc(struct net_device *dev,
#define CONF_WEP104 0x14
 
switch (wrqu-encoding.flags  IW_ENCODE_INDEX) {
-   case 0: key_idx = ieee-tx_keyidx; break;
-   case 1: key_idx = 0; break;
-   case 2: key_idx = 1; break;
-   case 3: key_idx = 2; break;
-   case 4: key_idx = 3; break;
-   default: break;
+   case 0:
+   key_idx = ieee-tx_keyidx;
+   break;
+   case 1:
+   key_idx = 0;
+   break;
+   case 2:
+   key_idx = 1;
+   break;
+   case 3:
+   key_idx = 2;
+   break;
+   case 4:
+   key_idx = 3;
+   break;
+   default:
+   break;
}
 
if (wrqu-encoding.length == 0x5) {
@@ -591,8 +605,9 @@ static int r8192_wx_set_enc(struct net_device *dev,
0,  //DefaultKey
hwkey); //KeyContent
 
+   } else {
+   printk(wrong type in WEP, not WEP40 and WEP104\n);