[PATCH] staging: ks7010: fix few checkpatch warnings in ks_wlan_net.c

From: Ilia Sergachev
Date: Tue Apr 25 2017 - 15:33:46 EST


Fixes few warnings and checks in drivers/staging/ks7010/ks_wlan_net.c

Signed-off-by: Ilia Sergachev <BM-2cVwRgNYPK72fLRfbWfkkmYLu7qHhYpwtr@xxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,linux-kernel@xxxxxxxxxxxxxxx

---
drivers/staging/ks7010/ks_wlan_net.c | 81 ++++++++++++++++++++++--------------
1 file changed, 49 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 121e1530fdba..d9d2785a218a 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -225,12 +225,13 @@ static int ks_wlan_set_freq(struct net_device *dev,
fwrq->m = c + 1;
}
/* Setting by channel number */
- if ((fwrq->m > 1000) || (fwrq->e > 0))
+ if ((fwrq->m > 1000) || (fwrq->e > 0)) {
rc = -EOPNOTSUPP;
- else {
+ } else {
int channel = fwrq->m;
/* We should do a better check than that,
- * based on the card capability !!! */
+ * based on the card capability !!!
+ */
if ((channel < 1) || (channel > 14)) {
netdev_dbg(dev,
"%s: New channel value of %d is invalid!\n",
@@ -238,7 +239,7 @@ static int ks_wlan_set_freq(struct net_device *dev,
rc = -EINVAL;
} else {
/* Yes ! We can set it !!! */
- priv->reg.channel = (u8) (channel);
+ priv->reg.channel = (u8)(channel);
priv->need_commit |= SME_MODE_SET;
}
}
@@ -343,7 +344,8 @@ static int ks_wlan_get_essid(struct net_device *dev,

/* for SLEEP MODE */
/* Note : if dwrq->flags != 0, we should
- * get the relevant SSID from the SSID list... */
+ * get the relevant SSID from the SSID list...
+ */
if (priv->reg.ssid.size) {
/* Get the current SSID */
memcpy(extra, priv->reg.ssid.body, priv->reg.ssid.size);
@@ -421,7 +423,7 @@ static int ks_wlan_get_wap(struct net_device *dev, struct iw_request_info *info,

/* for SLEEP MODE */
if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS)
- memcpy(awrq->sa_data, &(priv->current_ap.bssid[0]), ETH_ALEN);
+ memcpy(awrq->sa_data, &priv->current_ap.bssid[0], ETH_ALEN);
else
eth_zero_addr(awrq->sa_data);

@@ -493,12 +495,12 @@ static int ks_wlan_set_rate(struct net_device *dev,
case 11000000:
case 5500000:
priv->reg.rate_set.body[0] =
- (uint8_t) (vwrq->value / 500000);
+ (uint8_t)(vwrq->value / 500000);
break;
case 2000000:
case 1000000:
priv->reg.rate_set.body[0] =
- ((uint8_t) (vwrq->value / 500000)) |
+ ((uint8_t)(vwrq->value / 500000)) |
BASIC_RATE;
break;
default:
@@ -550,7 +552,7 @@ static int ks_wlan_set_rate(struct net_device *dev,
case 18000000:
case 9000000:
priv->reg.rate_set.body[0] =
- (uint8_t) (vwrq->value / 500000);
+ (uint8_t)(vwrq->value / 500000);
break;
case 24000000:
case 12000000:
@@ -560,7 +562,7 @@ static int ks_wlan_set_rate(struct net_device *dev,
case 2000000:
case 1000000:
priv->reg.rate_set.body[0] =
- ((uint8_t) (vwrq->value / 500000)) |
+ ((uint8_t)(vwrq->value / 500000)) |
BASIC_RATE;
break;
default:
@@ -977,8 +979,9 @@ static int ks_wlan_set_encode(struct net_device *dev,
if (priv->reg.wep_key[index].size) {
priv->reg.wep_index = index;
priv->need_commit |= SME_WEP_INDEX;
- } else
+ } else {
return -EINVAL;
+ }
}
}
}
@@ -1054,8 +1057,9 @@ static int ks_wlan_get_encode(struct net_device *dev,
if ((index >= 0) && (index < 4))
memcpy(extra, priv->reg.wep_key[index].val,
dwrq->length);
- } else
+ } else {
memcpy(extra, zeros, dwrq->length);
+ }
#endif
return 0;
}
@@ -1137,18 +1141,24 @@ static int ks_wlan_get_range(struct net_device *dev,
range->max_nwid = 0x0000;
range->num_channels = 14;
/* Should be based on cap_rid.country to give only
- * what the current card support */
+ * what the current card support
+ */
k = 0;
for (i = 0; i < 13; i++) { /* channel 1 -- 13 */
range->freq[k].i = i + 1; /* List index */
range->freq[k].m = frequency_list[i] * 100000;
- range->freq[k++].e = 1; /* Values in table in MHz -> * 10^5 * 10 */
+ range->freq[k++].e = 1; /* Values in table in MHz
+ * -> * 10^5 * 10
+ */
}
range->num_frequency = k;
- if (priv->reg.phy_type == D_11B_ONLY_MODE || priv->reg.phy_type == D_11BG_COMPATIBLE_MODE) { /* channel 14 */
+ if (priv->reg.phy_type == D_11B_ONLY_MODE ||
+ priv->reg.phy_type == D_11BG_COMPATIBLE_MODE) { /* channel 14 */
range->freq[13].i = 14; /* List index */
range->freq[13].m = frequency_list[13] * 100000;
- range->freq[13].e = 1; /* Values in table in MHz -> * 10^5 * 10 */
+ range->freq[13].e = 1; /* Values in table in MHz
+ * -> * 10^5 * 10
+ */
range->num_frequency = 14;
}

@@ -1189,7 +1199,8 @@ static int ks_wlan_get_range(struct net_device *dev,

/* Set an indication of the max TCP throughput
* in bit/s that we can expect using this interface.
- * May be use for QoS stuff... Jean II */
+ * May be use for QoS stuff... Jean II
+ */
if (i > 2)
range->throughput = 5000 * 1000;
else
@@ -1225,7 +1236,8 @@ static int ks_wlan_get_range(struct net_device *dev,

/* Experimental measurements - boundary 11/5.5 Mb/s */
/* Note : with or without the (local->rssi), results
- * are somewhat different. - Jean II */
+ * are somewhat different. - Jean II
+ */
range->avg_qual.qual = 50;
range->avg_qual.level = 186; /* -70 dBm */
range->avg_qual.noise = 0;
@@ -1272,8 +1284,9 @@ static int ks_wlan_set_power(struct net_device *dev,
priv->reg.powermgt = POWMGT_SAVE2_MODE;
else
return -EINVAL;
- } else
+ } else {
return -EINVAL;
+ }

hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST);

@@ -1362,7 +1375,7 @@ static int ks_wlan_get_aplist(struct net_device *dev,
return -EPERM;
/* for SLEEP MODE */
for (i = 0; i < priv->aplist.size; i++) {
- memcpy(address[i].sa_data, &(priv->aplist.ap[i].bssid[0]),
+ memcpy(address[i].sa_data, &priv->aplist.ap[i].bssid[0],
ETH_ALEN);
address[i].sa_family = ARPHRD_ETHER;
qual[i].level = 256 - priv->aplist.ap[i].rssi;
@@ -1397,8 +1410,8 @@ static int ks_wlan_set_scan(struct net_device *dev,

/* for SLEEP MODE */
/* specified SSID SCAN */
- if (wrqu->data.length == sizeof(struct iw_scan_req)
- && wrqu->data.flags & IW_SCAN_THIS_ESSID) {
+ if (wrqu->data.length == sizeof(struct iw_scan_req) &&
+ wrqu->data.flags & IW_SCAN_THIS_ESSID) {
req = (struct iw_scan_req *)extra;
priv->scan_ssid_len = req->essid_len;
memcpy(priv->scan_ssid, req->essid, priv->scan_ssid_len);
@@ -1452,7 +1465,7 @@ static inline char *ks_wlan_translate_scan(struct net_device *dev,
iwe.u.data.flags = 1;
current_ev =
iwe_stream_add_point(info, current_ev, end_buf, &iwe,
- &(ap->ssid.body[0]));
+ &ap->ssid.body[0]);

/* Add mode */
iwe.cmd = SIOCGIWMODE;
@@ -1494,15 +1507,17 @@ static inline char *ks_wlan_translate_scan(struct net_device *dev,
iwe.u.data.length = 0;
current_ev =
iwe_stream_add_point(info, current_ev, end_buf, &iwe,
- &(ap->ssid.body[0]));
+ &ap->ssid.body[0]);

/* Rate : stuffing multiple values in a single event require a bit
- * more of magic - Jean II */
+ * more of magic - Jean II
+ */
current_val = current_ev + IW_EV_LCP_LEN;

iwe.cmd = SIOCGIWRATE;
/* Those two flags are ignored... */
- iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
+ iwe.u.bitrate.fixed = 0;
+ iwe.u.bitrate.disabled = 0;

/* Max 16 values */
for (i = 0; i < 16; i++) {
@@ -1569,7 +1584,8 @@ static inline char *ks_wlan_translate_scan(struct net_device *dev,
}

/* The other data in the scan result are not really
- * interesting, so for now drop it - Jean II */
+ * interesting, so for now drop it - Jean II
+ */
return current_ev;
}

@@ -1596,7 +1612,8 @@ static int ks_wlan_get_scan(struct net_device *dev,

if (priv->aplist.size == 0) {
/* Client error, no scan results...
- * The caller need to restart the scan. */
+ * The caller need to restart the scan.
+ */
DPRINTK(2, "aplist 0\n");
return -ENODATA;
}
@@ -1608,9 +1625,9 @@ static int ks_wlan_get_scan(struct net_device *dev,
return -E2BIG;
}
current_ev = ks_wlan_translate_scan(dev, current_ev,
-// extra + IW_SCAN_MAX_DATA,
+ //extra + IW_SCAN_MAX_DATA,
extra + dwrq->length,
- &(priv->current_ap));
+ &priv->current_ap);
}
#endif
/* Read and parse all entries */
@@ -1621,9 +1638,9 @@ static int ks_wlan_get_scan(struct net_device *dev,
}
/* Translate to WE format this entry */
current_ev = ks_wlan_translate_scan(dev, info, current_ev,
-// extra + IW_SCAN_MAX_DATA,
+ //extra + IW_SCAN_MAX_DATA,
extra + dwrq->length,
- &(priv->aplist.ap[i]));
+ &priv->aplist.ap[i]);
}
/* Length of data */
dwrq->length = (current_ev - extra);
--
2.11.0